Matrix Class Function Manual (S-U)

SAPPASC

| HOME | BACK |

Purpose

To save as ASCII format by appending its content to an existing file.  If the specified does not exist, the function will create a new file, and the result will be exactly the same as using function "saveasc".

if a file name extension is not given, the function assumes an extension of ".txt".

if a path name is not include in the specified file name, the function will search in the current data path, set by command "set path".

Class

Matrix, Matrix_flt, Matrix_int, Matrix_sht, Matrix_uch, Matrix_bln

Usage

{void} object.SAPPASC({String} argm1, [{int} argm2, {int} argm3])

argm1 = an existing file name

argm2 = no of decimal digits         (default = value set by command "set precision")

argm3 = no of width for each element (default = value set by command "set width")

Example:

->A.sappasc("Mat_1")

->

See also (class function)

saveasc

| HOME | BACK |


SAPPBIN

| HOME | BACK |

Purpose

To save as binary format by appending its content to an existing file.  If the specified does not exist, the function will create a new file, and the result will be exactly the same as using function "savebin".

if a file name extension is not given, the function assumes an extension of ".raw".

if a path name is not include in the specified file name, the function will search in the current data path, set by command "set path".

Class

Matrix, Matrix_flt, Matrix_int, Matrix_sht, Matrix_uch, Matrix_bln

Usage

{void} object.SAPPBIN({String} argm1)

argm1 = an existing file name

Example:

->A.sappbin("Mat_2")

->

See also (class function)

savebin

| HOME | BACK |


SAVE

| HOME | BACK |

Purpose

To save as Noobeed format.  The function creates two files, one for documentation and another for data.

The documentation file will have an extension ".txt".  It is actually an ASCII file and must have exactly 6 lines (not including comment lines) , as follows.

 

Matrix

/ Documant file of a Matrix object

/ no of data type (in byte)

8

/ no of row

3

/ no of column

3

/ flag null data (0 = off, 1 = on)

0

/ null data

0.000000000000000

 

The data file is in fact a generic binary file.  First it stores all element of the first row of the matrix, from the first to the last column, then go to the second row, and does the same thing.  Hence the size of the data file will be exactly equal to total number of elements of the matrix multiplied by no of bytes per element (8 bytes in this case).

if a file name extension is not given, the function assumes an extension of ".txt" for documentation file and ".raw" for data file.

if a path name is not include in the specified file name, the function will search in the current data path, set by command "set path".

Class

Matrix, Matrix_flt, Matrix_int, Matrix_sht, Matrix_uch, Matrix_bln

Usage

{void} object.SAVE({String} argm1, [{String} argm2])

argm1 = documentation file name

argm2 = data file name   (default = same name as argm1 with extension ".raw")

Example:

->A.save("Mat_3")

->

See also (class function)

load

| HOME | BACK |


SAVEASC

| HOME | BACK |

Purpose

To save as ASCII format.  Each line in the output file represents a row in the matrix.  It is very important that the 3rd argument, if specified, is large enough to be able to separate each element within a line.  The default is that set by command "set width".

if a file name extension is not given, the function assumes an extension of ".txt".

if a path name is not include in the specified file name, the function will search in the current data path, set by command "set path".

Class

Matrix, Matrix_flt, Matrix_int, Matrix_sht, Matrix_uch, Matrix_bln

Usage

{void} object.SAVEASC({String} argm1, [{int} argm2, {int} argm3])

argm1 = output file name

argm2 = no of decimal digits         (default = value set by command "set precision")

argm3 = no of width for each element (default = value set by command "set width")

Example:

->A.saveasc("Mat_1")

->

See also (class function)

sappasc

| HOME | BACK |


SAVEASCXYZ

| HOME | BACK |

Purpose

To save as ASCII format.  Each line in the output file represents one element of the matrix, and it has three fields, namely row number, column number and value. 

The first line is for the 1st row and the first column element. The second line is for the first row and the second column element.  It goes all the way to the last column of the first row, then it starts doing the same thing for the second row and so on.

if a file name extension is not given, the function assumes an extension of ".txt".

if a path name is not include in the specified file name, the function will search in the current data path, set by command "set path".

Class

Matrix, Matrix_flt, Matrix_int, Matrix_sht, Matrix_uch, Matrix_bln

Usage

{void} object.SAVEASCXYZ({String} argm1, [{int} argm2, {int} argm3])

argm1 = output file name

argm2 = no of decimal digits         (default = value set by command "set precision")

argm3 = no of width for each element (default = value set by command "set width")

Example:

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

->A.saveascxyz("Mat_1")

(The ASCII output file, "Mat_1.txt", will looks like:

   0.000    0.000    1.000
   0.000    1.000    2.000
   0.000    2.000    3.000
   1.000    0.000    4.000
   1.000    1.000    5.000
   1.000    2.000    6.000
   2.000    0.000    7.000
   2.000    1.000    8.000
   2.000    2.000    9.000)

See also (class function)

saveasc

| HOME | BACK |


SAVEBIN

| HOME | BACK |

Purpose

To save as binary format.  First it stores all elements of the first row of the matrix, from the first to the last column, then go to the second row, and does the same thing.  Hence the size of the data file will be exactly equal to total number of elements of the matrix multiplied by no of bytes per element (8 bytes in this case).

if a file name extension is not given, the function assumes an extension of ".raw".

if a path name is not include in the specified file name, the function will search in the current data path, set by command "set path".

Class

Matrix, Matrix_flt, Matrix_int, Matrix_sht, Matrix_uch, Matrix_bln

Usage

{void} object.SAVEBIN({String} argm1)

argm1 = an existing file name

Example:

->A.savebin("Mat_2")

->

See also (class function)

save, sappbin

| HOME | BACK |


SAVEBMP

| HOME | BACK |

Purpose

To save as bitmap (BMP) format.  The matrix will be first converted to an 8-bit data, and the output file will have an 8-bit gray scale format.  Losing of accuracy of data is unavoidable, if the original value range of data is beyond 8 bit, 0 to 255.

if a file name extension is not given, the function assumes an extension of ".bmp".

if a path name is not include in the specified file name, the function will search in the current data path, set by command "set path".

Class

Matrix, Matrix_flt, Matrix_int, Matrix_sht, Matrix_uch, Matrix_bln

Usage

{void} object.SAVEBMP({String} argm1)

argm1 = output file name

Example:

->A.savebmp("Mat_2")

->

See also (class function)

savetif

| HOME | BACK |


SAVECSV

| HOME | BACK |

Purpose

To save as CSV (Comma-Separated Values) filet.  Each line in the output file represents a row in the matrix. Each element in a row will be separated by a comma sign.

if a file name extension is not given, the function assumes an extension of ".txt".

if a path name is not include in the specified file name, the function will search in the current data path, set by command "set path".

Class

Matrix, Matrix_flt, Matrix_int, Matrix_sht, Matrix_uch, Matrix_bln

Usage

{void} object.SAVECSV({String} argm1)

argm1 = output file name

Example:

->A.savecsv("Mat_1")

->

See also (class function)

sappasc, saveasc, loadcsv

| HOME | BACK |


 SAVETIF

| HOME | BACK |

Purpose

To save as Tag Image File (TIF) format.  The matrix will be first converted to an 8-bit data, and the output file will have an 8-bit gray scale format.  Losing of accuracy of data is unavoidable, if the original value range of data is beyond 8 bit, 0 to 255.

if a file name extension is not given, the function assumes an extension of ".tif".

if a path name is not include in the specified file name, the function will search in the current data path, set by command "set path".

Class

Matrix, Matrix_flt, Matrix_int, Matrix_sht, Matrix_uch, Matrix_bln

Usage

{void} object.SAVETIF({String} argm1)

argm1 = output file name

Example:

->A.savetif("Mat_2")

->

See also (class function)

savebmp

| HOME | BACK |


SAVEWRL

| HOME | BACK |

Purpose

To save as WRL (world file) format, a file format used in Virtual Reality Modeling language (VRML). 

The matrix is thought of a Digital Elevation Model (DEM) and the result file can be viewed over internet by using VRML viewing program, within which the user can freely rotate and walk through the model.

A scale factor can be specified by the user so that every pixel's brightness value will be scaled by the given factor before writing to the output file.  A default scale factor is computed from the size of the matrix and the maximum height, brightness, difference in the matrix.

if a file name extension is not given, the function assumes an extension of ".wrl".

if a path name is not include in the specified file name, the function will search in the current data path, set by command "set path".

Class

Matrix, Matrix_flt, Matrix_int, Matrix_sht, Matrix_uch, Matrix_bln

Usage

{void} object.SAVEWRL({String} argm1, [{double} argm2])

argm1 = output file name

argm2 = height scale factor

        (default = (average of no of row and col) / (max_z - min_z) )

Example:

->A.savewrl("My_world")

->

See also (class function)

savebmp

| HOME | BACK |


SD

| HOME | BACK |

Purpose

To determine the value of the standard deviation of all elements in a matrix.

Class

Matrix, Matrix_flt, Matrix_int, Matrix_sht, Matrix_uch, Matrix_bln

Usage

{double} ret  =  object.SD()

Example:

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

->B = A.sd()

->print B

        2.73861

See also (class function)

max, min, mean

| HOME | BACK |


SET

| HOME | BACK |

Purpose

To set new value to elements of matrix at particular indices, specified by a list of indices, stored in a VecIndx object. 

Class

Matrix, Matrix_flt, Matrix_int, Matrix_sht, Matrix_uch, Matrix_bln

Usage

For class Matrix

{void} object.SET({VecIndx} argm1, {double} argm2)

For class Matrix_flt

{void} object.SET({VecIndx} argm1, {float} argm2)

For class Matrix_int

{void} object.SET({VecIndx} argm1, {int} argm2)

For class Matrix_sht

{void} object.SET({VecIndx} argm1, {short} argm2)

For class Matrix_uch

{void} object.SET({VecIndx} argm1, {uchar} argm2)

For class Matrix_bln

{void} object.SET({VecIndx} argm1, {bool} argm2)

argm1 = a vector stored indices at which a new value being assigned

argm2 = a new value which will be assigned to elements at indices specified by argm1

Example:

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

->v = find(A>5)

->A.set(v,999)

->print A

 no of row    : 3
 no of column : 3

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

See also (class function)

find (global function)

| HOME | BACK |


SETBDIAG

| HOME | BACK |

Purpose

To set value to diagonal block elements of a block matrix.  The calling matrix must have an appropriate size, for example its no of row must be an integer times of that of the argument matrix.

Class

Matrix, Matrix_flt, Matrix_int, Matrix_sht, Matrix_uch, Matrix_bln

Usage

For class Matrix

{void} object.SETBDIAG({Matrix} argm1)

For class Matrix_flt

{void} object.SETBDIAG({Matrix_flt} argm1)

For class Matrix_int

{void} object.SETBDIAG({Matrix_int} argm1)

For class Matrix_sht

{void} object.SETBDIAG({Matrix_sht} argm1)

For class Matrix_uch

{void} object.SETBDIAG({Matrix_uch} argm1)

For class Matrix_bln

{void} object.SETBDIAG({Matrix_bln} argm1)

argm1 = A matrix being set along the diagonal of the calling matrix

Example:

->A = [ 1 2; 3 4]
->B = Matrix(6,6)
->B.setbdiag(a)
->print B


 no of row    : 6
 no of column : 6

 0:    1.00000   2.00000   0.00000   0.00000   0.00000   0.00000
 1:    3.00000   4.00000   0.00000   0.00000   0.00000   0.00000
 2:    0.00000   0.00000   1.00000   2.00000   0.00000   0.00000
 3:    0.00000   0.00000   3.00000   4.00000   0.00000   0.00000
 4:    0.00000   0.00000   0.00000   0.00000   1.00000   2.00000
 5:    0.00000   0.00000   0.00000   0.00000   3.00000   4.00000

See also (class function)

initbdiag

| HOME | BACK |


SETCOL

| HOME | BACK |

Purpose

To set a new value for an entire specified column.

Class

Matrix, Matrix_flt, Matrix_int, Matrix_sht, Matrix_uch, Matrix_bln

Usage

For class Matrix

{void} object.SETCOL({int} argm1, {double} argm2)

For class Matrix_flt

{void} object.SETCOL({int} argm1, {float} argm2)

For class Matrix_int

{void} object.SETCOL({int} argm1, {int} argm2)

For class Matrix_sht

{void} object.SETCOL({int} argm1, {short} argm2)

For class Matrix_uch

{void} object.SETCOL({int} argm1, {uchar} argm2)

For class Matrix_bln

{void} object.SETCOL({int} argm1, {bool} argm2)

argm1 = column number at which a new value is assigned to its elements

argm2 = new value that set to all elements in the column specified by argm1

Example:

->A = [ 1 2 3; 4 5 6; 7 8 9 ]
->A.setcol(1, 999)
->print A


 no of row    : 3
 no of column : 3

 0:    1.00000    999.00000    3.00000
 1:    4.00000    999.00000    6.00000
 2:    7.00000    999.00000    9.00000

See also (class function)

setrow

| HOME | BACK |


SETDIAG

| HOME | BACK |

Purpose

To set value to diagonal elements of a square matrix.

Class

Matrix, Matrix_flt, Matrix_int, Matrix_sht, Matrix_uch, Matrix_bln

Usage

For class Matrix

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

For class Matrix_flt

{void} object.SETDIAG({float} argm1)

For class Matrix_int

{void} object.SETDIAG({int} argm1)

For class Matrix_sht

{void} object.SETDIAG({short} argm1)

For class Matrix_uch

{void} object.SETDIAG({uchar} argm1)

For class Matrix_bln

{void} object.SETDIAG({bool} argm1)

argm1 = value to be set to diagonal elements

Example:

->A = Matrix(3,3)
->A.setdiag(99)
->print A

 no of row    : 3
 no of column : 3

 0:    99.00000    0.00000    0.00000
 1:     0.00000   99.00000    0.00000
 2:     0.00000    0.00000   99.00000

See also (class function)

initdiag

| HOME | BACK |


SETROW

| HOME | BACK |

Purpose

To set a new value for an entire specified row.

Class

Matrix, Matrix_flt, Matrix_int, Matrix_sht, Matrix_uch, Matrix_bln

Usage

For class Matrix

{void} object.SETROW({int} argm1, {double} argm2)

For class Matrix_flt

{void} object.SETROW({int} argm1, {float} argm2)

For class Matrix_int

{void} object.SETROW({int} argm1, {int} argm2)

For class Matrix_sht

{void} object.SETROW({int} argm1, {short} argm2)

For class Matrix_uch

{void} object.SETROW({int} argm1, {uchar} argm2)

For class Matrix_bln

{void} object.SETROW({int} argm1, {bool} argm2)

argm1 = row number at which a new value is assigned to its elements

argm2 = new value that set to all elements in the row specified by argm1

Example:

->A = [ 1 2 3; 4 5 6; 7 8 9 ]
->A.setrow(1, 999)
->print A


 no of row    : 3
 no of column : 3

 0:    1.00000      2.00000    3.00000
 1:  999.00000    999.00000  999.00000
 2:    7.00000      8.00000    9.00000

See also (class function)

setcol

| HOME | BACK |


SETSYMB

| HOME | BACK |

Purpose

To set a symbol at a particular index in a matrix.  A symbol is realized by using a matrix, which is one of arguments given by the user.

Class

Matrix, Matrix_flt, Matrix_int, Matrix_sht, Matrix_uch, Matrix_bln

Usage

For class Matrix

{void} object.SETSYMB({int} argm1, {int} argm2, {Matrix} argm3)

For class Matrix_flt

{void} object.SETSYMB({int} argm1, {int} argm2, {Matrix_flt} argm3)

For class Matrix_int

{void} object.SETSYMB({int} argm1, {int} argm2, {Matrix_int} argm3)

For class Matrix_sht

{void} object.SETSYMB({int} argm1, {int} argm2, {Matrix_sht} argm3)

For class Matrix_uch

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

For class Matrix_bln

{void} object.SETSYMB({int} argm1, {int} argm2, {Matrix_bln} argm3)

argm1 = row number at which the center of the symbol is placed

argm2 = column number at which the center of the symbol is placed

argm3 = matrix being used as a symbol to place on the calling matrix

Example:

->A = [ 0 1 0; 1 1 1; 0 1 0 ]
->B.setsybm(100,200,A)
->

See also (class function)

setwindow

| HOME | BACK |


SETVECSYMB

| HOME | BACK |

Purpose

To set a symbol at particular indices, specified by a VecIndx object.  A symbol is realized by using a matrix, which is one of arguments given by the user.

Class

Matrix_uch

Usage

{void} object.SETVECSYMB({VecIndx} argm1, {Matrix_uch} argm2)

argm1 = a vector contains row and column numbers of centers of the symbol

argm2 = matrix being used as a symbol to place on the calling matrix

Example:

->A = [ 0 1 0; 1 1 1; 0 1 0 ]
->B.setvecsybm(vec_location,A)
->

See also (class function)

setsymb

| HOME | BACK |


SETWINDOW

| HOME | BACK |

Purpose

To set a sub-matrix at a particular index in a matrix.  This function is very similar to function "setsymb", except that the position at which the sub-matrix is placed is the upper left corner of the sub-matrix.

Class

Matrix, Matrix_flt, Matrix_int, Matrix_sht, Matrix_uch, Matrix_bln

Usage

For class Matrix

{void} object.SETWINDOW({int} argm1, {int} argm2, {Matrix} argm3)

For class Matrix_flt

{void} object.SETWINDOW({int} argm1, {int} argm2, {Matrix_flt} argm3)

For class Matrix_int

{void} object.SETWINDOW({int} argm1, {int} argm2, {Matrix_int} argm3)

For class Matrix_sht

{void} object.SETWINDOW({int} argm1, {int} argm2, {Matrix_sht} argm3)

For class Matrix_uch

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

For class Matrix_bln

{void} object.SETWINDOW({int} argm1, {int} argm2, {Matrix_bln} argm3)

argm1 = row number at which the upper left corner of the sub-matrix is placed

argm2 = row number at which the upper left corner of the sub-matrix is placed

argm3 = sub-matrix being placed on the calling matrix

Example:

->A = [ 1 2; 3 4]
->B = Matrix(5,5)
->B.setwindow(1,1,A)
->print B


 no of row    : 5
 no of column : 5

 0:    0.00000   0.00000   0.00000   0.00000   0.00000
 1:    0.00000   1.00000   2.00000   0.00000   0.00000
 2:    0.00000   3.00000   4.00000   0.00000   0.00000
 3:    0.00000   0.00000   0.00000   0.00000   0.00000
 4:    0.00000   0.00000   0.00000   0.00000   0.00000

See also (class function)

setsymb

| HOME | BACK |


SHORT

| HOME | BACK |

Purpose

To convert to a Matrix_sht object.

Class

Matrix, Matrix_flt, Matrix_int, Matrix_sht, Matrix_uch, Matrix_bln

Usage

{Matrix_sht} ret  =  object.SHORT()

Example:

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


no of row    : 3
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


->B = A.short()
->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)

double, float, int, uchar, bool

| HOME | BACK |


SIN

| HOME | BACK |

Purpose

To calculate a sine 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.SIN()

Example:

->set angle "deg"
->A = [1 2 ; 45 90]
->print A


no of row    : 2
no of column : 2

0:    1.00000    2.00000
1:   45.00000   90.00000


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


no of row    : 2
no of column : 2

0:   0.01745   0.03490
1:   0.70711   1.00000


->

See also (class function)

tan, cos

| HOME | BACK |


SIZE

| HOME | BACK |

Purpose

To report the size of a matrix, no of rows and columns.

Class

Matrix, Matrix_flt, Matrix_int, Matrix_sht, Matrix_uch, Matrix_bln

Usage

{Indx} ret  =  object.SIZE()

Example:

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

->A.size()

ans =     (3 , 3)

See also (class function)

nrow, ncol

| HOME | BACK |


SKIP

| HOME | BACK |

Purpose

To decrease the size of a matrix by skipping a certain number of rows and columns.

Class

Matrix, Matrix_flt, Matrix_int, Matrix_sht, Matrix_uch, Matrix_bln

Usage

For class Matrix

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

For class Matrix_flt

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

For class Matrix_int

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

For class Matrix_sht

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

For class Matrix_uch

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

For class Matrix_bln

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

argm1 = no of rows and columns being skipped

Example:

->a = Matrix(100,100)

->b = a.skip(1)

->print b.size()

(50 , 50)

See also (class function)

window, pyramid

| HOME | BACK |


SORT

| HOME | BACK |

Purpose

To sort a matrix according to a key column, specified by the user.

The sorting is done by treating each row as a single piece of data, and they are to be sorted according to its value in the key column, which is given the function argument.

Class

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

Usage

For class Matrix

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

For class Matrix_flt

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

For class Matrix_int

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

For class Matrix_sht

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

For class Matrix_uch

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

For class Matrix_bln

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

For class Matrix_str

{Matrix_str} ret  =  object.SORT({int} argm1)

 

argm1 = column number of the key column (default = 0)

Example:

->A = Matrix(6,4)
->A.rand()
->print A

 no of row    : 6
 no of column : 4

 0:    0.11051  0.46278  0.59737  0.94519
 1:    0.16990  0.62233  0.59181  0.08341
 2:    0.76754  0.66170  0.36955  0.88510
 3:    0.49104  0.50600  0.59111  0.56047
 4:    0.63396  0.00153  0.03644  0.31327
 5:    0.45482  0.26408  0.18500  0.72512


->B = A.sort(1)
->print B

 no of row    : 6
 no of column : 4

 0:    0.63396  0.00153  0.03644  0.31327
 1:    0.45482  0.26408  0.18500  0.72512
 2:    0.11051  0.46278  0.59737  0.94519
 3:    0.49104  0.50600  0.59111  0.56047
 4:    0.16990  0.62233  0.59181  0.08341
 5:    0.76754  0.66170  0.36955  0.88510

See also (class function)

sortall

| HOME | BACK |


SORTALL

| HOME | BACK |

Purpose

To sort all elements of a matrix.

Class

Matrix, Matrix_flt, Matrix_int, Matrix_sht, Matrix_uch, Matrix_bln

Usage

For class Matrix

{Matrix} ret  =  object.SORTALL()

For class Matrix_flt

{Matrix_flt} ret  =  object.SORTALL()

For class Matrix_int

{Matrix_int} ret  =  object.SORTALL()

For class Matrix_sht

{Matrix_sht} ret  =  object.SORTALL()

For class Matrix_uch

{Matrix_uch} ret  =  object.SORTALL()

For class Matrix_bln

{Matrix_bln} ret  =  object.SORTALL()

Example:

->A = Matrix(6,4)
->A.rand()
->print A

 no of row    : 6
 no of column : 4

 0:    0.11051  0.46278  0.59737  0.94519
 1:    0.16990  0.62233  0.59181  0.08341
 2:    0.76754  0.66170  0.36955  0.88510
 3:    0.49104  0.50600  0.59111  0.56047
 4:    0.63396  0.00153  0.03644  0.31327
 5:    0.45482  0.26408  0.18500  0.72512


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

 no of row    : 6
 no of column : 4

 0:    0.00153  0.03644  0.08341  0.11051
 1:    0.16990  0.18500  0.26408  0.31327
 2:    0.36955  0.45482  0.46278  0.49104
 3:    0.50600  0.56047  0.59111  0.59181
 4:    0.59737  0.62233  0.63396  0.66170
 5:    0.72512  0.76754  0.88510  0.94519

See also (class function)

sort

| HOME | BACK |


STRETCH

| HOME | BACK |

Purpose

To perform a general linear stretching.

Class

Matrix, Matrix_flt, Matrix_int, Matrix_sht, Matrix_uch, Matrix_bln

Usage

For class Matrix

{Matrix} ret  =  object.STRETCH([{double} argm1, {double} argm2])

For class Matrix_flt

{Matrix_flt} ret  =  object.STRETCH([{double} argm1, {double} argm2])

For class Matrix_int

{Matrix_int} ret  =  object.STRETCH([{double} argm1, {double} argm2])

For class Matrix_sht

{Matrix_sht} ret  =  object.STRETCH([{double} argm1, {double} argm2])

For class Matrix_uch

{Matrix_uch} ret  =  object.STRETCH([{double} argm1, {double} argm2])

For class Matrix_bln

{Matrix_bln} ret  =  object.STRETCH([{double} argm1, {double} argm2])

argm1 = start value of the stretching range      (default = 0)

argm2 = end value of the stretching range        (default = 255)

Example:

->A = [ 1 2 3; 4 5 6; 7 8 9]
->B = A.stretch()
->print B


 no of row : 3
 no of column : 3

 0:      0.00000    31.87500    63.75000
 1:     95.62500   127.50000   159.37500
 2:    191.25000   223.12500   255.00000

See also (class function)

stretchfix, stretchsat

| HOME | BACK |


y

STRETCHFIX

| HOME | BACK |

Purpose

To perform a linear stretching with fix interval.  In other words, the stretching will be done within a specific range. 

Values that are less than the specified range will be assigned the new value as the minimum value of the stretching range.  Values that are larger than the specified range will be assigned the new value as the maximum value of the stretching range.

Class

Matrix, Matrix_flt, Matrix_int, Matrix_sht, Matrix_uch, Matrix_bln

Usage

For class Matrix

{Matrix} ret  =  object.STRETCH({double} argm1, {double} argm2, [{double} argm3, {double} argm4])

For class Matrix_flt

{Matrix_flt} ret  =  object.STRETCH({double} argm1, {double} argm2, [{double} argm3, {double} argm4])

For class Matrix_int

{Matrix_int} ret  =  object.STRETCH({double} argm1, {double} argm2, [{double} argm3, {double} argm4])

For class Matrix_sht

{Matrix_sht} ret  =  object.STRETCH({double} argm1, {double} argm2, [{double} argm3, {double} argm4])

For class Matrix_uch

{Matrix_uch} ret  =  object.STRETCH({double} argm1, {double} argm2, [{double} argm3, {double} argm4])

For class Matrix_bln

{Matrix_bln} ret  =  object.STRETCH({double} argm1, {double} argm2, [{double} argm3, {double} argm4])

argm1 = start value of the original range being stretched

argm2 = end value of the original range being stretched

argm3 = start value of the stretching range      (default = 0)

argm4 = end value of the stretching range        (default = 255)

Example:

->A = [ 1 2 3; 4 5 6; 7 8 9]
->B = A.stretchfix(2,7,100,200)
->print B


 no of row    : 3
 no of column : 3

 0:    100.00000    100.00000    120.00000
 1:    140.00000    160.00000    180.00000
 2:    200.00000    200.00000   200.00000

See also (class function)

stretch, stretchsat

| HOME | BACK |


STRETCHSAT

| HOME | BACK |

Purpose

To perform a linear stretching with saturation. 

The user gives an amount of percent, a so-called percent of saturation, say 5 percents.  Then the function calculate 2 fixed values.  One is the value that 5 percents of the data will have values less than it.  The second one is the value that 5 percents of the data will have values larger than it.  These two fixed values will be used to perform a linear stretching with fixed interval. 

Class

Matrix, Matrix_flt, Matrix_int, Matrix_sht, Matrix_uch, Matrix_bln

Usage

For class Matrix

{Matrix} ret  =  object.STRETCHSAT({double} argm1, [{double} argm2, {double} argm3])

For class Matrix_flt

{Matrix_flt} ret  =  object.STRETCHSAT({double} argm1, [{double} argm2, {double} argm3])

For class Matrix_int

{Matrix_int} ret  =  object.STRETCHSAT({double} argm1, [{double} argm2, {double} argm3])

For class Matrix_sht

{Matrix_sht} ret  =  object.STRETCHSAT({double} argm1, [{double} argm2, {double} argm3])

For class Matrix_uch

{Matrix_uch} ret  =  object.STRETCHSAT({double} argm1, [{double} argm2, {double} argm3])

For class Matrix_bln

{Matrix_bln} ret  =  object.STRETCHSAT({double} argm1, [{double} argm2, {double} argm3])

argm1 = percent of saturation

argm2 = start value of the stretching range      (default = 0)

argm3 = end value of the stretching range        (default = 255)

Example:

->A = [ 1 2 3; 4 5 6; 7 8 9 ]
->B = A.stretchsat(30)
->print B


 no of row    : 3
 no of column : 3

 0:      0.00000     0.00000    42.50000
 1:     85.00000   127.50000   170.00000
 2:    212.50000   255.00000   255.00000

See also (class function)

stretch, stretchfix

| HOME | BACK |


STRING

| HOME | BACK |

Purpose

To make a string object from a Matrix_uch object.

Class

Matrix_uch

Usage

{String} ret  =  object.STRING()

Example:

->A = [65 66 67; 68 69 70]

->B = A.string()

->print B

 ABCDEF

See also (class function)

 

| HOME | BACK |


 

SUM

| HOME | BACK |

Purpose

To compute the summation value of all elements in a matrix.

Class

Matrix, Matrix_flt, Matrix_int, Matrix_sht, Matrix_uch, Matrix_bln

Usage

{double} ret  =  object.SUM()

Example:

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

->B = A.sum()

->print B

       45.00000

See also (class function)

max, min, mean

| HOME | BACK |


SWAPCOL

| HOME | BACK |

Purpose

To swap columns in a matrix.

Class

Matrix, Matrix_flt, Matrix_int, Matrix_sht, Matrix_uch, Matrix_bln

Usage

For class Matrix

{Matrix} ret  =  object.SWAPCOL({int} argm1, {int} argm2)

For class Matrix_flt

{Matrix_flt} ret  =  object.SWAPCOL({int} argm1, {int} argm2)

For class Matrix_int

{Matrix_int} ret  =  object.SWAPCOL({int} argm1, {int} argm2)

For class Matrix_sht

{Matrix_sht} ret  =  object.SWAPCOL({int} argm1, {int} argm2)

For class Matrix_uch

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

For class Matrix_bln

{Matrix_bln} ret  =  object.SWAPCOL({int} argm1, {int} argm2)

argm1 = first column number to be swapped

argm2 = second column number to be swapped

Example:

->A = [ 1 2 3; 4 5 6; 7 8 9 ]
->B = A.swapcol(0,1)
->print B


 no of row    : 3
 no of column : 3

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

See also (class function)

swaprow

| HOME | BACK |


SWAPROW

| HOME | BACK |

Purpose

To swap rows in a matrix.

Class

Matrix, Matrix_flt, Matrix_int, Matrix_sht, Matrix_uch, Matrix_bln

Usage

For class Matrix

{Matrix} ret  =  object.SWAPROW({int} argm1, {int} argm2)

For class Matrix_flt

{Matrix_flt} ret  =  object.SWAPROW({int} argm1, {int} argm2)

For class Matrix_int

{Matrix_int} ret  =  object.SWAPROW({int} argm1, {int} argm2)

For class Matrix_sht

{Matrix_sht} ret  =  object.SWAPROW({int} argm1, {int} argm2)

For class Matrix_uch

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

For class Matrix_bln

{Matrix_bln} ret  =  object.SWAPROW({int} argm1, {int} argm2)

argm1 = first row number to be swapped

argm2 = second row number to be swapped

Example:

->A = [ 1 2 3; 4 5 6; 7 8 9 ]
->B = A.swaprow(0,1)
->print B


 no of row    : 3
 no of column : 3

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

See also (class function)

swapcol

| HOME | BACK |


TAN

| HOME | BACK |

Purpose

To calculate a tangent 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.TAN()

Example:

->set angle "deg"
->A = [1 2 ; 45 55]
->B = A.tan()
->print B


no of row    : 2
no of column : 2

0:   0.01746    0.03492
1:   1.00000    1.42815


->

See also (class function)

sin, cos

| HOME | BACK |


TSP

| HOME | BACK |

Purpose

To determine a transpose matrix.

Class

Matrix, Matrix_flt, Matrix_int, Matrix_sht, Matrix_uch, Matrix_bln

Usage

{Matrix} ret  =  object.TSP()

Example:

->A = [ 1 2 3; 4 5 6; 7 8 9 ]
->B = A.tsp(0,1)
->print B


 no of row    : 3
 no of column : 3

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

See also (class function)

inv

| HOME | BACK |


UCHAR

| HOME | BACK |

Purpose

To convert to a Matrix_uch object.

Class

Matrix, Matrix_flt, Matrix_int, Matrix_sht, Matrix_uch, Matrix_bln

Usage

{Matrix_uch} ret  =  object.UCHAR()

Example:

->A = [1 2 ; 45 90]
->print A


no of row    : 2
no of column : 2

0:    1.00000    2.00000
1:   45.00000   90.00000


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


no of row    : 2
no of column : 2

0:     1     2
1:    45    90


->

See also (class function)

double, float, int, short, bool

| HOME | BACK |


UNIT

| HOME | BACK |

Purpose

To create a unit, identity, matrix.

Class

Matrix, Matrix_flt, Matrix_int, Matrix_sht, Matrix_uch, Matrix_bln

Usage

{void} object.UNIT({int} argm1)

argm1 = size of the unit matrix

Example:

->A = Matrix()
->A.unit(3)
->print A


 no of row    : 3
 no of column : 3

 0:    1.00000    0.00000    0.00000
 1:    0.00000    1.00000    0.00000
 2:    0.00000    0.00000    1.00000

See also (class function)

init, Rxyz

| HOME | BACK |


UPDATE

| HOME | BACK |

Purpose

To update tyhe content of a column of a Matrix.  This function is for Matrix_str only.

Class

Matri_str

Usage

{void} object.UPDATE({int} argm1, {int} argm2, {Matrix_str} argm3, {int} argm4, {int} argm5)

argm1 = the column number of the calling Matrix to be updated

argm2 = the column number of the calling Matrix to be used as key data

argm3 = the lookup table matrix

argm4 = the column number of the lookup table matrix containing updating data

argm5 = the column number of the lookup table matrix containing key data

 

Example:

->Table1 = Matrix_str()
->Table1.loadcsv("t1.txt")
->Table1

ans =

no of row : 5
no of column : 4
0:A 1 7 0
1:B 2 90 0
2:C 1 82 0
3:D 3 50 0
4:E 2 41 0


->Table2 = Matrix_str()
->Table2.loadcsv("t2.txt")
->Table2

ans =

no of row : 3
no of column : 2
0:1 4000
1:2 5000
2:3 6000


->Table1.update(3,1,Table2,1,0)

Now doing updating...

Percent done : 0
: 20
: 40
: 70
: 100
->
->Table1

ans =

no of row : 5
no of column : 4
0:A 1 7 4000
1:B 2 90 5000
2:C 1 82 4000
3:D 3 50 6000
4:E 2 41 5000


->

See also (class function)

mupdate

| HOME | BACK |