C# Class MatrixLibrary.NMatrix

Matrix Library .Net v2.0 By Anas Abidi, 2004. The Matrix Library contains Class Matrix which provides many static methods for making various matrix operations on objects derived from the class or on arrays defined as double. The '+','-','*' operators are overloaded to work with the objects derived from the matrix class.
Show file Open project: bcourter/SpaceClaim-AddIns Class Usage Examples

Public Methods

Method Description
Add ( NMatrix Mat1, NMatrix Mat2 ) : NMatrix

Returns the summation of two matrices with compatible dimensions. In case of an error the error is raised as an exception.

Add ( double Mat1, double Mat2 ) : ].double[

Returns the summation of two matrices with compatible dimensions. In case of an error the error is raised as an exception.

Copy ( ) : NMatrix
CrossProduct ( NMatrix V1, NMatrix V2 ) : NMatrix

Returns the cross product of two vectors whose dimensions should be [3] or [3x1]. In case of an error the error is raised as an exception.

CrossProduct ( double V1, double V2 ) : ].double[

Returns the cross product of two vectors whose dimensions should be [3] or [3x1]. In case of an error the error is raised as an exception.

CrossProduct ( double V1, double V2 ) : double[]

Returns the cross product of two vectors whose dimensions should be [3] or [3,1]. In case of an error the error is raised as an exception.

Det ( NMatrix Mat ) : double

Returns the determinant of a matrix with [n,n] dimension. In case of an error the error is raised as an exception.

Det ( double Mat ) : double

Returns the determinant of a matrix with [n,n] dimension. In case of an error the error is raised as an exception.

DotProduct ( NMatrix V1, NMatrix V2 ) : double

Returns the dot product of two vectors whose dimensions should be [3] or [3,1]. In case of an error the error is raised as an exception.

DotProduct ( double V1, double V2 ) : double

Returns the dot product of two vectors whose dimensions should be [3] or [3,1]. In case of an error the error is raised as an exception.

Eigen ( NMatrix Mat, NMatrix &d, NMatrix &v ) : void

Returns the Eigenvalues and Eigenvectors of a real symmetric matrix, which is of dimensions [n,n]. In case of an error the error is raised as an exception. Note: This method is based on the 'Eigenvalues and Eigenvectors of a TridiagonalMatrix' section of Numerical Recipes in C by William H. Press, Saul A. Teukolsky, William T. Vetterling and Brian P. Flannery, University of Cambridge Press 1992.

Eigen ( double Mat, double &d, double &v ) : void

Returns the Eigenvalues and Eigenvectors of a real symmetric matrix, which is of dimensions [n,n]. In case of an error the error is raised as an exception. Note: This method is based on the 'Eigenvalues and Eigenvectors of a TridiagonalMatrix' section of Numerical Recipes in C by William H. Press, Saul A. Teukolsky, William T. Vetterling and Brian P. Flannery, University of Cambridge Press 1992.

Equals ( Object obj ) : bool

Tests whether the specified object is a MatrixLibrary.Matrix object and is identical to this MatrixLibrary.Matrix object.

GetColumn ( int col ) : double[]
GetHashCode ( ) : int
GetRow ( int row ) : double[]
Identity ( int n ) : ].double[

Returns an Identity matrix with dimensions [n,n] in the from of an array.

Inverse ( NMatrix Mat ) : NMatrix

Returns the inverse of a matrix with [n,n] dimension and whose determinant is not zero. In case of an error the error is raised as an exception.

Inverse ( double Mat ) : ].double[

Returns the inverse of a matrix with [n,n] dimension and whose determinant is not zero. In case of an error the error is raised as an exception.

IsEqual ( NMatrix Mat1, NMatrix Mat2 ) : bool

Checks if two matrices of equal dimensions are equal or not. In case of an error the error is raised as an exception.

IsEqual ( double Mat1, double Mat2 ) : bool

Checks if two Arrays of equal dimensions are equal or not. In case of an error the error is raised as an exception.

LU ( NMatrix Mat, NMatrix &L, NMatrix &U, NMatrix &P ) : void

Returns the LU Decomposition of a matrix. the output is: lower triangular matrix L, upper triangular matrix U, and permutation matrix P so that P*X = L*U. In case of an error the error is raised as an exception. Note: This method is based on the 'LU Decomposition and Its Applications' section of Numerical Recipes in C by William H. Press, Saul A. Teukolsky, William T. Vetterling and Brian P. Flannery, University of Cambridge Press 1992.

LU ( double Mat, double &L, double &U, double &P ) : void

Returns the LU Decomposition of a matrix. the output is: lower triangular matrix L, upper triangular matrix U, and permutation matrix P so that P*X = L*U. In case of an error the error is raised as an exception. Note: This method is based on the 'LU Decomposition and Its Applications' section of Numerical Recipes in C by William H. Press, Saul A. Teukolsky, William T. Vetterling and Brian P. Flannery, University of Cambridge Press 1992.

Multiply ( NMatrix Mat1, NMatrix Mat2 ) : NMatrix

Returns the multiplication of two matrices with compatible dimensions OR the cross-product of two vectors. In case of an error the error is raised as an exception.

Multiply ( double Mat1, double Mat2 ) : ].double[

Returns the multiplication of two matrices with compatible dimensions. In case of an error the error is raised as an exception.

NMatrix ( double Mat ) : System

Matrix object constructor, constructs a matrix from an already defined array object.

NMatrix ( int noRows, int noCols ) : System

Matrix object constructor, constructs an empty matrix with dimensions: rows = noRows and cols = noCols.

OneD_2_TwoD ( double Mat ) : ].double[

Returns the 2D form of a 1D array. i.e. array with dimension[n] is returned as an array with dimension [n,1]. In case of an error the error is raised as an exception.

PINV ( NMatrix Mat ) : NMatrix

Returns the pseudoinverse of a matrix, such that X = PINV(A) produces a matrix 'X' of the same dimensions as A' so that A*X*A = A, X*A*X = X. In case of an error the error is raised as an exception.

PINV ( double Mat ) : ].double[

Returns the pseudoinverse of a matrix, such that X = PINV(A) produces a matrix 'X' of the same dimensions as A' so that A*X*A = A, X*A*X = X. In case of an error the error is raised as an exception.

PrintMat ( NMatrix Mat ) : string

Returns a matrix as a string, so it can be viewed in a multi-text textbox or in a richtextBox (preferred). In case of an error the error is raised as an exception.

PrintMat ( double Mat ) : string

Returns a matrix as a string, so it can be viewed in a multi-text textbox or in a richtextBox (preferred). In case of an error the error is raised as an exception.

Rank ( NMatrix Mat ) : int

Returns the rank of a matrix. In case of an error the error is raised as an exception.

Rank ( double Mat ) : int

Returns the rank of a matrix. In case of an error the error is raised as an exception.

SVD ( NMatrix Mat, NMatrix &S, NMatrix &U, NMatrix &V ) : void

Evaluates the Singular Value Decomposition of a matrix, returns the matrices S, U and V. Such that a given Matrix = U x S x V'. In case of an error the error is raised as an exception. Note: This method is based on the 'Singular Value Decomposition' section of Numerical Recipes in C by William H. Press, Saul A. Teukolsky, William T. Vetterling and Brian P. Flannery, University of Cambridge Press 1992.

SVD ( double Mat_, double &S_, double &U_, double &V_ ) : void

Evaluates the Singular Value Decomposition of a matrix, returns the matrices S, U and V. Such that a given Matrix = U x S x V'. In case of an error the error is raised as an exception. Note: This method is based on the 'Singular Value Decomposition' section of Numerical Recipes in C by William H. Press, Saul A. Teukolsky, William T. Vetterling and Brian P. Flannery, University of Cambridge Press 1992.

ScalarDivide ( double Value, NMatrix Mat ) : NMatrix

Returns the division of a matrix or a vector (i.e dimension [3,1]) by a scalar quantity. In case of an error the error is raised as an exception.

ScalarDivide ( double Value, double Mat ) : ].double[

Returns the division of a matrix or a vector (i.e dimension [3,1]) by a scalar quantity. In case of an error the error is raised as an exception.

ScalarMultiply ( double Value, NMatrix Mat ) : NMatrix

Returns the multiplication of a matrix or a vector (i.e dimension [3,1]) with a scalar quantity. In case of an error the error is raised as an exception.

ScalarMultiply ( double Value, double Mat ) : ].double[

Returns the multiplication of a matrix or a vector (i.e dimension [3,1]) with a scalar quantity. In case of an error the error is raised as an exception.

SolveLinear ( NMatrix MatA, NMatrix MatB ) : NMatrix

Solves a set of n linear equations A.X = B, and returns X, where A is [n,n] and B is [n,1]. In the same manner if you need to compute: inverse(A).B, it is better to use this method instead, as it is much faster. In case of an error the error is raised as an exception. Note: This method is based on the 'LU Decomposition and Its Applications' section of Numerical Recipes in C by William H. Press, Saul A. Teukolsky, William T. Vetterling and Brian P. Flannery, University of Cambridge Press 1992.

SolveLinear ( double MatA, double MatB ) : ].double[

Solves a set of n linear equations A.X = B, and returns X, where A is [n,n] and B is [n,1]. In the same manner if you need to compute: inverse(A).B, it is better to use this method instead, as it is much faster. In case of an error the error is raised as an exception. Note: This method is based on the 'LU Decomposition and Its Applications' section of Numerical Recipes in C by William H. Press, Saul A. Teukolsky, William T. Vetterling and Brian P. Flannery, University of Cambridge Press 1992.

Subtract ( NMatrix Mat1, NMatrix Mat2 ) : NMatrix

Returns the difference of two matrices with compatible dimensions. In case of an error the error is raised as an exception.

Subtract ( double Mat1, double Mat2 ) : ].double[

Returns the difference of two matrices with compatible dimensions. In case of an error the error is raised as an exception.

ToString ( ) : string

Returns the matrix as a string, so it can be viewed in a multi-text textbox or in a richtextBox (preferred). In case of an error the error is raised as an exception.

Transpose ( NMatrix Mat ) : NMatrix

Returns the transpose of a matrix. In case of an error the error is raised as an exception.

Transpose ( double Mat ) : ].double[

Returns the transpose of a matrix. In case of an error the error is raised as an exception.

TryGaussJordanElimination ( NMatrix a, NMatrix b, NMatrix &result ) : bool
TwoD_2_OneD ( double Mat ) : double[]

Returns the 1D form of a 2D array. i.e. array with dimension[n,1] is returned as an array with dimension [n]. In case of an error the error is raised as an exception.

VectorMagnitude ( NMatrix V ) : double

Returns the magnitude of a vector whose dimension is [3] or [3,1]. In case of an error the error is raised as an exception.

VectorMagnitude ( double V ) : double

Returns the magnitude of a vector whose dimension is [3] or [3,1]. In case of an error the error is raised as an exception.

operator ( ) : NMatrix

Returns the multiplication of two matrices with compatible dimensions OR the cross-product of two vectors. In case of an error the error is raised as an exception.

operator ( ) : bool

Checks if two matrices of equal dimensions are not equal. In case of an error the error is raised as an exception.

this ( int Row, int Col ) : double

Set or get an element from the matrix

Private Methods

Method Description
Find_R_C ( double Mat, int &Row ) : void
Find_R_C ( double Mat, int &Row, int &Col ) : void
IsZero ( double value ) : bool
PYTHAG ( double a, double b ) : double
ROT ( double g, double h, double s, double tau, double a, int i, int j, int k, int l ) : void
SQR ( double a ) : double
Sign ( double a, double b ) : double
SwapRows ( double Mat, int Row, int toRow ) : void
swaprows ( double arr, long row0, long row1 ) : void

Method Details

Add() public static method

Returns the summation of two matrices with compatible dimensions. In case of an error the error is raised as an exception.
public static Add ( NMatrix Mat1, NMatrix Mat2 ) : NMatrix
Mat1 NMatrix First matrix in the summation
Mat2 NMatrix Second matrix in the summation
return NMatrix

Add() public static method

Returns the summation of two matrices with compatible dimensions. In case of an error the error is raised as an exception.
public static Add ( double Mat1, double Mat2 ) : ].double[
Mat1 double First array in the summation
Mat2 double Second array in the summation
return ].double[

Copy() public method

public Copy ( ) : NMatrix
return NMatrix

CrossProduct() public static method

Returns the cross product of two vectors whose dimensions should be [3] or [3x1]. In case of an error the error is raised as an exception.
public static CrossProduct ( NMatrix V1, NMatrix V2 ) : NMatrix
V1 NMatrix First Matrix (dimensions [3,1]) in the cross product
V2 NMatrix Second Matrix (dimensions [3,1]) in the cross product
return NMatrix

CrossProduct() public static method

Returns the cross product of two vectors whose dimensions should be [3] or [3x1]. In case of an error the error is raised as an exception.
public static CrossProduct ( double V1, double V2 ) : ].double[
V1 double First vector array (dimensions [3,1]) in the cross product
V2 double Second vector array (dimensions [3,1]) in the cross product
return ].double[

CrossProduct() public static method

Returns the cross product of two vectors whose dimensions should be [3] or [3,1]. In case of an error the error is raised as an exception.
public static CrossProduct ( double V1, double V2 ) : double[]
V1 double First vector array (dimension [3]) in the cross product
V2 double Second vector array (dimension [3]) in the cross product
return double[]

Det() public static method

Returns the determinant of a matrix with [n,n] dimension. In case of an error the error is raised as an exception.
public static Det ( NMatrix Mat ) : double
Mat NMatrix /// Matrix object with [n,n] dimension whose determinant is to be found ///
return double

Det() public static method

Returns the determinant of a matrix with [n,n] dimension. In case of an error the error is raised as an exception.
public static Det ( double Mat ) : double
Mat double /// Array with [n,n] dimension whose determinant is to be found ///
return double

DotProduct() public static method

Returns the dot product of two vectors whose dimensions should be [3] or [3,1]. In case of an error the error is raised as an exception.
public static DotProduct ( NMatrix V1, NMatrix V2 ) : double
V1 NMatrix First Matrix object (dimension [3,1]) in the dot product
V2 NMatrix Second Matrix object (dimension [3,1]) in the dot product
return double

DotProduct() public static method

Returns the dot product of two vectors whose dimensions should be [3] or [3,1]. In case of an error the error is raised as an exception.
public static DotProduct ( double V1, double V2 ) : double
V1 double First vector array (dimension [3]) in the dot product
V2 double Second vector array (dimension [3]) in the dot product
return double

Eigen() public static method

Returns the Eigenvalues and Eigenvectors of a real symmetric matrix, which is of dimensions [n,n]. In case of an error the error is raised as an exception. Note: This method is based on the 'Eigenvalues and Eigenvectors of a TridiagonalMatrix' section of Numerical Recipes in C by William H. Press, Saul A. Teukolsky, William T. Vetterling and Brian P. Flannery, University of Cambridge Press 1992.
public static Eigen ( NMatrix Mat, NMatrix &d, NMatrix &v ) : void
Mat NMatrix /// The Matrix object whose Eigenvalues and Eigenvectors are to be found ///
d NMatrix A Matrix object where the eigenvalues are returned
v NMatrix A Matrix object where the eigenvectors are returned
return void

Eigen() public static method

Returns the Eigenvalues and Eigenvectors of a real symmetric matrix, which is of dimensions [n,n]. In case of an error the error is raised as an exception. Note: This method is based on the 'Eigenvalues and Eigenvectors of a TridiagonalMatrix' section of Numerical Recipes in C by William H. Press, Saul A. Teukolsky, William T. Vetterling and Brian P. Flannery, University of Cambridge Press 1992.
public static Eigen ( double Mat, double &d, double &v ) : void
Mat double /// The array whose Eigenvalues and Eigenvectors are to be found ///
d double An array where the eigenvalues are returned
v double An array where the eigenvectors are returned
return void

Equals() public method

Tests whether the specified object is a MatrixLibrary.Matrix object and is identical to this MatrixLibrary.Matrix object.
public Equals ( Object obj ) : bool
obj Object The object to compare with the current object
return bool

GetColumn() public method

public GetColumn ( int col ) : double[]
col int
return double[]

GetHashCode() public method

public GetHashCode ( ) : int
return int

GetRow() public method

public GetRow ( int row ) : double[]
row int
return double[]

Identity() public static method

Returns an Identity matrix with dimensions [n,n] in the from of an array.
public static Identity ( int n ) : ].double[
n int the no. of rows or no. cols in the matrix
return ].double[

Inverse() public static method

Returns the inverse of a matrix with [n,n] dimension and whose determinant is not zero. In case of an error the error is raised as an exception.
public static Inverse ( NMatrix Mat ) : NMatrix
Mat NMatrix /// Matrix object with [n,n] dimension whose inverse is to be found ///
return NMatrix

Inverse() public static method

Returns the inverse of a matrix with [n,n] dimension and whose determinant is not zero. In case of an error the error is raised as an exception.
public static Inverse ( double Mat ) : ].double[
Mat double /// Array with [n,n] dimension whose inverse is to be found ///
return ].double[

IsEqual() public static method

Checks if two matrices of equal dimensions are equal or not. In case of an error the error is raised as an exception.
public static IsEqual ( NMatrix Mat1, NMatrix Mat2 ) : bool
Mat1 NMatrix First Matrix in equality check
Mat2 NMatrix Second Matrix in equality check
return bool

IsEqual() public static method

Checks if two Arrays of equal dimensions are equal or not. In case of an error the error is raised as an exception.
public static IsEqual ( double Mat1, double Mat2 ) : bool
Mat1 double First array in equality check
Mat2 double Second array in equality check
return bool

LU() public static method

Returns the LU Decomposition of a matrix. the output is: lower triangular matrix L, upper triangular matrix U, and permutation matrix P so that P*X = L*U. In case of an error the error is raised as an exception. Note: This method is based on the 'LU Decomposition and Its Applications' section of Numerical Recipes in C by William H. Press, Saul A. Teukolsky, William T. Vetterling and Brian P. Flannery, University of Cambridge Press 1992.
public static LU ( NMatrix Mat, NMatrix &L, NMatrix &U, NMatrix &P ) : void
Mat NMatrix Matrix object which will be LU Decomposed
L NMatrix A Matrix object where the lower traingular matrix is returned
U NMatrix A Matrix object where the upper traingular matrix is returned
P NMatrix A Matrix object where the permutation matrix is returned
return void

LU() public static method

Returns the LU Decomposition of a matrix. the output is: lower triangular matrix L, upper triangular matrix U, and permutation matrix P so that P*X = L*U. In case of an error the error is raised as an exception. Note: This method is based on the 'LU Decomposition and Its Applications' section of Numerical Recipes in C by William H. Press, Saul A. Teukolsky, William T. Vetterling and Brian P. Flannery, University of Cambridge Press 1992.
public static LU ( double Mat, double &L, double &U, double &P ) : void
Mat double Array which will be LU Decomposed
L double An array where the lower traingular matrix is returned
U double An array where the upper traingular matrix is returned
P double An array where the permutation matrix is returned
return void

Multiply() public static method

Returns the multiplication of two matrices with compatible dimensions OR the cross-product of two vectors. In case of an error the error is raised as an exception.
public static Multiply ( NMatrix Mat1, NMatrix Mat2 ) : NMatrix
Mat1 NMatrix /// First matrix or vector (i.e: dimension [3,1]) object in /// multiplication ///
Mat2 NMatrix /// Second matrix or vector (i.e: dimension [3,1]) object in /// multiplication ///
return NMatrix

Multiply() public static method

Returns the multiplication of two matrices with compatible dimensions. In case of an error the error is raised as an exception.
public static Multiply ( double Mat1, double Mat2 ) : ].double[
Mat1 double First array in multiplication
Mat2 double Second array in multiplication
return ].double[

NMatrix() public method

Matrix object constructor, constructs a matrix from an already defined array object.
public NMatrix ( double Mat ) : System
Mat double the array the matrix will contain
return System

NMatrix() public method

Matrix object constructor, constructs an empty matrix with dimensions: rows = noRows and cols = noCols.
public NMatrix ( int noRows, int noCols ) : System
noRows int no. of rows in this matrix
noCols int no. of columns in this matrix
return System

OneD_2_TwoD() public static method

Returns the 2D form of a 1D array. i.e. array with dimension[n] is returned as an array with dimension [n,1]. In case of an error the error is raised as an exception.
public static OneD_2_TwoD ( double Mat ) : ].double[
Mat double /// the array to convert, with dimesion [n] ///
return ].double[

PINV() public static method

Returns the pseudoinverse of a matrix, such that X = PINV(A) produces a matrix 'X' of the same dimensions as A' so that A*X*A = A, X*A*X = X. In case of an error the error is raised as an exception.
public static PINV ( NMatrix Mat ) : NMatrix
Mat NMatrix a Matrix object whose pseudoinverse is to be found
return NMatrix

PINV() public static method

Returns the pseudoinverse of a matrix, such that X = PINV(A) produces a matrix 'X' of the same dimensions as A' so that A*X*A = A, X*A*X = X. In case of an error the error is raised as an exception.
public static PINV ( double Mat ) : ].double[
Mat double An array whose pseudoinverse is to be found
return ].double[

PrintMat() public static method

Returns a matrix as a string, so it can be viewed in a multi-text textbox or in a richtextBox (preferred). In case of an error the error is raised as an exception.
public static PrintMat ( NMatrix Mat ) : string
Mat NMatrix The Matrix object to be viewed
return string

PrintMat() public static method

Returns a matrix as a string, so it can be viewed in a multi-text textbox or in a richtextBox (preferred). In case of an error the error is raised as an exception.
public static PrintMat ( double Mat ) : string
Mat double The array to be viewed
return string

Rank() public static method

Returns the rank of a matrix. In case of an error the error is raised as an exception.
public static Rank ( NMatrix Mat ) : int
Mat NMatrix a Matrix object whose rank is to be found
return int

Rank() public static method

Returns the rank of a matrix. In case of an error the error is raised as an exception.
public static Rank ( double Mat ) : int
Mat double An array whose rank is to be found
return int

SVD() public static method

Evaluates the Singular Value Decomposition of a matrix, returns the matrices S, U and V. Such that a given Matrix = U x S x V'. In case of an error the error is raised as an exception. Note: This method is based on the 'Singular Value Decomposition' section of Numerical Recipes in C by William H. Press, Saul A. Teukolsky, William T. Vetterling and Brian P. Flannery, University of Cambridge Press 1992.
public static SVD ( NMatrix Mat, NMatrix &S, NMatrix &U, NMatrix &V ) : void
Mat NMatrix Matrix object whose SVD is to be computed
S NMatrix A Matrix object where the S matrix is returned
U NMatrix A Matrix object where the U matrix is returned
V NMatrix A Matrix object where the V matrix is returned
return void

SVD() public static method

Evaluates the Singular Value Decomposition of a matrix, returns the matrices S, U and V. Such that a given Matrix = U x S x V'. In case of an error the error is raised as an exception. Note: This method is based on the 'Singular Value Decomposition' section of Numerical Recipes in C by William H. Press, Saul A. Teukolsky, William T. Vetterling and Brian P. Flannery, University of Cambridge Press 1992.
public static SVD ( double Mat_, double &S_, double &U_, double &V_ ) : void
Mat_ double Array whose SVD is to be computed
S_ double An array where the S matrix is returned
U_ double An array where the U matrix is returned
V_ double An array where the V matrix is returned
return void

ScalarDivide() public static method

Returns the division of a matrix or a vector (i.e dimension [3,1]) by a scalar quantity. In case of an error the error is raised as an exception.
public static ScalarDivide ( double Value, NMatrix Mat ) : NMatrix
Value double The scalar value to divide the array with
Mat NMatrix Matrix which is to be divided by a scalar
return NMatrix

ScalarDivide() public static method

Returns the division of a matrix or a vector (i.e dimension [3,1]) by a scalar quantity. In case of an error the error is raised as an exception.
public static ScalarDivide ( double Value, double Mat ) : ].double[
Value double The scalar value to divide the array with
Mat double Array which is to be divided by a scalar
return ].double[

ScalarMultiply() public static method

Returns the multiplication of a matrix or a vector (i.e dimension [3,1]) with a scalar quantity. In case of an error the error is raised as an exception.
public static ScalarMultiply ( double Value, NMatrix Mat ) : NMatrix
Value double The scalar value to multiply the array
Mat NMatrix Matrix which is to be multiplied by a scalar
return NMatrix

ScalarMultiply() public static method

Returns the multiplication of a matrix or a vector (i.e dimension [3,1]) with a scalar quantity. In case of an error the error is raised as an exception.
public static ScalarMultiply ( double Value, double Mat ) : ].double[
Value double The scalar value to multiply the array
Mat double Array which is to be multiplied by a scalar
return ].double[

SolveLinear() public static method

Solves a set of n linear equations A.X = B, and returns X, where A is [n,n] and B is [n,1]. In the same manner if you need to compute: inverse(A).B, it is better to use this method instead, as it is much faster. In case of an error the error is raised as an exception. Note: This method is based on the 'LU Decomposition and Its Applications' section of Numerical Recipes in C by William H. Press, Saul A. Teukolsky, William T. Vetterling and Brian P. Flannery, University of Cambridge Press 1992.
public static SolveLinear ( NMatrix MatA, NMatrix MatB ) : NMatrix
MatA NMatrix Matrix object 'A' on the left side of the equations A.X = B
MatB NMatrix Matrix object 'B' on the right side of the equations A.X = B
return NMatrix

SolveLinear() public static method

Solves a set of n linear equations A.X = B, and returns X, where A is [n,n] and B is [n,1]. In the same manner if you need to compute: inverse(A).B, it is better to use this method instead, as it is much faster. In case of an error the error is raised as an exception. Note: This method is based on the 'LU Decomposition and Its Applications' section of Numerical Recipes in C by William H. Press, Saul A. Teukolsky, William T. Vetterling and Brian P. Flannery, University of Cambridge Press 1992.
public static SolveLinear ( double MatA, double MatB ) : ].double[
MatA double The array 'A' on the left side of the equations A.X = B
MatB double The array 'B' on the right side of the equations A.X = B
return ].double[

Subtract() public static method

Returns the difference of two matrices with compatible dimensions. In case of an error the error is raised as an exception.
public static Subtract ( NMatrix Mat1, NMatrix Mat2 ) : NMatrix
Mat1 NMatrix First matrix in the subtraction
Mat2 NMatrix Second matrix in the subtraction
return NMatrix

Subtract() public static method

Returns the difference of two matrices with compatible dimensions. In case of an error the error is raised as an exception.
public static Subtract ( double Mat1, double Mat2 ) : ].double[
Mat1 double First array in the subtraction
Mat2 double Second array in the subtraction
return ].double[

ToString() public method

Returns the matrix as a string, so it can be viewed in a multi-text textbox or in a richtextBox (preferred). In case of an error the error is raised as an exception.
public ToString ( ) : string
return string

Transpose() public static method

Returns the transpose of a matrix. In case of an error the error is raised as an exception.
public static Transpose ( NMatrix Mat ) : NMatrix
Mat NMatrix Matrix object whose transpose is to be found
return NMatrix

Transpose() public static method

Returns the transpose of a matrix. In case of an error the error is raised as an exception.
public static Transpose ( double Mat ) : ].double[
Mat double Array whose transpose is to be found
return ].double[

TryGaussJordanElimination() public static method

public static TryGaussJordanElimination ( NMatrix a, NMatrix b, NMatrix &result ) : bool
a NMatrix
b NMatrix
result NMatrix
return bool

TwoD_2_OneD() public static method

Returns the 1D form of a 2D array. i.e. array with dimension[n,1] is returned as an array with dimension [n]. In case of an error the error is raised as an exception.
public static TwoD_2_OneD ( double Mat ) : double[]
Mat double /// the array to convert, with dimesions [n,1] ///
return double[]

VectorMagnitude() public static method

Returns the magnitude of a vector whose dimension is [3] or [3,1]. In case of an error the error is raised as an exception.
public static VectorMagnitude ( NMatrix V ) : double
V NMatrix Matrix object (dimension [3,1]) whose magnitude is to be found
return double

VectorMagnitude() public static method

Returns the magnitude of a vector whose dimension is [3] or [3,1]. In case of an error the error is raised as an exception.
public static VectorMagnitude ( double V ) : double
V double The vector array (dimension [3]) whose magnitude is to be found
return double

operator() public static method

Returns the multiplication of two matrices with compatible dimensions OR the cross-product of two vectors. In case of an error the error is raised as an exception.
public static operator ( ) : NMatrix
return NMatrix

operator() public static method

Checks if two matrices of equal dimensions are not equal. In case of an error the error is raised as an exception.
public static operator ( ) : bool
return bool

this() public method

Set or get an element from the matrix
public this ( int Row, int Col ) : double
Row int
Col int
return double