Matrix Class Function Manual (A-C)

(  )

| HOME | BACK |

Purpose

To get a value of an element at a particular index in a Matrix.

Class

Matrix, Matrix_flt, Matrix_int, Matrix_sht, Matrix_uch, Matrix_bln, Matrix_str

Usage

For class Matrix

 {double} ret  =  object({int} argm1, {int} argm2)

For class Matrix_flt

{float} ret  =  object({int} argm1, {int} argm2)

For class Matrix_int

{int} ret  =  object({int} argm1, {int} argm2)

For class Matrix_sht

{short} ret  =  object({int} argm1, {int} argm2)

For class Matrix_uch

{uchar} ret  =  object({int} argm1, {int} argm2)

For class Matrix_bln

{bool} ret  =  object({int} argm1, {int} argm2)

For class Matrix_str

{String} ret  =  object({int} argm1, {int} argm2

 

argm1 = row number

argm2 = column number

Example:

->A = [ 1 2 3; 4 5 6; 7 8 9]

->a = A(0,1)

->print a

        2

See also (class function)

set

| HOME | BACK |


ABS

| HOME | BACK |

Purpose

To calculate an absolute value of a Matrix.

Class

Matrix, Matrix_flt, Matrix_int, Matrix_sht, Matrix_uch, Matrix_bln

Usage

For class Matrix

{Matrix} ret  =  object.ABS()

For class Matrix_flt

{Matrix_flt} ret  =  object.ABS()

For class Matrix_int

{Matrix_int} ret  =  object.ABS()

For class Matrix_sht

{Matrix_sht} ret  =  object.ABS()

For class Matrix_uch

{Matrix_uch} ret  =  object.ABS()

For class Matrix_bln

{Matrix_bln} ret  =  object.ABS()

Example:

->A = [ -1 -2 -3; 4 5 6; 7 8 9]

->B = A.abs()

->print B

 no of row    : 3
 no of column : 3

 0:    1    2    3
 1:    4    5    6
 2:    7    8    9

->

See also (class function)

sin, cos, tan

| HOME | BACK |


ACOS

| HOME | BACK |

Purpose

To calculate an inverse cosine function of a Matrix.  The return matrix are angles, in a unit set by command "set angle", ranging from -90 degrees to +90 degrees.

Class

Matrix, Matrix_flt, Matrix_int, Matrix_sht, Matrix_uch, Matrix_bln

Usage

{Matrix} ret  =  object.ACOS()

Example:

->A = [ .1 .2 .3; .4 .5 .6; .7 .8 .9]

->B = A.acos()

->print B


 no of row    : 3
 no of column : 3

 0:    84.26083    78.46304    72.54240
 1:    66.42182    60.00000    53.13010
 2:    45.57300    36.86990    25.84193

See also (class function)

sin, cos, tan

| HOME | BACK |


ADDRIM

| HOME | BACK |

Purpose

To make a new matrix by padding border lines, 4 sides, with a specified thickness.  The padding region has an initial value of zero.

Class

Matrix, Matrix_flt, Matrix_int, Matrix_sht, Matrix_uch, Matrix_bln

Usage

For class Matrix

{Matrix} ret  =  object.ADDRIM({int} argm1)

For class Matrix_flt

{Matrix_flt ret  =  object.ADDRIM({int} argm1)

For class Matrix_int

{Matrix_int} ret  =  object.ADDRIM({int} argm1)

For class Matrix_sht

{Matrix_sht} ret  =  object.ADDRIM({int} argm1)

For class Matrix_uch

{Matrix_uch} ret  =  object.ADDRIM({int} argm1)

For class Matrix_bln

{Matrix_bln} ret  =  object.ADDRIM({int} argm1)

argm1 = padding border line thickness

Example:

->A = [ 1 2 3; 4 5 6; 7 8 9]

->B = A.addrim(1)

->print B


 no of row    : 5
 no of column : 5

 0:   0   0   0   0   0

 1:   0   1   2   3   0

 2:   0   4   5   6   0

 3:   0   7   8   9   0

 4:   0   0   0   0   0

See also (class function)

concat, concatdown

| HOME | BACK |


ANAGLYPH

| HOME | BACK |

Purpose

To make an anaglyph image.  The calling matrix is to be the left image and the matrix in the first argument is to be the right image.  They are to be overlaid on top of each other, assigning gray scale of the left image as a shade of red color and that of the right image as a shade of cyan color.  Anaglyph glasses, red and cyan or red and green, are needed to view the image.

First of all, the height, no of rows, of the two matrices must be equal. 

Then, imagine that the right image is place on top of the left image, such that the left edges of the two images touch each other.  This is called the initial position.  Then the right image is to be moved to the left or to the right direction from the initial position.  This amount of shift is specified by the user as the second argument of the function.  By adjusting the amount of shift, the user can control the strength of the 3D perception.

Class

Matrix, Matrix_flt, Matrix_int, Matrix_sht, Matrix_uch, Matrix_bln

Usage

{Image_rgb} ret  =  object.ANAGLYPH({Matrix_uch} argm1, {int} argm2)

argm1 = the right image

argm2 = amount of shift, in pixels, of the right image

       (positive = shift to the right, negative = shift to the left)

Example:

->Img_color = A.anaglyph(B, 50)

->

The above example will make an anaglyph image from matrix A, the left image, and matrix B, the right image, with a separation distance of 50 pixels.

See also (class function)

angphtif

| HOME | BACK |


ANGLE

| HOME | BACK |

Purpose

To calculate an angle between two 3D vectors.  The first vector is the calling matrix and the second vector is the matrix in the function argument.  The two vector can be a row or column matrix, but need to have exactly 3 elements.  The unit  of the return angle is controlled by command "set angle".

Class

Matrix, Matrix_flt, Matrix_int, Matrix_sht, Matrix_uch, Matrix_bln

Usage

For class Matrix

{double} ret  =  object.ANGLE({Matrix} argm1)

For class Matrix_flt

{double} ret  =  object.ANGLE({Matrix_flt} argm1)

For class Matrix_int

{double} ret  =  object.ANGLE({Matrix_int} argm1)

For class Matrix_sht

{double} ret  =  object.ANGLE({Matrix_sht} argm1)

For class Matrix_uch

{double} ret  =  object.ANGLE({Matrix_uch} argm1)

For class Matrix_bln

{double} ret  =  object.ANGLE({Matrix_bln} argm1)

argm1 = the second 3D-vector

Example:

->set angle "deg"
->a = [ 1 2 3]
->b = [ 4 5 6]
->a.angle(b)

ans = 12.93315

->

See also (class function)

cross, dot

| HOME | BACK |


ANGPHTIF

| HOME | BACK |

Purpose

This function works almost exactly the same as the function "anaglyph", except that rather than creating an Image_rgb object, it stores the result anaglyph image as a TIF format in a file specified by the user.

Class

Matrix, Matrix_flt, Matrix_int, Matrix_sht, Matrix_uch, Matrix_bln

Usage

{void} object.ANGPHTIF({Matrix_uch} argm1, {int} argm2, {String} argm3)

argm1 = the right image

argm2 = amount of shift, in pixels, of the right image

       (positive = shift to the right, negative = shift to the left)

argm3 = TIF image file name

Example:

->A.anaglyph(B, 50, "my_3D_image")

->

The above example will make an anaglyph image and save as a TIF file, "my_3D_image.tif" in the current working directory, from matrix A, the left image, and matrix B, the right image, with a separation distance of 50 pixels.

See also (class function)

anaglyph

| HOME | BACK |


ASIN

| HOME | BACK |

Purpose

To calculate an inverse sine function of a Matrix.  The return matrix are angles, in a unit set by command "set angle", ranging from -90 degrees to +90 degrees.

Class

Matrix, Matrix_flt, Matrix_int, Matrix_sht, Matrix_uch, Matrix_bln

Usage

{Matrix} ret  =  object.ASIN()

Example:

->A = [ .1 .2 .3; .4 .5 .6; .7 .8 .9]

->B = A.asin()

->print B


 no of row    : 3
 no of column : 3

 0:     5.73917    11.53696    17.45760
 1:    23.57818    30.00000    36.86990
 2:    44.42700    53.13010    64.15807

See also (class function)

sin, cos, tan

| HOME | BACK |


ATAN

| HOME | BACK |

Purpose

To calculate an inverse tangent function of a Matrix.  The return matrix are angles, in a unit set by command "set angle", ranging from -90 degrees to +90 degrees.

Class

Matrix, Matrix_flt, Matrix_int, Matrix_sht, Matrix_uch, Matrix_bln

Usage

{Matrix} ret  =  object.ATAN()

Example:

->A = [ .1 .2 .3; .4 .5 .6; .7 .8 .9]

->B = A.atan()

->print B


 no of row    : 3
 no of column : 3

 0:     5.71059    11.30993    16.69924
 1:    21.80141    26.56505    30.96376
 2:    34.99202    38.65981    41.98721

See also (class function)

sin, cos, tan

| HOME | BACK |


BINARY

| HOME | BACK |

Purpose

To make a binary matrix, whose values are either 0 or 255.

Class

Matrix, Matrix_flt, Matrix_int, Matrix_sht, Matrix_uch, Matrix_bln

Usage

{Matrix_uch} ret  =  object.BINARY([{double} argm1])

argm1 = The threshold value (if x > threshold; value = 255, otherwise value = 0)

        (default threshold value = 0)

Example:

->A = [ 1 2 3; 4 5 6; 7 8 9]

->B = A.binary(4)

->print B


 no of row    : 3
 no of column : 3

 0:       0       0       0
 1:       0     255     255
 2:     255     255     255

See also (class function)

reclass, reassign, set

| HOME | BACK |


BIT

| HOME | BACK |

Purpose

To convert to a Matrix_uch object that contains 8-bit binary number of the content of the calling matrix.  Each element of the calling matrix will expand to 8 elements, representing 8 bits of the binary numbers of the original data.

Class

Matrix_uch

Usage

{Matrix_uch} ret  =  object.BIT()

Example:

->a = [ 1 2 3 254 255].uchar()
->a.bit()

ans =

no of row : 5
no of column : 8

0: 0 0 0 0 0 0 0 1
1: 0 0 0 0 0 0 1 0
2: 0 0 0 0 0 0 1 1
3: 1 1 1 1 1 1 1 0
4: 1 1 1 1 1 1 1 1


->

See also (class function)

-

| HOME | BACK |


BOOL

| HOME | BACK |

Purpose

To convert to a boolean matrix, a Matrix_bln object.

Class

Matrix, Matrix_flt, Matrix_int, Matrix_sht, Matrix_uch, Matrix_bln

Usage

{Matrix_bln} ret  =  object.BOOL()

Example:

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

no of row    : 2
no of column : 3

0:  1.00000  2.00000  3.00000
1:  4.00000  5.00000  6.00000


->B = a.bool()
->print B

no of row    : 2
no of column : 3

0:   1   0   1
1:   0   1   1

->

See also (class function)

float, int, short, uchar

| HOME | BACK |


BOUNDARY

| HOME | BACK |

Purpose

To find indices of all boundary pixels of a uniform region, having a specific pixel value given by the user.  It is important to make sure that there is only one uniform region of the specified value in the matrix.

Class

Matrix, Matrix_flt, Matrix_int, Matrix_sht, Matrix_uch, Matrix_bln

Usage

For class Matrix

{VecIndx} ret  =  object.BOUNDARY({double} argm1)

For class Matrix_flt

{VecIndx} ret  =  object.BOUNDARY({float} argm1)

For class Matrix_int

{VecIndx} ret  =  object.BOUNDARY({int} argm1)

For class Matrix_sht

{VecIndx} ret  =  object.BOUNDARY({short} argm1)

For class Matrix_uch

{VecIndx} ret  =  object.BOUNDARY({uchar} argm1)

For class Matrix_bln

{VecIndx} ret  =  object.BOUNDARY({bool} argm1)

argm1 = value of the region of which the boundary is wanted

Example:

->set precision 0
->A = Matrix(3,3,99)
->B = A.addrim(2)
->print B


 no of row    : 7
 no of column : 7

 0:    0.   0.   0.   0.   0.   0.   0.

 1:    0.   0.   0.   0.   0.   0.   0.

 2:    0.   0.  99.  99.  99.   0.   0.

 3:    0.   0.  99.  99.  99.   0.   0.

 4:    0.   0.  99.  99.  99.   0.   0.

 5:    0.   0.   0.   0.   0.   0.   0.

 6:    0.   0.   0.   0.   0.   0.   0.



->v = B.boundary(99)
->print v

Vector of Index (row, column)...

list id : 0

Vector size : 8

(2 , 2)
(2 , 3)
(2 , 4)
(3 , 2)
(3 , 4)
(4 , 2)
(4 , 3)
(4 , 4)

See also (class function)

polyline, linefollow

| HOME | BACK |


BWRGB

| HOME | BACK |

Purpose

To make an Image_rgb object from a matrix.  All three colors of the Image_rgb are equal, hence it will basically look exactly the same as a gray scale image.  This conversion is useful when the user wants to add color element to the object, e.g. draw lines, poly-lines in colors.

Class

Matrix, Matrix_flt, Matrix_int, Matrix_sht, Matrix_uch, Matrix_bln

Usage

{Image_rgb} ret  =  object.BWRGB()

Example:

->A_rgb = A.bwrgb()

->

The above example will make an Image_rgb object from matrix A.

See also (class function)

rgbauto, rgb

| HOME | BACK |


CLEAR

| HOME | BACK |

Purpose

To clear all pixel values and set them to a specific value given by the user.

Class

Matrix, Matrix_flt, Matrix_int, Matrix_sht, Matrix_uch, Matrix_bln

Usage

{void} object.CLEAR({double} argm1)

argm1 = a value to which all pixels will be set

Example:

->a = [ 1 2 3; 4 5 6; 7 8 9]
->a.clear(9)

ans =

 no of row    : 3
 no of column : 3

 0:    9.00000    9.00000    9.00000
 1:    9.00000    9.00000    9.00000
 2:    9.00000    9.00000    9.00000
 

See also (class function)

set, init

| HOME | BACK |


CLOSE

| HOME | BACK |

Purpose

To close a virtually loaded matrix.  This function is irrelevant to a normal matrix.

Class

Matrix, Matrix_flt, Matrix_int, Matrix_sht, Matrix_uch, Matrix_bln

Usage

{void} object.CLOSE()

Example:

->A = Matrix()

->A.vload("mat_1")

->A.close()

See also (class function)

vload, load, save

| HOME | BACK |


COMPLEX

| HOME | BACK |

Purpose

To convert to a Matrix_cmp object.  Each element in the result matrix is a complex number, whose real parts are taken from the calling matrix, and the imaginary parts are zero.

Class

Matrix, Matrix_flt, Matrix_int, Matrix_sht, Matrix_uch, Matrix_bln

Usage

{Matrix_cmp} ret  =  object.COMPLEX()

Example:

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


no of row    : 2
no of column : 3

0: 1.00000   2.00000   3.00000
1: 4.00000   5.00000   6.00000


->B = A.complex()
->print B


no of row    : 2
no of column : 3

0:   1.00000 + 0.00000i   2.00000 + 0.00000i   3.00000 + 0.00000i
1:   4.00000 + 0.00000i   5.00000 + 0.00000i   6.00000 + 0.00000i


->

See also (class function)

float, int, short, uchar, bool

| HOME | BACK |


COMPMAX

| HOME | BACK |

Purpose

To compare elements of two matrices, and store the maximum value in a new matrix.

Class

Matrix, Matrix_flt, Matrix_int, Matrix_sht, Matrix_uch, Matrix_bln

Usage

For class Matrix

{Matrix} ret  =  object.COMPMAX({Matrix} argm1)

For class Matrix_flt

{Matrix_flt} ret  =  object.COMPMAX({Matrix_flt} argm1)

For class Matrix_int

{Matrix_int} ret  =  object.COMPMAX({Matrix_int} argm1)

For class Matrix_sht

{Matrix_sht} ret  =  object.COMPMAX({Matrix_sht} argm1)

For class Matrix_uch

{Matrix_uch} ret  =  object.COMPMAX({Matrix_uch} argm1)

For class Matrix_bln

{Matrix_bln} ret  =  object.COMPMAX({Matrix_bln} argm1)

argm1 = a matrix whose elements values are to be compared to those of the calling matrix

Example:

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

->b = [ 7 8 9; 4 5 6; 1 2 3]

->c = a.compmax(b)

->print c

ans =

 no of row    : 3
 no of column : 3

 0:    7.00000    8.00000    9.00000
 1:    4.00000    5.00000    6.00000
 2:    7.00000    8.00000    9.00000

See also (class function)

compmin

| HOME | BACK |


COMPMIN

| HOME | BACK |

Purpose

To compare elements of two matrices, and store the minimum value in a new matrix.

Class

Matrix, Matrix_flt, Matrix_int, Matrix_sht, Matrix_uch, Matrix_bln

Usage

For class Matrix

{Matrix} ret  =  object.COMPMIN({Matrix} argm1)

For class Matrix_flt

{Matrix_flt} ret  =  object.COMPMIN({Matrix_flt} argm1)

For class Matrix_int

{Matrix_int} ret  =  object.COMPMIN({Matrix_int} argm1)

For class Matrix_sht

{Matrix_sht} ret  =  object.COMPMIN({Matrix_sht} argm1)

For class Matrix_uch

{Matrix_uch} ret  =  object.COMPMIN({Matrix_uch} argm1)

For class Matrix_bln

{Matrix_bln} ret  =  object.COMPMIN({Matrix_bln} argm1)

argm1 = a matrix whose elements values are to be compared to those of the calling matrix

Example:

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

->b = [ 7 8 9; 4 5 6; 1 2 3]

->c = a.compmin(b)

->print c

ans =

 no of row    : 3
 no of column : 3

 0:    1.00000    2.00000    3.00000
 1:    4.00000    5.00000    6.00000
 2:    1.00000    2.00000    3.00000

See also (class function)

compmax

| HOME | BACK |


CONCAT

| HOME | BACK |

Purpose

To concatenate a matrix to the right hand side of a calling matrix, and store the result in a new matrix.

Class

Matrix, Matrix_flt, Matrix_int, Matrix_sht, Matrix_uch, Matrix_bln, Matrix_str

Usage

For class Matrix

{Matrix} ret  =  object.CONCAT({Matrix} argm1)

For class Matrix_flt

{Matrix_flt} ret  =  object.CONCAT({Matrix_flt} argm1)

For class Matrix_int

{Matrix_int} ret  =  object.CONCAT({Matrix_int} argm1)

For class Matrix_sht

{Matrix_sht} ret  =  object.CONCAT({Matrix_sht} argm1)

For class Matrix_uch

{Matrix_uch} ret  =  object.CONCAT({Matrix_uch} argm1)

For class Matrix_bln

{Matrix_bln} ret  =  object.CONCAT({Matrix_bln} argm1)

For class Matrix_str

{Matrix_str} ret  =  object.CONCAT({Matrix_str} argm1)

 

argm1 = a matrix to be concatenated to the right side of the calling matrix

Example:

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

->b = [ 7 8 9; 4 5 6; 1 2 3]

->c = a.concat(b)

->print c

ans =

 no of row    : 3
 no of column : 6

 0:    1.00000    2.00000    3.00000    7.00000    8.00000    9.00000
 1:    4.00000    5.00000    6.00000    4.00000    5.00000    6.00000
 2:    7.00000    8.00000    9.00000    1.00000    2.00000    3.00000

See also (class function)

concatdown

| HOME | BACK |


CONCATDOWN

| HOME | BACK |

Purpose

To concatenate a matrix to the bottom of a calling matrix, and store the result in a new matrix.

Class

Matrix, Matrix_flt, Matrix_int, Matrix_sht, Matrix_uch, Matrix_bln, Matrix_str

Usage

For class Matrix

{Matrix} ret  =  object.CONCATDOWN({Matrix} argm1)

For class Matrix_flt

{Matrix_flt} ret  =  object.CONCATDOWN({Matrix_flt} argm1)

For class Matrix_int

{Matrix_int} ret  =  object.CONCATDOWN({Matrix_int} argm1)

For class Matrix_sht

{Matrix_sht} ret  =  object.CONCATDOWN({Matrix_sht} argm1)

For class Matrix_uch

{Matrix_uch} ret  =  object.CONCATDOWN({Matrix_uch} argm1)

For class Matrix_bln

{Matrix_bln} ret  =  object.CONCATDOWN({Matrix_bln} argm1)

For class Matrix_str

{Matrix_str} ret  =  object.CONCATDOWN({Matrix_str} argm1)

 

argm1 = a matrix to be concatenated to the bottom of the calling matrix

Example:

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

->b = [ 7 8 9; 4 5 6; 1 2 3]

->c = a.concatdown(b)

->print c

ans =

 no of row    : 6
 no of column : 3

 0:    1.00000    2.00000    3.00000
 1:    4.00000    5.00000    6.00000
 2:    7.00000    8.00000    9.00000
 3:    7.00000    8.00000    9.00000
 4:    4.00000    5.00000    6.00000
 5:    1.00000    2.00000    3.00000

See also (class function)

concat

| HOME | BACK |


CONVOL

| HOME | BACK |

Purpose

To calculate a convolution of two matrices.  The calling matrix is the base matrix, which is to be convolved by the argument matrix. 

By definition of the convolution, the convolved matrix is to be flipped in both horizontal and vertical, and is to be moved all over the base matrix.  The size of the result matrix is the same as the calling matrix.  Each element of the result matrix is a summation of the multiplication, element by element, of elements of the two matrices.

There is no calculation at the border of the calling image.   The convolution values in this region are simply copied from the nearest lines.

Class

Matrix, Matrix_flt, Matrix_int, Matrix_sht, Matrix_uch, Matrix_bln

Usage

{Matrix} ret  =  object.CONVOL({Matrix} argm1)

argm1 = a matrix to convolve to the calling matrix

Example:

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

->b = [ 7 8 9; 4 5 6; 1 2 3]

->c = a.convol(b)

->print c

ans =

 no of row    : 3
 no of column : 3

 0:  273.00000  273.00000  273.00000
 1:  273.00000  273.00000  273.00000
 2:  273.00000  273.00000  273.00000
 

See also (class function)

fmean, fgauss

| HOME | BACK |


CORR

| HOME | BACK |

Purpose

To compute a correlation coefficient of all elements of two matrices.  The result is in a range of -1 to 1.

Class

Matrix, Matrix_flt, Matrix_int, Matrix_sht, Matrix_uch, Matrix_bln

Usage

For class Matrix

{double} ret  =  object.CORR({Matrix} argm1)

For class Matrix_flt

{double} ret  =  object.CORR({Matrix_flt} argm1)

For class Matrix_int

{double} ret  =  object.CORR({Matrix_int} argm1)

For class Matrix_sht

{double} ret  =  object.CORR({Matrix_sht} argm1)

For class Matrix_uch

{double} ret  =  object.CORR({Matrix_uch} argm1)

For class Matrix_bln

{double} ret  =  object.CORR({Matrix_bln} argm1)

argm1 = another matrix

Example:

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

->b = [ 7 8 9; 4 5 6; 1 2 3]

->c = a.corr(b)

->print c

       -0.80000
 

See also (class function)

cov, compmin, compmax

| HOME | BACK |


COS

| HOME | BACK |

Purpose

To calculate a cosine function of a Matrix.  The angle unit is that set by command "set angle".

Class

Matrix, Matrix_flt, Matrix_int, Matrix_sht, Matrix_uch, Matrix_bln

Usage

{Matrix} ret  =  object.COS()

Example:

->set angle "deg"
->A = [ 1 2 3; 4 5 6; 67 8 9]
->B = A.cos()
->print B

no of row    : 3
no of column : 3

0:   0.99985   0.99939   0.99863
1:   0.99756   0.99619   0.99452
2:   0.39073   0.99027   0.98769

->

See also (class function)

sin, tan

| HOME | BACK |


COV

| HOME | BACK |

Purpose

To compute a covariant value of all elements of two matrices.

Class

Matrix, Matrix_flt, Matrix_int, Matrix_sht, Matrix_uch, Matrix_bln

Usage

For class Matrix

{double} ret  =  object.COV({Matrix} argm1)

For class Matrix_flt

{double} ret  =  object.COV({Matrix_flt} argm1)

For class Matrix_int

{double} ret  =  object.COV({Matrix_int} argm1)

For class Matrix_sht

{double} ret  =  object.COV({Matrix_sht} argm1)

For class Matrix_uch

{double} ret  =  object.COV({Matrix_uch} argm1)

For class Matrix_bln

{double} ret  =  object.COV({Matrix_bln} argm1)

argm1 = another matrix

Example:

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

->b = [ 7 8 9; 4 5 6; 1 2 3]

->c = a.cov(b)

->print c

       -6.00000
 

See also (class function)

corr, compmin, compmax

| HOME | BACK |


CROSS

| HOME | BACK |

Purpose

To calculate a cross product between two 3D vectors.  The first vector is the calling matrix and the second vector is the matrix in the function argument.  The two vector can be a row or column matrix, but need to have exactly 3 elements. 

Class

Matrix, Matrix_flt, Matrix_int, Matrix_sht, Matrix_uch, Matrix_bln

Usage

For class Matrix

{Matrix} ret  =  object.CROSS({Matrix} argm1)

For class Matrix_flt

{Matrix_flt} ret  =  object.CROSS({Matrix_flt} argm1)

For class Matrix_int

{Matrix_int} ret  =  object.CROSS({Matrix_int} argm1)

For class Matrix_sht

{Matrix_sht} ret  =  object.CROSS({Matrix_sht} argm1)

For class Matrix_uch

{Matrix_uch} ret  =  object.CROSS({Matrix_uch} argm1)

For class Matrix_bln

{Matrix_bln} ret  =  object.CROSS({Matrix_bln} argm1)

argm1 = the second 3D-vector

Example:

->a = [ 1 2 3 ]

->b = [ 4 5 6 ]

->c = a.cross(b)

->print c

ans =

 no of row    : 3
 no of column : 1

 0:  -3.00000
 1:   6.00000
 2:  -3.00000

See also (class function)

dot, angle

| HOME | BACK |