Matrix Class Function Manual (G-I)

GETASC

| HOME | BACK |

Purpose

To get an ASCII terxt from a Matrix_uch object at the requeste psition in the matrix.  The result is stored in a String object.

Class

Matrix_uch

Usage

For class Matrix_uch

{String} ret  =  object.GETBIN2({int} argm1, {int} argm2, {int} argm3)

argm1 = request position row number

argm2 = request position column number

argm3 = number of values wanted (default = 1)

Example:

->a = [65 66 67 68 69 70].uchar()
->a.getasc(0,0)

ans = A

->a.getasc(0,1,3)

ans = BCD

->

See also (class function)

getbin2, getbin4, getbin4f, getbin8

| HOME | BACK |


GETBIN2

| HOME | BACK |

Purpose

To get a binary 2-byte short integer value from a Matrix_uch object at the requeste psition in the matrix.  The result is stored in a vector object.

Class

Matrix_uch

Usage

For class Matrix_uch

{VecInt} ret  =  object.GETBIN2({int} argm1, {int} argm2, {int} argm3)

argm1 = request position row number

argm2 = request position column number

argm3 = number of values wanted (default = 1)

Example:

->a = [1 2 3 4 5 6 7 8]
->a = a.short()
->a.save("temp")
->b = Matrix_uch()
->b.loadbin1("temp.raw")
->c = b.getbin2(0, 2, 2)
->print c

Vector size : 2

2

3

 

See also (class function)

getbin2, getbin4, getbin4f, getbin8

| HOME | BACK |


GETBIN4

| HOME | BACK |

Purpose

To get a binary 4-byte long integer value from a Matrix_uch object at the requeste psition in the matrix.  The result is stored in a vector object.

Class

Matrix_uch

Usage

For class Matrix_uch

{VecInt} ret  =  object.GETBIN4({int} argm1, {int} argm2, {int} argm3)

argm1 = request position row number

argm2 = request position column number

argm3 = number of values wanted (default = 1)

Example:

->a = [1 2 3 4 5 6 7 8]
->a = a.int()
->a.save("temp")
->b = Matrix_uch()
->b.loadbin1("temp.raw")
->c = b.getbin4(0, 4, 2)
->print c

Vector size : 2

2

3

 

See also (class function)

getbin2, getbin4, getbin4f, getbin8

| HOME | BACK |


GETBIN4F

| HOME | BACK |

Purpose

To get a binary 4-byte floating point value from a Matrix_uch object at the requeste psition in the matrix.  The result is stored in a vector object.

Class

Matrix_uch

Usage

For class Matrix_uch

{Vector} ret  =  object.GETBIN4F({int} argm1, {int} argm2, {int} argm3)

argm1 = request position row number

argm2 = request position column number

argm3 = number of values wanted (default = 1)

Example:

->a = [1 2 3 4 5 6 7 8]
->a = a.float()
->a.save("temp")
->b = Matrix_uch()
->b.loadbin1("temp.raw")
->c = b.getbin4f(0, 4, 2)
->print c

Vector size : 2

2.000

3.000

 

See also (class function)

getbin2, getbin4, getbin4f, getbin8

| HOME | BACK |


GETBIN8

| HOME | BACK |

Purpose

To get a binary 8-byte double precision floating point value from a Matrix_uch object at the requeste psition in the matrix.  The result is stored in a vector object.

Class

Matrix_uch

Usage

For class Matrix_uch

{Vector} ret  =  object.GETBIN8({int} argm1, {int} argm2, {int} argm3)

argm1 = request position row number

argm2 = request position column number

argm3 = number of values wanted (default = 1)

Example:

->a = [1 2 3 4 5 6 7 8]
->a.save("temp")
->b = Matrix_uch()
->b.loadbin1("temp.raw")
->c = b.getbin8(0, 8, 2)
->print c

Vector size : 2

2.000

3.000

 

See also (class function)

getbin2, getbin4, getbin4f, getbin8

| HOME | BACK |


GETCOL

| HOME | BACK |

Purpose

To get column vector(s) from a matrix.

Class

Matrix, Matrix_flt, Matrix_int, Matrix_sht, Matrix_uch, Matrix_bln

Usage

For class Matrix

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

For class Matrix_flt

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

For class Matrix_int

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

For class Matrix_sht

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

For class Matrix_uch

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

For class Matrix_bln

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

argm1 = start column number

argm2 = end column number (default = same value as argm1)

Example:

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

->c = a.getcol(0)

->print c

ans =

 no of row    : 3
 no of column : 1

 0:    1.00000
 1:    4.00000
 2:    7.00000

See also (class function)

getrow, window

| HOME | BACK |


GETROW

| HOME | BACK |

Purpose

To get row vector(s) from a matrix.

Class

Matrix, Matrix_flt, Matrix_int, Matrix_sht, Matrix_uch, Matrix_bln

Usage

For class Matrix

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

For class Matrix_flt

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

For class Matrix_int

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

For class Matrix_sht

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

For class Matrix_uch

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

For class Matrix_bln

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

argm1 = start row number

argm2 = end row number (default = same value as argm1)

Example:

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

->c = a.getrow(0)

->print c

ans =

 no of row    : 1
 no of column : 3

 0:    1.00000     2.00000     3.00000

See also (class function)

getcol, window

| HOME | BACK |


GOGET

| HOME | BACK |

Purpose

To get a value of an element at a particular index in a Matrix.  The matrix must be virtually loaded, by using a function "vload". 

Function "vload" does not really load data into memory, therefore, this function simply go to the required position and read data directly from the file.

Class

Matrix, Matrix_flt, Matrix_int, Matrix_sht, Matrix_uch, Matrix_bln

Usage

For class Matrix

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

For class Matrix_flt

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

For class Matrix_int

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

For class Matrix_sht

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

For class Matrix_uch

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

For class Matrix_bln

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

argm1 = row number

argm2 = column number

Example:

->a = A.goget(20,360)

->

See also (class function)

goset, gosetmat

| HOME | BACK |


GOSET

| HOME | BACK |

Purpose

To set a value of an element at a particular index in a Matrix.  The matrix must be virtually loaded, by using a function "vload". 

Function "vload" does not really load data into memory, therefore, this function simply go to the required position and write data directly to the file.

Class

Matrix, Matrix_flt, Matrix_int, Matrix_sht, Matrix_uch, Matrix_bln

Usage

For class Matrix

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

For class Matrix_flt

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

For class Matrix_int

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

For class Matrix_sht

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

For class Matrix_uch

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

For class Matrix_bln

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

argm1 = row number

argm2 = column number

argm3 = a new value set at the particular index

Example:

->A.goset(20,360, 999.999)

->

See also (class function)

goget, gosetmat

| HOME | BACK |


GOSETMAT

| HOME | BACK |

Purpose

To set new values of elements in a particular portion in a Matrix.  An index at which the upper left corner of the sub-matrix to be placed is specified by the user.  The calling matrix must be virtually loaded, by using a function "vload". 

Function "vload" does not really load data into memory, therefore, this function simply go to the required positions and write data directly to the file.

Class

Matrix, Matrix_flt, Matrix_int, Matrix_sht, Matrix_uch, Matrix_bln

Usage

For class Matrix

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

For class Matrix_flt

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

For class Matrix_int

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

For class Matrix_sht

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

For class Matrix_uch

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

For class Matrix_bln

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

argm1 = row number of a point at which the upper left window is located

argm2 = column number of a point at which the upper left window is located

argm3 = a matrix whose values is to be copied onto the calling matrix

Example:

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

->a.save("mat_1")

->a.vload("mat_1")

Matrix virtually loaded...

->b = [10 20; 30 40]

->print b

 no of row    : 2
 no of column : 2

 0:   10.00000   20.00000
 1:   30.00000   40.00000
 

->a.gosetmat(1,1,b)

->a.load("mat_1")

->print a


 no of row    : 3
 no of column : 3

 0:    1.00000    2.00000    3.00000
 1:    4.00000   10.00000   20.00000
 2:    7.00000   30.00000   40.00000

See also (class function)

goget, goset

| HOME | BACK |


HISTMATCH

| HOME | BACK |

Purpose

To perform a histogram matching. 

The function requires one argument, a matrix to which the histogram of the original matrix, the calling matrix, to be matched.  The result is a lookup table, stored as a VecIndx object, in which the first number is the value of the original matrix and the second number is the new value that will match the value of the second matrix, in order to make the histogram of the original matrix look like that of the second matrix.

The result VecIndx object can be used directly in the function "lookup", where a new matrix will be created according to the lookup table using original matrix values.

Class

Matrix_int, Matrix_sht, Matrix_uch

Usage

{VecIndx} ret  =  object.HISTMATCH({Matrix_uch} argm1)

argm1 = matrix whose histogram being matched by the calling matrix

Example:

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

 no of row    : 3
 no of column : 3

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

->b = a * uchar(10)
->print b

 no of row : 3
 no of column : 3

 0:    10   20   30
 1:    40   50   60
 2:    70   80   90


->v = a.histmatch(b)
->print v

Vector of Index (row, column)...

list id : 0

Vector size : 9

(1 , 10)
(2 , 20)
(3 , 30)
(4 , 40)
(5 , 50)
(6 , 60)
(7 , 70)
(8 , 80)
(9 , 90)

See also (class function)

reclass, reassign, lookup

| HOME | BACK |


HISTO

| HOME | BACK |

Purpose

To create a histogram of a matrix. 

The result is a three-column matrix, in which the first column are starting values of the binsand the second column are end values of the bin.  The third column are cumulative frequencies of each bin.  The result can be later exported to an ASCII file so that a histogram plot can be generated by a general graphic-displayable program.

Class

Matrix, Matrix_flt, Matrix_int, Matrix_sht, Matrix_uch, Matrix_bln

Usage

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

argm1 = start value of bins (default = minimum value)

argm2 = end value of bins   (default = maximum value)

argm3 = bin size            (default = a size that generates 10 bins)

Example:

->a = [ 1 2 4; 2 3 5; 7 7 9]
->b = a.histo(1,9,3)
->print b


no of row    : 3
no of column : 3

0:    1.00000    4.00000    4.00000
1:    4.00000    7.00000    2.00000
2:    7.00000   10.00000    3.00000


->

remark : The interpretation of the above example is as follows.  The first row ( 1 4  4)  means there are 4 elements that are greater or equal to 1 and less than 4.  The second row ( 4 7 2)  means there are 2 elements that are greater or equal to 4 and less than 7.  The third row ( 7 10 3)  means there are 3 elements that are greater or equal to 7 and less than 10. 

See also (class function)

reclass, reassign

| HOME | BACK |


IFT

| HOME | BACK |

Purpose

To calculate a two-dimensional Inverse Fourier transform of a matrix.  The number of rows and number of columns of the matrix must be of 2n.  If not, the function will pad zero rows or zero columns, so that its size is of 2n.

Class

Matrix, Matrix_flt, Matrix_int, Matrix_sht, Matrix_uch, Matrix_bln

Usage

{Matrix_cmp} ret  =  object.IFT()

Example:

->a = [ 1 2 ; 3 4]
 

->b = a.fft()

->print b

 no of row    : 2
 no of column : 2

 0:    10.00 + 0.00i    -2.00 + 0.00i
 1:    -4.00 + 0.00i     0.00 + 0.00i
 

->c = b.ift()

->print c

 no of row    : 2
 no of column : 2

 0:     1.00 + 0.00i     2.00 + 0.00i
 1:     3.00 + 0.00i     4.00 + 0.00i

See also (class function)

fft

| HOME | BACK |


INIT

| HOME | BACK |

Purpose

To initialize a Matrix object, to have a specified size and an initial value.

Class

Matrix, Matrix_flt, Matrix_int, Matrix_sht, Matrix_uch, Matrix_bln

Usage

For class Matrix

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

For class Matrix_flt

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

For class Matrix_int

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

For class Matrix_sht

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

For class Matrix_uch

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

For class Matrix_bln

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

argm1 = no of rows

argm2 = no of columns

argm3 = initial value   (default = 0)

Example:

->A.init(3,2)

->print A

 no of row    : 3
 no of column : 2

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

See also (class function)

clear, set

| HOME | BACK |


INITBDIAG

| HOME | BACK |

Purpose

To initialize a block diagonal Matrix.

Class

Matrix, Matrix_flt, Matrix_int, Matrix_sht, Matrix_uch, Matrix_bln

Usage

For class Matrix

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

For class Matrix_flt

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

For class Matrix_int

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

For class Matrix_sht

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

For class Matrix_uch

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

For class Matrix_bln

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

argm1 = no of blocks

argm2 = initial value of the block diagonal elements

Example:

->A = [ 1 2 ; 3 4]

->B = Matrix()

->B.initbdiag(2,A)

->print B

 no of row    : 4
 no of column : 4

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

See also (class function)

initdiag, init

| HOME | BACK |


INITDIAG

| HOME | BACK |

Purpose

To initialize a diagonal Matrix.

Class

Matrix, Matrix_flt, Matrix_int, Matrix_sht, Matrix_uch, Matrix_bln

Usage

For class Matrix

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

For class Matrix_flt

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

For class Matrix_int

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

For class Matrix_sht

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

For class Matrix_uch

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

For class Matrix_bln

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

argm1 = no of diagonal elements

argm2 = initial value of diagonal elements

Example:

->B = Matrix()

->B.initdiag(4,8)

->print B

 no of row    : 4
 no of column : 4

 0:      8.00000    0.00000    0.00000    0.00000
 1:      0.00000    8.00000    0.00000    0.00000
 2:      0.00000    0.00000    8.00000    0.00000
 3:      0.00000    0.00000    0.00000    8.00000

See also (class function)

initbdiag, init

| HOME | BACK |


INT

| HOME | BACK |

Purpose

To convert to a Matrix_int object.

Class

Matrix, Matrix_flt, Matrix_int, Matrix_sht, Matrix_uch, Matrix_bln

Usage

{Matrix_int} ret  =  object.INT()

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.int()
->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, short, uchar, bool

| HOME | BACK |


INV

| HOME | BACK |

Purpose

To compute an inverse matrix.

Class

Matrix, Matrix_flt, Matrix_int, Matrix_sht, Matrix_uch, Matrix_bln

Usage

{Matrix} ret  =  object.INV()

Example:

->A = [ 1 2 ; 3 4]

->B = A.inv()

->print B

 no of row    : 2
 no of column : 3

 0:     -2.00000    1.00000
 1:      1.50000   -0.50000

See also (class function)

invbdiag, invdiag, tsp

| HOME | BACK |


INVBDIAG

| HOME | BACK |

Purpose

To calculate an inverse matrix of a block diagonal matrix.  The computed time of this function is mush faster than an ordinary function "inv".

Class

Matrix, Matrix_flt, Matrix_int, Matrix_sht, Matrix_uch, Matrix_bln

Usage

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

argm1 = size of the block diagonal matrix

Example:

->A = [ 1 2; 3 4]
->B = Matrix()
->B.initbdiag(3,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

->C = B.invbdiag(2)
->print C


no of row    : 6
no of column : 6

0:  -2.00000   1.00000   0.00000   0.00000   0.00000   0.00000
1:   1.50000  -0.50000   0.00000   0.00000   0.00000   0.00000
2:   0.00000   0.00000  -2.00000   1.00000   0.00000   0.00000
3:   0.00000   0.00000   1.50000  -0.50000   0.00000   0.00000
4:   0.00000   0.00000   0.00000   0.00000  -2.00000   1.00000
5:   0.00000   0.00000   0.00000   0.00000   1.50000  -0.50000

->

See also (class function)

inv, invdiag, tsp

| HOME | BACK |


INVDIAG

| HOME | BACK |

Purpose

To calculate an inverse matrix of a diagonal matrix.  The computed time of this function is mush faster than an ordinary function "inv".

Class

Matrix, Matrix_flt, Matrix_int, Matrix_sht, Matrix_uch, Matrix_bln

Usage

{Matrix} ret  =  object.INVDIAG()

Example:

->A = [5 0 0; 0 4 0; 0 0 9]
->print A


no of row    : 3
no of column : 3

0:   5.00000   0.00000   0.00000
1:   0.00000   4.00000   0.00000
2:   0.00000   0.00000   9.00000


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


no of row    : 3
no of column : 3

0:   0.20000   0.00000   0.00000
1:   0.00000   0.25000   0.00000
2:   0.00000   0.00000   0.11111


->

See also (class function)

inv, invbdiag, tsp

| HOME | BACK |