BRISC::Matrix::GeneralMatrix Class Reference

.NET GeneralMatrix class. More...

List of all members.

Public Member Functions

 GeneralMatrix (int m, int n)
 Construct an m-by-n matrix of zeros.
 GeneralMatrix (int m, int n, double s)
 Construct an m-by-n constant matrix.
 GeneralMatrix (double[][] A)
 Construct a matrix from a 2-D array.
 GeneralMatrix (double[][] A, int m, int n)
 Construct a matrix quickly without checking arguments.
 GeneralMatrix (double[] vals, int m)
 Construct a matrix from a one-dimensional packed array.
virtual GeneralMatrix Copy ()
 Make a deep copy of a matrix.
virtual double GetElement (int i, int j)
 Get a single element.
virtual GeneralMatrix GetMatrix (int i0, int i1, int j0, int j1)
 Get a submatrix.
virtual GeneralMatrix GetMatrix (int[] r, int[] c)
 Get a submatrix.
virtual GeneralMatrix GetMatrix (int i0, int i1, int[] c)
 Get a submatrix.
virtual GeneralMatrix GetMatrix (int[] r, int j0, int j1)
 Get a submatrix.
virtual void SetElement (int i, int j, double s)
 Set a single element.
virtual void SetMatrix (int i0, int i1, int j0, int j1, GeneralMatrix X)
 Set a submatrix.
virtual void SetMatrix (int[] r, int[] c, GeneralMatrix X)
 Set a submatrix.
virtual void SetMatrix (int[] r, int j0, int j1, GeneralMatrix X)
 Set a submatrix.
virtual void SetMatrix (int i0, int i1, int[] c, GeneralMatrix X)
 Set a submatrix.
virtual GeneralMatrix Transpose ()
 Matrix transpose.
virtual double Norm1 ()
 One norm.
virtual double Norm2 ()
 Two norm.
virtual double NormInf ()
 Infinity norm.
virtual double NormF ()
 Frobenius norm.
virtual GeneralMatrix UnaryMinus ()
 Unary minus.
virtual GeneralMatrix Add (GeneralMatrix B)
 C = A + B.
virtual GeneralMatrix AddEquals (GeneralMatrix B)
 A = A + B.
virtual GeneralMatrix Subtract (GeneralMatrix B)
 C = A - B.
virtual GeneralMatrix SubtractEquals (GeneralMatrix B)
 A = A - B.
virtual GeneralMatrix ArrayMultiply (GeneralMatrix B)
 Element-by-element multiplication, C = A.*B.
virtual GeneralMatrix ArrayMultiplyEquals (GeneralMatrix B)
 Element-by-element multiplication in place, A = A.*B.
virtual GeneralMatrix ArrayRightDivide (GeneralMatrix B)
 Element-by-element right division, C = A./B.
virtual GeneralMatrix ArrayRightDivideEquals (GeneralMatrix B)
 Element-by-element right division in place, A = A./B.
virtual GeneralMatrix ArrayLeftDivide (GeneralMatrix B)
 Element-by-element left division, C = A..
virtual GeneralMatrix ArrayLeftDivideEquals (GeneralMatrix B)
 Element-by-element left division in place, A = A..
virtual GeneralMatrix Multiply (double s)
 Multiply a matrix by a scalar, C = s*A.
virtual GeneralMatrix MultiplyEquals (double s)
 Multiply a matrix by a scalar in place, A = s*A.
virtual GeneralMatrix Multiply (GeneralMatrix B)
 Linear algebraic matrix multiplication, A * B.
virtual LUDecomposition LUD ()
 LU Decomposition.
virtual QRDecomposition QRD ()
 QR Decomposition.
virtual CholeskyDecomposition chol ()
 Cholesky Decomposition.
virtual SingularValueDecomposition SVD ()
 Singular Value Decomposition.
virtual EigenvalueDecomposition Eigen ()
 Eigenvalue Decomposition.
virtual GeneralMatrix Solve (GeneralMatrix B)
 Solve A*X = B.
virtual GeneralMatrix SolveTranspose (GeneralMatrix B)
 Solve X*A = B, which is also A'*X' = B'.
virtual GeneralMatrix Inverse ()
 Matrix inverse or pseudoinverse.
virtual double Determinant ()
 GeneralMatrix determinant.
virtual int Rank ()
 GeneralMatrix rank.
virtual double Condition ()
 Matrix condition (2 norm).
virtual double Trace ()
 Matrix trace.
void Dispose ()
 Do not make this method virtual. A derived class should not be able to override this method.
System.Object Clone ()
 Clone the GeneralMatrix object.

Static Public Member Functions

static GeneralMatrix Create (double[][] A)
 Construct a matrix from a copy of a 2-D array.
static GeneralMatrix operator+ (GeneralMatrix m1, GeneralMatrix m2)
 Addition of matrices.
static GeneralMatrix operator- (GeneralMatrix m1, GeneralMatrix m2)
 Subtraction of matrices.
static GeneralMatrix operator * (GeneralMatrix m1, GeneralMatrix m2)
 Multiplication of matrices.
static GeneralMatrix Random (int m, int n)
 Generate matrix with random elements.
static GeneralMatrix Identity (int m, int n)
 Generate identity matrix.

Properties

virtual double[][] Array [get]
 Access the internal two-dimensional array.
virtual double[][] ArrayCopy [get]
 Copy the internal two-dimensional array.
virtual double[] ColumnPackedCopy [get]
 Make a one-dimensional column packed copy of the internal array.
virtual double[] RowPackedCopy [get]
 Make a one-dimensional row packed copy of the internal array.
virtual int RowDimension [get]
 Get row dimension.
virtual int ColumnDimension [get]
 Get column dimension.

Private Member Functions

void CheckMatrixDimensions (GeneralMatrix B)
 Check if size(A) == size(B) *.
void Dispose (bool disposing)
 Dispose(bool disposing) executes in two distinct scenarios. If disposing equals true, the method has been called directly or indirectly by a user's code. Managed and unmanaged resources can be disposed. If disposing equals false, the method has been called by the runtime from inside the finalizer and you should not reference other objects. Only unmanaged resources can be disposed.
 ~GeneralMatrix ()
 This destructor will run only if the Dispose method does not get called. It gives your base class the opportunity to finalize. Do not provide destructors in types derived from this class.
void ISerializable. GetObjectData (SerializationInfo info, StreamingContext context)
 A method called when serializing this class.

Private Attributes

double[][] A
 Array for internal storage of elements. internal array storage.
int m
 Row and column dimensions. row dimension. column dimension.


Detailed Description

.NET GeneralMatrix class.

Example of use:
Solve a linear system A x = b and compute the residual norm, ||b - A x||.

	    double[][] vals = {{1.,2.,3},{4.,5.,6.},{7.,8.,10.}};
	    GeneralMatrix A = new GeneralMatrix(vals);
	    GeneralMatrix b = GeneralMatrix.Random(3,1);
	    GeneralMatrix x = A.Solve(b);
	    GeneralMatrix r = A.Multiply(x).Subtract(b);
	    double rnorm = r.NormInf();
	    

<author> The MathWorks, Inc. and the National Institute of Standards and Technology. </author> <version> 5 August 1998 </version>


Constructor & Destructor Documentation

BRISC::Matrix::GeneralMatrix::GeneralMatrix ( int  m,
int  n 
) [inline]

Construct an m-by-n matrix of zeros.

Parameters:
m Number of rows.
n Number of colums.

BRISC::Matrix::GeneralMatrix::GeneralMatrix ( int  m,
int  n,
double  s 
) [inline]

Construct an m-by-n constant matrix.

Parameters:
m Number of rows.
n Number of colums.
s Fill the matrix with this scalar value.

BRISC::Matrix::GeneralMatrix::GeneralMatrix ( double  A[][]  )  [inline]

Construct a matrix from a 2-D array.

Parameters:
A Two-dimensional array of doubles.
Exceptions:
System.ArgumentException All rows must have the same length
See also:
Create

BRISC::Matrix::GeneralMatrix::GeneralMatrix ( double  A[][],
int  m,
int  n 
) [inline]

Construct a matrix quickly without checking arguments.

Parameters:
A Two-dimensional array of doubles.
m Number of rows.
n Number of colums.

BRISC::Matrix::GeneralMatrix::GeneralMatrix ( double[]  vals,
int  m 
) [inline]

Construct a matrix from a one-dimensional packed array.

Parameters:
vals One-dimensional array of doubles, packed by columns (ala Fortran).
m Number of rows.
Exceptions:
System.ArgumentException Array length must be a multiple of m.


Member Function Documentation

virtual GeneralMatrix BRISC::Matrix::GeneralMatrix::Add ( GeneralMatrix  B  )  [inline, virtual]

C = A + B.

Parameters:
B another matrix
Returns:
A + B

virtual GeneralMatrix BRISC::Matrix::GeneralMatrix::AddEquals ( GeneralMatrix  B  )  [inline, virtual]

A = A + B.

Parameters:
B another matrix
Returns:
A + B

virtual GeneralMatrix BRISC::Matrix::GeneralMatrix::ArrayLeftDivide ( GeneralMatrix  B  )  [inline, virtual]

Element-by-element left division, C = A..

Parameters:
B another matrix
Returns:
A.

virtual GeneralMatrix BRISC::Matrix::GeneralMatrix::ArrayLeftDivideEquals ( GeneralMatrix  B  )  [inline, virtual]

Element-by-element left division in place, A = A..

Parameters:
B another matrix
Returns:
A.

virtual GeneralMatrix BRISC::Matrix::GeneralMatrix::ArrayMultiply ( GeneralMatrix  B  )  [inline, virtual]

Element-by-element multiplication, C = A.*B.

Parameters:
B another matrix
Returns:
A.*B

virtual GeneralMatrix BRISC::Matrix::GeneralMatrix::ArrayMultiplyEquals ( GeneralMatrix  B  )  [inline, virtual]

Element-by-element multiplication in place, A = A.*B.

Parameters:
B another matrix
Returns:
A.*B

virtual GeneralMatrix BRISC::Matrix::GeneralMatrix::ArrayRightDivide ( GeneralMatrix  B  )  [inline, virtual]

Element-by-element right division, C = A./B.

Parameters:
B another matrix
Returns:
A./B

virtual GeneralMatrix BRISC::Matrix::GeneralMatrix::ArrayRightDivideEquals ( GeneralMatrix  B  )  [inline, virtual]

Element-by-element right division in place, A = A./B.

Parameters:
B another matrix
Returns:
A./B

virtual CholeskyDecomposition BRISC::Matrix::GeneralMatrix::chol (  )  [inline, virtual]

Cholesky Decomposition.

Returns:
CholeskyDecomposition
See also:
CholeskyDecomposition

virtual double BRISC::Matrix::GeneralMatrix::Condition (  )  [inline, virtual]

Matrix condition (2 norm).

Returns:
ratio of largest to smallest singular value.

static GeneralMatrix BRISC::Matrix::GeneralMatrix::Create ( double  A[][]  )  [inline, static]

Construct a matrix from a copy of a 2-D array.

Parameters:
A Two-dimensional array of doubles.
Exceptions:
System.ArgumentException All rows must have the same length

virtual double BRISC::Matrix::GeneralMatrix::Determinant (  )  [inline, virtual]

GeneralMatrix determinant.

Returns:
determinant

void BRISC::Matrix::GeneralMatrix::Dispose ( bool  disposing  )  [inline, private]

Dispose(bool disposing) executes in two distinct scenarios. If disposing equals true, the method has been called directly or indirectly by a user's code. Managed and unmanaged resources can be disposed. If disposing equals false, the method has been called by the runtime from inside the finalizer and you should not reference other objects. Only unmanaged resources can be disposed.

Parameters:
disposing 

virtual EigenvalueDecomposition BRISC::Matrix::GeneralMatrix::Eigen (  )  [inline, virtual]

Eigenvalue Decomposition.

Returns:
EigenvalueDecomposition
See also:
EigenvalueDecomposition

virtual double BRISC::Matrix::GeneralMatrix::GetElement ( int  i,
int  j 
) [inline, virtual]

Get a single element.

Parameters:
i Row index.
j Column index.
Returns:
A(i,j)
Exceptions:
System.IndexOutOfRangeException 

virtual GeneralMatrix BRISC::Matrix::GeneralMatrix::GetMatrix ( int[]  r,
int  j0,
int  j1 
) [inline, virtual]

Get a submatrix.

Parameters:
r Array of row indices.
j0 Initial column index
j1 Final column index
Returns:
A(r(:),j0:j1)
Exceptions:
System.IndexOutOfRangeException Submatrix indices

virtual GeneralMatrix BRISC::Matrix::GeneralMatrix::GetMatrix ( int  i0,
int  i1,
int[]  c 
) [inline, virtual]

Get a submatrix.

Parameters:
i0 Initial row index
i1 Final row index
c Array of column indices.
Returns:
A(i0:i1,c(:))
Exceptions:
System.IndexOutOfRangeException Submatrix indices

virtual GeneralMatrix BRISC::Matrix::GeneralMatrix::GetMatrix ( int[]  r,
int[]  c 
) [inline, virtual]

Get a submatrix.

Parameters:
r Array of row indices.
c Array of column indices.
Returns:
A(r(:),c(:))
Exceptions:
System.IndexOutOfRangeException Submatrix indices

virtual GeneralMatrix BRISC::Matrix::GeneralMatrix::GetMatrix ( int  i0,
int  i1,
int  j0,
int  j1 
) [inline, virtual]

Get a submatrix.

Parameters:
i0 Initial row index
i1 Final row index
j0 Initial column index
j1 Final column index
Returns:
A(i0:i1,j0:j1)
Exceptions:
System.IndexOutOfRangeException Submatrix indices

void ISerializable. BRISC::Matrix::GeneralMatrix::GetObjectData ( SerializationInfo  info,
StreamingContext  context 
) [inline, private]

A method called when serializing this class.

Parameters:
info 
context 

static GeneralMatrix BRISC::Matrix::GeneralMatrix::Identity ( int  m,
int  n 
) [inline, static]

Generate identity matrix.

Parameters:
m Number of rows.
n Number of colums.
Returns:
An m-by-n matrix with ones on the diagonal and zeros elsewhere.

virtual GeneralMatrix BRISC::Matrix::GeneralMatrix::Inverse (  )  [inline, virtual]

Matrix inverse or pseudoinverse.

Returns:
inverse(A) if A is square, pseudoinverse otherwise.

virtual LUDecomposition BRISC::Matrix::GeneralMatrix::LUD (  )  [inline, virtual]

LU Decomposition.

Returns:
LUDecomposition
See also:
LUDecomposition

virtual GeneralMatrix BRISC::Matrix::GeneralMatrix::Multiply ( GeneralMatrix  B  )  [inline, virtual]

Linear algebraic matrix multiplication, A * B.

Parameters:
B another matrix
Returns:
Matrix product, A * B
Exceptions:
System.ArgumentException Matrix inner dimensions must agree.

virtual GeneralMatrix BRISC::Matrix::GeneralMatrix::Multiply ( double  s  )  [inline, virtual]

Multiply a matrix by a scalar, C = s*A.

Parameters:
s scalar
Returns:
s*A

virtual GeneralMatrix BRISC::Matrix::GeneralMatrix::MultiplyEquals ( double  s  )  [inline, virtual]

Multiply a matrix by a scalar in place, A = s*A.

Parameters:
s scalar
Returns:
replace A by s*A

virtual double BRISC::Matrix::GeneralMatrix::Norm1 (  )  [inline, virtual]

One norm.

Returns:
maximum column sum.

virtual double BRISC::Matrix::GeneralMatrix::Norm2 (  )  [inline, virtual]

Two norm.

Returns:
maximum singular value.

virtual double BRISC::Matrix::GeneralMatrix::NormF (  )  [inline, virtual]

Frobenius norm.

Returns:
sqrt of sum of squares of all elements.

virtual double BRISC::Matrix::GeneralMatrix::NormInf (  )  [inline, virtual]

Infinity norm.

Returns:
maximum row sum.

static GeneralMatrix BRISC::Matrix::GeneralMatrix::operator * ( GeneralMatrix  m1,
GeneralMatrix  m2 
) [inline, static]

Multiplication of matrices.

Parameters:
m1 
m2 
Returns:

static GeneralMatrix BRISC::Matrix::GeneralMatrix::operator+ ( GeneralMatrix  m1,
GeneralMatrix  m2 
) [inline, static]

Addition of matrices.

Parameters:
m1 
m2 
Returns:

static GeneralMatrix BRISC::Matrix::GeneralMatrix::operator- ( GeneralMatrix  m1,
GeneralMatrix  m2 
) [inline, static]

Subtraction of matrices.

Parameters:
m1 
m2 
Returns:

virtual QRDecomposition BRISC::Matrix::GeneralMatrix::QRD (  )  [inline, virtual]

QR Decomposition.

Returns:
QRDecomposition
See also:
QRDecomposition

static GeneralMatrix BRISC::Matrix::GeneralMatrix::Random ( int  m,
int  n 
) [inline, static]

Generate matrix with random elements.

Parameters:
m Number of rows.
n Number of colums.
Returns:
An m-by-n matrix with uniformly distributed random elements.

virtual int BRISC::Matrix::GeneralMatrix::Rank (  )  [inline, virtual]

GeneralMatrix rank.

Returns:
effective numerical rank, obtained from SVD.

virtual void BRISC::Matrix::GeneralMatrix::SetElement ( int  i,
int  j,
double  s 
) [inline, virtual]

Set a single element.

Parameters:
i Row index.
j Column index.
s A(i,j).
Exceptions:
System.IndexOutOfRangeException 

virtual void BRISC::Matrix::GeneralMatrix::SetMatrix ( int  i0,
int  i1,
int[]  c,
GeneralMatrix  X 
) [inline, virtual]

Set a submatrix.

Parameters:
i0 Initial row index
i1 Final row index
c Array of column indices.
X A(i0:i1,c(:))
Exceptions:
System.IndexOutOfRangeException Submatrix indices

virtual void BRISC::Matrix::GeneralMatrix::SetMatrix ( int[]  r,
int  j0,
int  j1,
GeneralMatrix  X 
) [inline, virtual]

Set a submatrix.

Parameters:
r Array of row indices.
j0 Initial column index
j1 Final column index
X A(r(:),j0:j1)
Exceptions:
System.IndexOutOfRangeException Submatrix indices

virtual void BRISC::Matrix::GeneralMatrix::SetMatrix ( int[]  r,
int[]  c,
GeneralMatrix  X 
) [inline, virtual]

Set a submatrix.

Parameters:
r Array of row indices.
c Array of column indices.
X A(r(:),c(:))
Exceptions:
System.IndexOutOfRangeException Submatrix indices

virtual void BRISC::Matrix::GeneralMatrix::SetMatrix ( int  i0,
int  i1,
int  j0,
int  j1,
GeneralMatrix  X 
) [inline, virtual]

Set a submatrix.

Parameters:
i0 Initial row index
i1 Final row index
j0 Initial column index
j1 Final column index
X A(i0:i1,j0:j1)
Exceptions:
System.IndexOutOfRangeException Submatrix indices

virtual GeneralMatrix BRISC::Matrix::GeneralMatrix::Solve ( GeneralMatrix  B  )  [inline, virtual]

Solve A*X = B.

Parameters:
B right hand side
Returns:
solution if A is square, least squares solution otherwise

virtual GeneralMatrix BRISC::Matrix::GeneralMatrix::SolveTranspose ( GeneralMatrix  B  )  [inline, virtual]

Solve X*A = B, which is also A'*X' = B'.

Parameters:
B right hand side
Returns:
solution if A is square, least squares solution otherwise.

virtual GeneralMatrix BRISC::Matrix::GeneralMatrix::Subtract ( GeneralMatrix  B  )  [inline, virtual]

C = A - B.

Parameters:
B another matrix
Returns:
A - B

virtual GeneralMatrix BRISC::Matrix::GeneralMatrix::SubtractEquals ( GeneralMatrix  B  )  [inline, virtual]

A = A - B.

Parameters:
B another matrix
Returns:
A - B

virtual SingularValueDecomposition BRISC::Matrix::GeneralMatrix::SVD (  )  [inline, virtual]

Singular Value Decomposition.

Returns:
SingularValueDecomposition
See also:
SingularValueDecomposition

virtual double BRISC::Matrix::GeneralMatrix::Trace (  )  [inline, virtual]

Matrix trace.

Returns:
sum of the diagonal elements.

virtual GeneralMatrix BRISC::Matrix::GeneralMatrix::Transpose (  )  [inline, virtual]

Matrix transpose.

Returns:
A'

virtual GeneralMatrix BRISC::Matrix::GeneralMatrix::UnaryMinus (  )  [inline, virtual]

Unary minus.

Returns:
-A


Property Documentation

virtual double [][] BRISC::Matrix::GeneralMatrix::Array [get]

Access the internal two-dimensional array.

Returns:
Pointer to the two-dimensional array of matrix elements.

virtual double [][] BRISC::Matrix::GeneralMatrix::ArrayCopy [get]

Copy the internal two-dimensional array.

Returns:
Two-dimensional array copy of matrix elements.

virtual int BRISC::Matrix::GeneralMatrix::ColumnDimension [get]

Get column dimension.

Returns:
n, the number of columns.

virtual double [] BRISC::Matrix::GeneralMatrix::ColumnPackedCopy [get]

Make a one-dimensional column packed copy of the internal array.

Returns:
Matrix elements packed in a one-dimensional array by columns.

virtual int BRISC::Matrix::GeneralMatrix::RowDimension [get]

Get row dimension.

Returns:
m, the number of rows.

virtual double [] BRISC::Matrix::GeneralMatrix::RowPackedCopy [get]

Make a one-dimensional row packed copy of the internal array.

Returns:
Matrix elements packed in a one-dimensional array by rows.


The documentation for this class was generated from the following file:
Generated on Wed Aug 16 17:13:33 2006 by  doxygen 1.4.7