`Matrix`

A two-dimensional matrix.

## Example

-- Create a default 2x2 double matrix of zerosm1 = cf.Matrix.Zeros(2)-- Assign values to each element of the matrixm1[1][1] = 1 m1[2][1] = 2 m1[1][2] = 3 m1[2][2] = 4-- Create a 2x2 double matrix with a fill value of 3m2 = cf.Matrix(2, 2, 3)-- Determine the transpose and determinant of the matrixtranspose = m1:Transpose() determinant = m1:Determinant()-- Some of the valid operators for 'Matrix'm3 = m1 * 2 m4 = m2 * (3 + j) m5 = m1 + 2 m6 = m1 - 1 m7 = m1 + m2 m8 = m1 - m2

## Usage locations (object properties)

The following objects have properties using the Matrix object:

- ComplexMatrix(.Im)
- ComplexMatrix(.Re)
- ComplexMatrix(.re)
- ComplexMatrix(.im)
- Matrix(.Im)
- Matrix(.Re)

## Property List

- ColumnCount
- The number of columns in the matrix. (Read only number)
- Im
- The imaginary component of the complex matrix. (Read/Write Matrix)
- Re
- The real component of the complex matrix. (Read/Write Matrix)
- RowCount
- The number of rows in the matrix. (Read only number)
- Type
- The object type string. (Read only string)

## Method List

- Abs ()
- Calculate the absolute value of all the entries in the matrix. (Returns a Matrix object.)
- Angle ()
- Calculate the angle of all the entries in the matrix. (Returns a Matrix object.)
- Conj ()
- Calculate the conjugate of all the entries in the matrix. (Returns a ComplexMatrix object.)
- Determinant ()
- Calculate the determinant of the matrix. (Returns a number object.)
- Duplicate ()
- Duplicate the matrix. (Returns a Matrix object.)
- ExportMatFile (
`filename`string,`varname`string) - Writes the given ComplexMatrix object to a *.mat file. (Returns a boolean object.)
- FFT ()
- Calculates the fast Fourier transform of the column or row matrix. For a matrix containing multiple columns and rows, the fast Fourier transform will be calculated for each of the columns. (Returns a ComplexMatrix object.)
- IFFT ()
- Calculates the inverse fast Fourier transform of the column or row matrix. For a matrix containing multiple columns and rows, the inverse fast Fourier transform will be calculated for each of the columns. (Returns a ComplexMatrix object.)
- Imag ()
- Extract the imaginary part of all the entries in the matrix. (Returns a Matrix object.)
- Inverse ()
- Calculate the inverse matrix. (Returns a Matrix object.)
- Magnitude ()
- Calculate the magnitude of all the entries in the matrix. (Returns a Matrix object.)
- Max ()
- Extracts the maximum from the matrix. (Returns a number object.)
- Mean ()
- Calculates the mean value of the elements of the matrix. (Returns a number object.)
- Min ()
- Extracts the minimum from the matrix. (Returns a number object.)
- Phase ()
- Calculate the phase of all the entries in the matrix. (Returns a Matrix object.)
- Real ()
- Extract the real part of all the entries in the matrix. (Returns a Matrix object.)
- ReplaceSubMatrix (
`matrix`Matrix,`rowstart`number,`columnstart`number) - Replace the sub matrix starting at the given indices with the provided matrix.
- SubMatrix (
`rowstart`number,`rowend`number,`columnstart`number,`columnend`number) - Obtain the sub matrix from the given parameters. (Returns a Matrix object.)
- Sum ()
- Calculates the sum of all the elements of the matrix. (Returns a number object.)
- Transpose ()
- Calculate the transpose of the matrix. (Returns a Matrix object.)

## Constructor Function List

- Diagonal (
`values`List of number) - Creates a diagonal matrix. (Returns a Matrix object.)
- Identity (
`size`number) - Creates an identity matrix. (Returns a Matrix object.)
- New (
`rows`number,`columnValues`List of number) - Creates a new matrix. (Returns a Matrix object.)
- New (
`rowValues`List of number,`columns`number) - Creates a new matrix. (Returns a Matrix object.)
- New (
`rows`number,`columns`number,`fill`number) - Creates a new matrix. (Returns a Matrix object.)
- New (
`rows`number,`columns`number) - Creates a new matrix with uninitialised elements. (Returns a Matrix object.)
- Ones (
`size`number) - Creates a new matrix filled with ones. (Returns a Matrix object.)
- Zeros (
`size`number) - Creates a new matrix filled with zeros. (Returns a Matrix object.)

## Static Function List

- Abs (
`matrix`Matrix) - Calculates the absolute value of each entry. (Returns a Matrix object.)
- Acos (
`matrix`Matrix) - Calculate the arc cosine of all the entries in the matrix. (Returns a Matrix object.)
- Asin (
`matrix`Matrix) - Calculate the arc sine of all the entries in the matrix. (Returns a Matrix object.)
- Atan (
`matrix`Matrix) - Calculate the arc tangent of all the entries in the matrix. (Returns a Matrix object.)
- Atan2 (
`matrix`Matrix,`matrix`Matrix) - Calculate the arc tangent of all the entries in the matrix. (Returns a Matrix object.)
- Ceil (
`matrix`Matrix) - Calculate the ceiling of all the elements in the matrix. (Returns a Matrix object.)
- Cos (
`matrix`Matrix) - Calculate the cosine of all the entries in the matrix. (Returns a Matrix object.)
- Exponent (
`matrix`Matrix) - Calculate the exponent of all the entries in the matrix. (Returns a Matrix object.)
- Find (
`matrix`Matrix) - Finds all entries in the matrix that are non-zero. (Returns a table object.)
- Floor (
`matrix`Matrix) - Calculate the floor of all the entries in the matrix. (Returns a Matrix object.)
- GreaterThan (
`matrix`Matrix,`matrix`Matrix) - Determines if the entries of two matrices are greater than each other. (Returns a Matrix object.)
- GreaterThan (
`matrix`Matrix,`value`number) - Determines if a matrix has entries greater than the specified value. (Returns a Matrix object.)
- GreaterThanOrEqual (
`matrix`Matrix,`matrix`Matrix) - Determines if the entries of two matrices are greater than or equal to each other. (Returns a Matrix object.)
- GreaterThanOrEqual (
`matrix`Matrix,`value`number) - Determines if a matrix has entries greater than or equal to the specified value. (Returns a Matrix object.)
- IsEqual (
`matrix`Matrix,`matrix`Matrix) - Determines if the entries of two matrices are equal. (Returns a Matrix object.)
- IsEqual (
`matrix`Matrix,`value`number) - Determines if a matrix has entries equal to the specified value. (Returns a Matrix object.)
- LessThan (
`matrix`Matrix,`matrix`Matrix) - Determines if the entries of two matrices are less than each other. (Returns a Matrix object.)
- LessThan (
`matrix`Matrix,`value`number) - Determines if a matrix has entries less than the specified value. (Returns a Matrix object.)
- LessThanOrEqual (
`matrix`Matrix,`matrix`Matrix) - Determines if the entries of two matrices are less than or equal to each other. (Returns a Matrix object.)
- LessThanOrEqual (
`matrix`Matrix,`value`number) - Determines if a matrix has entries less than or equal to the specified value. (Returns a Matrix object.)
- Log (
`matrix`Matrix) - Calculate the log of all the entries in the matrix. (Returns a Matrix object.)
- Log10 (
`matrix`Matrix) - Calculate the log10 of all the entries in the matrix. (Returns a Matrix object.)
- Magnitude (
`matrix`Matrix) - Calculates the magnitude value of each entry. (Returns a Matrix object.)
- Max (
`matrix`Matrix,`matrix`Matrix) - Calculate the maximum of two corresponding entries from two matrices. (Returns a Matrix object.)
- Max (
`matrix`Matrix) - Calculate the maximum of all the entries in the matrix. (Returns a number object.)
- Mean (
`matrix`Matrix) - Calculate the mean of all the entries in the matrix. (Returns a number object.)
- Min (
`matrix`Matrix,`matrix`Matrix) - Calculate the minimum of two corresponding entries from two matrices. (Returns a Matrix object.)
- Min (
`matrix`Matrix) - Calculate the minimum of all the entries in the matrix. (Returns a number object.)
- Modulo (
`matrix`Matrix,`matrix`Matrix) - Calculates the Modulo of each entry with the corresponding entry in the second matrix. (Returns a Matrix object.)
- Modulo (
`matrix`Matrix,`value`number) - Calculates the Modulo of each entry with the value. (Returns a Matrix object.)
- MultiplyByElement (
`matrix`Matrix,`matrix`Matrix) - Calculate the exponent of all the elements in the matrix. (Returns a Matrix object.)
- MultiplyByElement (
`matrix`Matrix,`value`number) - Calculate the exponent of all the elements in the matrix. (Returns a Matrix object.)
- Negate (
`matrix`Matrix) - Negate each entry of the matrix. (Returns a Matrix object.)
- NotEqual (
`matrix`Matrix,`matrix`Matrix) - Determines if the entries of two matrices are not equal. (Returns a Matrix object.)
- NotEqual (
`matrix`Matrix,`value`number) - Determines if a matrix has entries not equal to the specified value. (Returns a Matrix object.)
- Power (
`matrix`Matrix,`matrix`Matrix) - Raise all entries of the first matrix to the power of each entry in the second matrix. (Returns a Matrix object.)
- Power (
`matrix`Matrix,`exponent`number) - Raise each entry to the power of the exponent. (Returns a Matrix object.)
- Sin (
`matrix`Matrix) - Calculate the sine of all the entries in the matrix. (Returns a Matrix object.)
- Sqrt (
`matrix`Matrix) - Calculate the square root of all the entries in the matrix. (Returns a Matrix object.)
- Sum (
`matrix`Matrix) - Calculate the sum of all the entries in the matrix. (Returns a number object.)
- Tan (
`matrix`Matrix) - Calculate the tan of all the entries in the matrix. (Returns a Matrix object.)

## Index List

- [number]
- Access the specified row in the matrix. (Read MatrixIndexer)

## Property Details

- ColumnCount
- The number of columns in the matrix.
- Type
- number
- Access
- Read only

- Im
- The imaginary component of the complex matrix.
- Type
- Matrix
- Access
- Read/Write

- Re
- The real component of the complex matrix.
- Type
- Matrix
- Access
- Read/Write

- RowCount
- The number of rows in the matrix.
- Type
- number
- Access
- Read only

- Type
- The object type string.
- Type
- string
- Access
- Read only

## Method Details

- Abs ()
- Calculate the absolute value of all the entries in the matrix.
- Return
- Matrix
- The absolute value.

- Angle ()
- Calculate the angle of all the entries in the matrix.
- Return
- Matrix
- The angle.

- Conj ()
- Calculate the conjugate of all the entries in the matrix.
- Return
- ComplexMatrix
- The conjugate.

- Determinant ()
- Calculate the determinant of the matrix.
- Return
- number
- The determinant of the matrix.

- Duplicate ()
- Duplicate the matrix.
- Return
- Matrix
- The duplicated matrix.

- ExportMatFile (
`filename`string,`varname`string) - Writes the given ComplexMatrix object to a *.mat file.
- FFT ()
- Calculates the fast Fourier transform of the column or row matrix. For a matrix containing multiple columns and rows, the fast Fourier transform will be calculated for each of the columns.
- Return
- ComplexMatrix
- The calculated FFT complex matrix.

- IFFT ()
- Calculates the inverse fast Fourier transform of the column or row matrix. For a matrix containing multiple columns and rows, the inverse fast Fourier transform will be calculated for each of the columns.
- Return
- ComplexMatrix
- The calculated IFFT complex matrix.

- Imag ()
- Extract the imaginary part of all the entries in the matrix.
- Return
- Matrix
- The imaginary value.

- Inverse ()
- Calculate the inverse matrix.
- Return
- Matrix
- The inverse of the matrix.

- Magnitude ()
- Calculate the magnitude of all the entries in the matrix.
- Return
- Matrix
- The magnitude value.

- Max ()
- Extracts the maximum from the matrix.
- Return
- number
- The maximum value.

- Mean ()
- Calculates the mean value of the elements of the matrix.
- Return
- number
- The mean value.

- Min ()
- Extracts the minimum from the matrix.
- Return
- number
- The minimum value.

- Phase ()
- Calculate the phase of all the entries in the matrix.
- Return
- Matrix
- The phase.

- Real ()
- Extract the real part of all the entries in the matrix.
- Return
- Matrix
- The real value.

- ReplaceSubMatrix (
`matrix`Matrix,`rowstart`number,`columnstart`number) - Replace the sub matrix starting at the given indices with the provided matrix.
- SubMatrix (
`rowstart`number,`rowend`number,`columnstart`number,`columnend`number) - Obtain the sub matrix from the given parameters.
- Sum ()
- Calculates the sum of all the elements of the matrix.
- Return
- number
- The sum.

- Transpose ()
- Calculate the transpose of the matrix.
- Return
- Matrix
- The transpose of the matrix.

## Static Function Details

- Abs (
`matrix`Matrix) - Calculates the absolute value of each entry.
- Acos (
`matrix`Matrix) - Calculate the arc cosine of all the entries in the matrix.
- Asin (
`matrix`Matrix) - Calculate the arc sine of all the entries in the matrix.
- Atan (
`matrix`Matrix) - Calculate the arc tangent of all the entries in the matrix.
- Atan2 (
`matrix`Matrix,`matrix`Matrix) - Calculate the arc tangent of all the entries in the matrix.
- Ceil (
`matrix`Matrix) - Calculate the ceiling of all the elements in the matrix.
- Cos (
`matrix`Matrix) - Calculate the cosine of all the entries in the matrix.
- Diagonal (
`values`List of number) - Creates a diagonal matrix.
- Exponent (
`matrix`Matrix) - Calculate the exponent of all the entries in the matrix.
- Find (
`matrix`Matrix) - Finds all entries in the matrix that are non-zero.
- Floor (
`matrix`Matrix) - Calculate the floor of all the entries in the matrix.
- GreaterThan (
`matrix`Matrix,`matrix`Matrix) - Determines if the entries of two matrices are greater than each other.
- GreaterThan (
`matrix`Matrix,`value`number) - Determines if a matrix has entries greater than the specified value.
- GreaterThanOrEqual (
`matrix`Matrix,`matrix`Matrix) - Determines if the entries of two matrices are greater than or equal to each other.
- GreaterThanOrEqual (
`matrix`Matrix,`value`number) - Determines if a matrix has entries greater than or equal to the specified value.
- Identity (
`size`number) - Creates an identity matrix.
- IsEqual (
`matrix`Matrix,`matrix`Matrix) - Determines if the entries of two matrices are equal.
- IsEqual (
`matrix`Matrix,`value`number) - Determines if a matrix has entries equal to the specified value.
- LessThan (
`matrix`Matrix,`matrix`Matrix) - Determines if the entries of two matrices are less than each other.
- LessThan (
`matrix`Matrix,`value`number) - Determines if a matrix has entries less than the specified value.
- LessThanOrEqual (
`matrix`Matrix,`matrix`Matrix) - Determines if the entries of two matrices are less than or equal to each other.
- LessThanOrEqual (
`matrix`Matrix,`value`number) - Determines if a matrix has entries less than or equal to the specified value.
- Log (
`matrix`Matrix) - Calculate the log of all the entries in the matrix.
- Log10 (
`matrix`Matrix) - Calculate the log10 of all the entries in the matrix.
- Magnitude (
`matrix`Matrix) - Calculates the magnitude value of each entry.
- Max (
`matrix`Matrix,`matrix`Matrix) - Calculate the maximum of two corresponding entries from two matrices.
- Max (
`matrix`Matrix) - Calculate the maximum of all the entries in the matrix.
- Mean (
`matrix`Matrix) - Calculate the mean of all the entries in the matrix.
- Min (
`matrix`Matrix,`matrix`Matrix) - Calculate the minimum of two corresponding entries from two matrices.
- Min (
`matrix`Matrix) - Calculate the minimum of all the entries in the matrix.
- Modulo (
`matrix`Matrix,`matrix`Matrix) - Calculates the Modulo of each entry with the corresponding entry in the second matrix.
- Modulo (
`matrix`Matrix,`value`number) - Calculates the Modulo of each entry with the value.
- MultiplyByElement (
`matrix`Matrix,`matrix`Matrix) - Calculate the exponent of all the elements in the matrix.
- MultiplyByElement (
`matrix`Matrix,`value`number) - Calculate the exponent of all the elements in the matrix.
- Negate (
`matrix`Matrix) - Negate each entry of the matrix.
- New (
`rows`number,`columnValues`List of number) - Creates a new matrix.
- New (
`rowValues`List of number,`columns`number) - Creates a new matrix.
- New (
`rows`number,`columns`number,`fill`number) - Creates a new matrix.
- New (
`rows`number,`columns`number) - Creates a new matrix with uninitialised elements.
- NotEqual (
`matrix`Matrix,`matrix`Matrix) - Determines if the entries of two matrices are not equal.
- NotEqual (
`matrix`Matrix,`value`number) - Determines if a matrix has entries not equal to the specified value.
- Ones (
`size`number) - Creates a new matrix filled with ones.
- Power (
`matrix`Matrix,`matrix`Matrix) - Raise all entries of the first matrix to the power of each entry in the second matrix.
- Power (
`matrix`Matrix,`exponent`number) - Raise each entry to the power of the exponent.
- Sin (
`matrix`Matrix) - Calculate the sine of all the entries in the matrix.
- Sqrt (
`matrix`Matrix) - Calculate the square root of all the entries in the matrix.
- Sum (
`matrix`Matrix) - Calculate the sum of all the entries in the matrix.
- Tan (
`matrix`Matrix) - Calculate the tan of all the entries in the matrix.
- Zeros (
`size`number) - Creates a new matrix filled with zeros.