Operator

 

| HOME |

Using operators makes an expression more easy to read, and look more like a general  mathematic expression that you wrote down on paper.  Noodbeed has an extensive set of operators that work over several classes, such as double number, integer number, Matrix, Image and Vector. 

For an image object, in which spatial information is stored as part of the object, operation is done by taking into account the spatial information.  Therefore results of operation between matrices "A" and "B" does not necessarily equal to that of Images "a" and "b", whose matrices' size and content are exactly the same as matrices "A" and "B".  This is due to an image is supposed to have a spatial location on earth, and only those image content in the same spatial area are eligible in the operation.  All of these are taken care automatically by Noobeed.

Noobeed has put a lot of efforts in data type casting, so that you can always feel comfortable to mix different types of arguments in your expression.

The following are list of all available operators.

Operator Function Used for
+ addition String, number, complex, Matrix, Image, Vector, Vecint, VecStr
- subtraction number, complex, Matrix, Image, Vector, Vecint, VecStr
* multiplication number, complex, Matrix, Image
/ division  number, complex, Matrix, Image
^ exponentiation number, complex, Matrix, Image
% remainder/modulus  number only
< less than number, complex, Matrix, Image
<= less than or equal to number, complex, Matrix, Image
> greater than number, complex, Matrix, Image
>= greater than or equal to number, complex, Matrix, Image
== equal to number, complex, Matrix, Image
<> not equal to number, complex, Matrix, Image
! not number, complex, Matrix, Image
& and number, complex, Matrix, Image, Vector, Vecint, VecStr
| or number, complex, Matrix, Image, Vector, Vecint, VecStr

 

Matrix operator

binary operator

Argument 1 Operator Argument 2 Return
Matrix + number Matrix
Matrix - number Matrix
Matrix * number Matrix
Matrix / number Matrix
Matrix ^ number Matrix
Matrix < number Matrix_bln
Matrix <= number Matrix_bln
Matrix > number Matrix_bln
Matrix >= number Matrix_bln
Matrix == number Matrix_bln
Matrix <> number Matrix_bln
number + Matrix Matrix
number - Matrix Matrix
number * Matrix Matrix
number / Matrix Matrix
number ^ Matrix Matrix
number < Matrix Matrix_bln
number <= Matrix Matrix_bln
number > Matrix Matrix_bln
number >= Matrix Matrix_bln
number == Matrix Matrix_bln
number <> Matrix Matrix_bln
Matrix + Matrix Matrix
Matrix - Matrix Matrix
Matrix * Matrix Matrix
Matrix / Matrix Matrix
Matrix ^ Matrix Matrix
Matrix < Matrix Matrix_bln
Matrix <= Matrix Matrix_bln
Matrix > Matrix Matrix_bln
Matrix >= Matrix Matrix_bln
Matrix == Matrix Matrix_bln
Matrix <> Matrix Matrix_bln
Matrix & Matrix Matrix_bln
Matrix | Matrix Matrix_bln

 

unary operator

Operator Argument 1 Return
! Matrix Matrix_bln
+ Matrix Matrix
- Matrix Matrix

Example:

->a = [ 1 2 3; 4 5 6]
->a

ans =

  no of row    : 2
  no of column : 3

  0:    1.00000    2.00000    3.00000
  1:    4.00000    5.00000    6.00000


->a<=2

ans =

  no of row    : 2
  no of column : 3

  0:    1      1      0
  1:    0      0      0



->v = find(!(a<=2))
->v

ans =
Vector of Index (row, column)...

list id : 0

Vector size : 4

(0 , 2)
(1 , 0)
(1 , 1)
(1 , 2)


->

 

Image operator

binary operator

Unlike Matrix, an Image object has spatial information attached to it, i.e. the coordinates of LL and UR are known.  Therefore when two image objects are processed by an operator, e.g. + - * /, Noobeed will first generates an OVERLAP result image, then operation will only take part in the overlap area and the final result will be stored to the overlap image.  If two images have no spatial overlap area, nothing will happen and the result is an empty image.

Argument 1 Operator Argument 2 Return
Image + number Image
Image - number Image
Image * number Image
Image / number Image
Image ^ number Image
Image < number Image_bln
Image <= number Image_bln
Image > number Image_bln
Image >= number Image_bln
Image == number Image_bln
Image <> number Image_bln
number + Image Image
number - Image Image
number * Image Image
number / Image Image
number ^ Image Image
number < Image Image_bln
number <= Image Image_bln
number > Image Image_bln
number >= Image Image_bln
number == Image Image_bln
number <> Image Image_bln
Image + Image Image
Image - Image Image
Image * Image Image
Image / Image Image
Image ^ Image Image
Image < Image Image_bln
Image <= Image Image_bln
Image > Image Image_bln
Image >= Image Image_bln
Image == Image Image_bln
Image <> Image Image_bln
Image & Image Image_bln
Image | Image Image_bln

 

unary operator

Operator Argument 1 Return
! Image Image_bln
+ Image Image
- Image Image

Example:

->a = Image(2,3)

->a.matrix() = [ 1 2 3; 4 5 6]

->a.matrix()

ans =

    no of row     : 2

    no of column  : 3

   0:              1.000       2.000      3.000

   1:              4.000       5.000      6.000

->v = findimg(!(a>2))

->v

->ans = 

Vector of Pt2D...

list id : 0

Vector size : 2

(0.500 , 1.500)

(1.500 , 1.500)

->


| HOME |