Matrix_cmp Class Function Manual

(  )

| HOME | BACK |

Purpose

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

Class

Matrix_cmp

Usage

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

argm1 = row number

argm2 = column number

 

See an example in function "(   )" of class Matrix

 

| HOME | BACK |


ABS

| HOME | BACK |

Purpose

To calculate an absolute value of a Matrix.

Class

Matrix_cmp

Usage

{Matrix_cmp} ret  =  object.ABS()

 

See an example in function "ABS" of class Matrix

 

| HOME | BACK |


AMP

| HOME | BACK |

Purpose

To calculate amplitude of elements of a Matrix.

Class

Matrix_cmp

Usage

{Matrix} ret  =  object.AMP()

Example:

->a = matrix_cmp(3,1,Complex(1,2))
->b = a.amp()
->print b


 no of row : 3
 no of column : 1

 0:    2.23607
 1:    2.23607
 2:    2.23607

See also (class function)

real, img

| HOME | BACK |


COMPMAX

| HOME | BACK |

Purpose

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

Class

Matrix_cmp

Usage

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

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

 

See an example in function "COMPMAX" of class Matrix

 

| HOME | BACK |


COMPMIN

| HOME | BACK |

Purpose

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

Class

Matrix_cmp

Usage

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

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

 

See an example in function "COMPMIN" of class Matrix

 

| 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_cmp

Usage

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

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

 

See an example in function "CONCAT" of class Matrix

 

| 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_cmp

Usage

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

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

 

See an example in function "CONCATDOWN" of class Matrix

 

| HOME | BACK |


FFT

| HOME | BACK |

Purpose

To calculate a two-dimensional 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_cmp

Usage

{Matrix_cmp} ret  =  object.FFT()

Example:

->a = [1 2 ; 3 4 ]
->a = a.complex()
->print a

 no of row : 2
 no of column : 2

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


->b = a.fft()
->print b

 no of row : 2
 no of column : 2

 0:    10.00000 + 0.00000i   -2.00000 + 0.00000i
 1:    -4.00000 + 0.00000i    0.00000 + 0.00000i
 

See also (class function)

ift

| HOME | BACK |


FLAG_NULL

| HOME | BACK |

Purpose

To report the current value of  flag_null.  Flag_null is a member data of a Matrix, which indicates whether the null data in the matrix are taken into account in computation such as mean, min, max etc.  When a matrix is initiated, its flag_null value is zero (off).

Class

Matrix_cmp

Usage

{bool} ret  =  object.FLAG_NULL()

 

See an example in function "FLAG_NULL" of class Matrix

 

| HOME | BACK |


FLIPLR

| HOME | BACK |

Purpose

To flip a matrix in the left right, horizontal, direction.

Class

Matrix_cmp

Usage

{Matrix_cmp} ret  =  object.FLIPLR()

 

See an example in function "FLIPLR" of class Matrix

 

| HOME | BACK |


FLIPUD

| HOME | BACK |

Purpose

To flip a matrix in the upside down position.

Class

Matrix_cmp

Usage

{Matrix_cmp} ret  =  object.FLIPUDR()

 

See an example in function "FLIPUD" of class Matrix

 

| HOME | BACK |


GETCOL

| HOME | BACK |

Purpose

To get column vector(s) from a matrix.

Class

Matrix_cmp

Usage

{Matrix_cmp} ret  =  object.GETCOL({int} argm1, [{int} argm2])

argm1 = start column number

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

 

See an example in function "GETCOL" of class Matrix

 

| HOME | BACK |


GETROW

| HOME | BACK |

Purpose

To get row vector(s) from a matrix.

Class

Matrix_cmp

Usage

{Matrix_cmp} ret  =  object.GETROW({int} argm1, [{int} argm2])

argm1 = start row number

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

 

See an example in function "GETROW" of class Matrix

 

| 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_cmp

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 |


IMG

| HOME | BACK |

Purpose

To extract imaginary parts of a Matrix_cmp.

Class

Matrix_cmp

Usage

{Matrix} ret  =  object.IMG()

Example:

->A = Matrix_cmp(2,2, Complex(2,3))
->print A

 no of row    : 2
 no of column : 2

 0:    2.00000 + 3.00000i    2.00000 + 3.00000i
 1:    2.00000 + 3.00000i    2.00000 + 3.00000i


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

 no of row    : 2
 no of column : 2

 0:    3.00000    3.00000
 1:    3.00000    3.00000

See also (class function)

real

| HOME | BACK |


INIT

| HOME | BACK |

Purpose

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

Class

Matrix_cmp

Usage

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

argm1 = no of rows

argm2 = no of columns

argm3 = initialized value   (default = 0)

 

See an example in function "INIT" of class Matrix

 

| HOME | BACK |


INITBDIAG

| HOME | BACK |

Purpose

To initialize a block diagonal Matrix.

Class

Matrix_cmp

Usage

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

argm1 = no of blocks

argm2 = initial value of the block diagonal elements

 

See an example in function "INITBDIAG" of class Matrix

 

| HOME | BACK |


INITDIAG

| HOME | BACK |

Purpose

To initialize a diagonal Matrix.

Class

Matrix_cmp

Usage

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

argm1 = no of diagonal elements

argm2 = initial value of the diagonal elements

 

See an example in function "INITDIAG" of class Matrix

 

| HOME | BACK |


LOAD

| HOME | BACK |

Purpose

To load a matrix object saved as Noobeed format.  There are 2 files needed.  One is for the documentation, and it is an ASCII file.  The other is a binary file containing data of the matrix. 

If file name extension is omitted, the function will add default extension to the file.   The default extension of the documentation file is ".txt" and that of the data file is ".raw".

Unless the path name is given in the file names, the function will search for the files in the current working directory, defined by command "set path".

The detail structure of the documentation file is described in function "save".

Class

Matrix_cmp

Usage

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

argm1 = file name for the documentation file (default extension is ".txt")

argm2 = file name for the data file  

        (default file name is same file name as argm1 with an extension ".raw")

 

See an example in function "LOAD" of class Matrix

 

| HOME | BACK |


LOADASC

| HOME | BACK |

Purpose

To read data from an ASCII file and stored in a matrix object.

If file name extension is omitted, the function will add default extensions to the files.  The default extension of an ASCII data file is ".txt".

Unless the path name is given in the file names, the function will search for the files in the current working directory, defined by command "set path".

An example of an ASCII data file is as follows.

1    2   3

4    5   6

7    8   9

Here the data file has 3 lines.  This will generate a matrix with 3 rows.  Each line has 3 values, separated by at least one white space, a blank character.  Therefore, the matrix will have 3 columns. 

It is possible to have a comment line in the data file, by inserting a slash sign, "/", in front of a line.  Comment lines will not be read by the function.

Class

Matrix_cmp

Usage

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

argm1 = file name for the documentation file (default extension is ".txt")

 

See an example in function "LOADASC" of class Matrix

 

| HOME | BACK |


LOADBIN

| HOME | BACK |

Purpose

To load data from a binary file and stored in a matrix object.

If file name extension is omitted, the function will add default extensions to the files.  The default extension of a binary data file is ".raw".

Unless the path name is given in the file names, the function will search for the files in the current working directory, defined by command "set path".

It should be noted that the number of bytes occupied by one single pixel, an element of a matrix, is governed by the data type of the calling matrix.  In this case a double precision number, thus 16 bytes per element.

Class

Matrix_cmp

Usage

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

argm1 = file name for the binary file (default extension is ".raw")

argm2 = no of rows

argm3 = no of columns

 

See an example in function "LOADBIN" of class Matrix

 

| HOME | BACK |


LOADBIN_OFFSET

| HOME | BACK |

Purpose

To load data from a binary file and stored in a matrix object.  This function requires an offset number of bytes, where the data reading starts to take place.

If file name extension is omitted, the function will add default extensions to the files.  The default extension of a binary data file is ".raw".

Unless the path name is given in the file names, the function will search for the files in the current working directory, defined by command "set path".

It should be noted that the number of bytes occupied by one single pixel, an element of a matrix, is governed by the data type of the calling matrix.  In this case a double precision number, thus 8 bytes per element.

Class

Matrix_cmp

Usage

{void} object.LOADBIN_OFFSET({String} argm1, {int} argm2, {int} argm3, {int} argm4)

argm1 = file name for the binary file (default extension is ".raw")

argm2 = no of rows

argm3 = no of columns

argm4 = offset number of bytes (first byte = 0), position where the reading starts.

 

See an example in function "LOADBIN_OFFSET" of class Matrix

 

| HOME | BACK |


MAX

| HOME | BACK |

Purpose

To determine the maximum value of all elements of a matrix.

Class

Matrix_cmp

Usage

{Complex} ret  =  object.MAX()

 

See an example in function "MAX" of class Matrix

 

| HOME | BACK |


MIN

| HOME | BACK |

Purpose

To determine the minimum value of all elements of a matrix.

Class

Matrix_cmp

Usage

{Complex} ret  =  object.MIN()

 

See an example in function "MIN" of class Matrix

 

| HOME | BACK |


MULT121

| HOME | BACK |

Purpose

To perform a one-to-one multiplication of two same size matrices, such that each element value of the result matrix is the multiplication of elements of the two matrices at the same index.

Class

Matrix_cmp

Usage

{Matrix_cmp} ret  =  object.MULT121({Matrix_cmp} argm1)

argm1 = the second matrix

 

See an example in function "MULT121" of class Matrix

 

| HOME | BACK |


NCOL

| HOME | BACK |

Purpose

To report the number of columns of a matrix.

Class

Matrix_cmp

Usage

{int} ret  =  object.NCOL()

 

See an example in function "NCOL" of class Matrix

 

| HOME | BACK |


NO2RC

| HOME | BACK |

Purpose

To convert a number to a row and column number.

Class

Matrix_cmp

Usage

{Indx} ret  =  object.NO2RC({int} argm1)

argm1 = a number

 

See an example in function "NO2RC" of class Matrix

 

| HOME | BACK |


NROW

| HOME | BACK |

Purpose

To report the number of rows of a matrix.

Class

Matrix_cmp

Usage

{int} ret  =  object.NROW()

 

See an example in function "NROW" of class Matrix

 

| HOME | BACK |


NULLDATA

| HOME | BACK |

Purpose

To report the current value of null data of a matrix.

Class

Matrix_cmp

Usage

{double} ret  =  object.NULLDATA()

 

See an example in function "NULLDATA" of class Matrix

 

| HOME | BACK |


PRODCOL

| HOME | BACK |

Purpose

To compute a product, a multiplication, of all values in each column.

Class

Matrix_cmp

Usage

{Matrix_cmp} ret  =  object.PRODCOL()

 

See an example in function "PRODCOL" of class Matrix

 

| HOME | BACK |


PRODROW

| HOME | BACK |

Purpose

To compute a product, a multiplication, of all values in each row.

Class

Matrix_cmp

Usage

{Matrix_cmp} ret  =  object.PRODROW()

 

See an example in function "PRODROW" of class Matrix

 

| HOME | BACK |


RC2NO

| HOME | BACK |

Purpose

To convert a row and column number to a number.

Class

Matrix_cmp

Usage

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

argm1 = row number

argm2 = column number

 

See an example in function "RC2NO" of class Matrix

 

| HOME | BACK |


REAL

| HOME | BACK |

Purpose

To extract real parts of a Matrix_cmp.

Class

Matrix_cmp

Usage

{Matrix} ret  =  object.REAL()

Example:

->A = Matrix_cmp(2,2, Complex(2,3))
->print A

 no of row    : 2
 no of column : 2

 0:    2.00000 + 3.00000i    2.00000 + 3.00000i
 1:    2.00000 + 3.00000i    2.00000 + 3.00000i


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

 no of row    : 2
 no of column : 2

 0:    2.00000    2.00000
 1:    2.00000    2.00000

See also (class function)

img

| HOME | BACK |


RESHAPE

| HOME | BACK |

Purpose

To reshape the size of a matrix. 

It is important that the total number of elements of a matrix before and after reshape must be the same.

Class

Matrix_cmp

Usage

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

argm1 = new number of rows

argm2 = new number of columns 

 

See an example in function "RESHAPE" of class Matrix

 

| HOME | BACK |


REVERSE

| HOME | BACK |

Purpose

To reverse values of elements of a matrix.

Class

Matrix_cmp

Usage

{Matrix_bln} ret  =  object.REVERSE()

 

See an example in function "REVERSE" of class Matrix

 

| HOME | BACK |


ROT180

| HOME | BACK |

Purpose

To rotate a matrix at angle of 180 degree.

Class

Matrix_cmp

Usage

{Matrix_cmp} ret  =  object.ROT180()

 

See an example in function "ROT180" of class Matrix

 

| HOME | BACK |


ROT90L

| HOME | BACK |

Purpose

To rotate a matrix at angle of 90 degree to the left.

Class

Matrix_cmp

Usage

{Matrix_cmp} ret  =  object.ROT90L()

 

See an example in function "ROT90L" of class Matrix

 

| HOME | BACK |


ROT90R

| HOME | BACK |

Purpose

To rotate a matrix at angle of 90 degree to the right.

Class

Matrix_cmp

Usage

{Matrix_cmp} ret  =  object.ROT90R()

 

See an example in function "ROT90R" of class Matrix

 

| 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_cmp

Usage

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

argm1 = an existing file name

 

See an example in function "SAPPBIN" of class Matrix

 

| 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)

16

/ 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 (16 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_cmp

Usage

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

argm1 = documentation file name

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

 

See an example in function "SAVE" of class Matrix

 

| 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_cmp

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")

 

See an example in function "SAVEASC" of class Matrix

 

| 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_cmp

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")

 

See an example in function "SAVEASCXYZ" of class Matrix

 

| 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 (16 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_cmp

Usage

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

argm1 = an existing file name

 

See an example in function "SAVEBIN" of class Matrix

 

| 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_cmp

Usage

{void} object.SET({VecIndx} argm1, {Complex} 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

 

See an example in function "SET" of class Matrix

 

| 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_cmp

Usage

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

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

 

See an example in function "SETBDIAG" of class Matrix

 

| HOME | BACK |


SETDIAG

| HOME | BACK |

Purpose

To set value to diagonal elements of a square matrix.

Class

Matrix_cmp

Usage

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

argm1 = value to be set to diagonal elements

 

See an example in function "SETDIAG" of class Matrix

 

| 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_cmp

Usage

{void} object.SETWINDOW({int} argm1, {int} argm2, {Matrix_cmp} 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

 

See an example in function "SETWINDOW" of class Matrix

 

| HOME | BACK |


SIZE

| HOME | BACK |

Purpose

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

Class

Matrix_cmp

Usage

{Indx} ret  =  object.SIZE()

 

See an example in function "SIZE" of class Matrix

 

| HOME | BACK |


SKIP

| HOME | BACK |

Purpose

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

Class

Matrix_cmp

Usage

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

argm1 = no of rows and columns being skipped

 

See an example in function "SKIP" of class Matrix

 

| 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_cmp

Usage

{Matrix_cmp} ret  =  object.SORT([{int} argm1])

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

 

See an example in function "SORT" of class Matrix

 

| HOME | BACK |


SORTALL

| HOME | BACK |

Purpose

To sort all elements of a matrix.

Class

Matrix_cmp

Usage

{Matrix_cmp} ret  =  object.SORTALL()

 

See an example in function "SORTALL" of class Matrix

 

| HOME | BACK |


SUM

| HOME | BACK |

Purpose

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

Class

Matrix_cmp

Usage

{Complex} ret  =  object.SUM()

 

See an example in function "SUM" of class Matrix

 

| HOME | BACK |


SWAPCOL

| HOME | BACK |

Purpose

To swap columns in a matrix.

Class

Matrix_cmp

Usage

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

argm1 = first column number to be swapped

argm2 = second column number to be swapped

 

See an example in function "SWAPCOL" of class Matrix

 

| HOME | BACK |


SWAPROW

| HOME | BACK |

Purpose

To swap rows in a matrix.

Class

Matrix_cmp

Usage

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

argm1 = first row number to be swapped

argm2 = second row number to be swapped

 

See an example in function "SWAPROW" of class Matrix

 

| HOME | BACK |


TSP

| HOME | BACK |

Purpose

To determine a transpose matrix.

Class

Matrix_cmp

Usage

{Matrix_bln} ret  =  object.TSP()

 

See an example in function "TSP" of class Matrix

 

| HOME | BACK |


WINDOW

| HOME | BACK |

Purpose

To cut a window out of a matrix.

Class

Matrix_cmp

Usage

{Matrix} ret  =  object.WINDOW({int} argm1, {int} argm2, {int} argm3, {int} argm4)

argm1 = first row number to be cut

argm2 = last row number to be cut

argm3 = first column number to be cut

argm4 = last column number to be cut

 

See an example in function "WINDOW" of class Matrix

 

| HOME | BACK |