Represents an arbitrarily sized matrix of double-precision floating point numbers. If you are working with a 4x4 matrix, then you may want to use the Transform class instead.

Constructors

Matrix

#Since v5.0
Initializes a new instance of the matrix.
public Matrix(
rowCount,
A positive integer, or 0, for the number of rows.
columnCount
A positive integer, or 0, for the number of columns.
)
ArgumentOutOfRangeExceptionIf either rowCount, or columnCount or both are negative.

Matrix

#
Protected constructor for internal use.
protected Matrix(
info,
Serialization data.
context
Serialization stream.
)

Matrix

#Since v5.0
Initializes a new instance of the matrix based on a 4x4 matrix Transform.
public Matrix(
xform
A 4x4 matrix to copy from.
)

Finalizer

~Matrix

#
Passively reclaims unmanaged resources when the class user did not explicitly call Dispose().
~Matrix()

Properties

ColumnCount

#Since v5.0
Gets the amount of columns.
public int ColumnCount { get; }

IsColumnOrthogonal

#Since v5.0
Gets a value indicating whether the matrix is column orthogonal.
public bool IsColumnOrthogonal { get; }

IsColumnOrthoNormal

#Since v5.0
Gets a value indicating whether the matrix is column orthonormal.
public bool IsColumnOrthoNormal { get; }

IsRowOrthogonal

#Since v5.0
Gets a value indicating whether the matrix is row orthogonal.
public bool IsRowOrthogonal { get; }

IsRowOrthoNormal

#Since v5.0
Gets a value indicating whether the matrix is row orthonormal.
public bool IsRowOrthoNormal { get; }

IsSquare

#Since v5.0
Gets a value indicating whether this matrix has the same number of rows and columns. 0x0 matrices are not considered square.
public bool IsSquare { get; }

IsValid

#Since v5.0
Gets a value indicating whether this matrix is valid.
public bool IsValid { get; }

RowCount

#Since v5.0
Gets the amount of rows.
public int RowCount { get; }

Indexers

this[]

#
Gets or sets the matrix value at the given row and column indices.
public double this[
row,
Index of row to access.
column
Index of column to access.
] { get; set; }
The new value at [row, column].
The value at [row, column].

Methods

BackSolve

#Since v5.0
Solves M*x=b where M is upper triangular with a unit diagonal and b is a column of values.
public double[] BackSolve(
zeroTolerance,
(>=0.0) used to test for "zero" values in b in under determined systems of equations.
b
The values in B[RowCount],...,B[B.Length-1] are tested to make sure they are within "zeroTolerance".
)
Array of length ColumnCount on success. null on error.

BackSolvePoints

#Since v5.0
Solves M*x=b where M is upper triangular with a unit diagonal and b is a column of 3d points.
public Point3d[] BackSolvePoints(
zeroTolerance,
(>=0.0) used to test for "zero" values in b in under determined systems of equations.
b
The values in B[RowCount],...,B[B.Length-1] are tested to make sure they are "zero".
)
Array of length ColumnCount on success. null on error.

Dispose

#Since v5.0
Actively reclaims unmanaged resources that this instance uses.
public void Dispose()

Dispose

#
For derived class implementers.

This method is called with argument true when class user calls Dispose(), while with argument false when the Garbage Collector invokes the finalizer, or Finalize() method.

You must reclaim all used unmanaged resources in both cases, and can use this chance to call Dispose on disposable fields if the argument is true.

Also, you must call the base virtual method within your overriding method.

protected virtual void Dispose(
disposing
true if the call comes from the Dispose() method; false if it comes from the Garbage Collector finalizer.
)

Duplicate

#Since v5.1
Create a duplicate of this matrix.
[ConstOperation] public Matrix Duplicate()
An exact duplicate of this matrix.

GetHashCode

#
Gets the hash code for this matrix. The hash code will change when the matrix changes so you cannot change matrices while they are stored in hash tables.
[ConstOperation] public override int GetHashCode()
Hash code.

GetObjectData

#Since v9.0
Populates a System.Runtime.Serialization.SerializationInfo with the data needed to serialize the target object.
[ConstOperation] public virtual void GetObjectData(
info,
The System.Runtime.Serialization.SerializationInfo to populate with data.
context
The destination (see System.Runtime.Serialization.StreamingContext) for this serialization.
)

Invert

#Since v5.0
Modifies this matrix to become its own inverse.

Matrix might be non-invertible (singular) and the return value will be false.

public bool Invert(
zeroTolerance
The admitted tolerance for 0.
)
true if operation succeeded; otherwise false.

RowReduce

#Since v5.0
Row reduces a matrix as the first step in solving M*X=b where b is a column of values.
public int RowReduce(
zeroTolerance,
(>=0.0) zero tolerance for pivot test. If the absolute value of a pivot is <= zero_tolerance, then the pivot is assumed to be zero.
b,
an array of RowCount values that is row reduced with the matrix.
out double
pivot
the value of the smallest pivot is returned here.
)
Remarks: The matrix itself is row reduced so that the result is an upper triangular matrix with 1's on the diagonal.
Rank of the matrix.

RowReduce

#Since v5.0
Row reduces a matrix to calculate rank and determinant.
public int RowReduce(
zeroTolerance,
(>=0.0) zero tolerance for pivot test. If a the absolute value of a pivot is <= zeroTolerance, then the pivot is assumed to be zero.
out double
determinant,
value of determinant is returned here.
out double
pivot
value of the smallest pivot is returned here.
)
Remarks: The matrix itself is row reduced so that the result is an upper triangular matrix with 1's on the diagonal.
Rank of the matrix.

RowReduce

#Since v5.0
Row reduces a matrix as the first step in solving M*X=b where b is a column of 3d points.
public int RowReduce(
zeroTolerance,
(>=0.0) zero tolerance for pivot test. If the absolute value of a pivot is <= zero_tolerance, then the pivot is assumed to be zero.
b,
An array of RowCount 3d points that is row reduced with the matrix.
out double
pivot
The value of the smallest pivot is returned here.
)
Remarks: The matrix itself is row reduced so that the result is an upper triangular matrix with 1's on the diagonal.
Rank of the matrix.

Scale

#Since v5.0
Modifies the current matrix by multiplying its values by a number.
public void Scale(
s
A scale factor.
)

SetDiagonal

#Since v5.0
Sets diagonal value and zeros off all non-diagonal values.
public void SetDiagonal(
d
The new diagonal value.
)

SwapColumns

#Since v5.0
Exchanges two columns.
public bool SwapColumns(
columnA,
A first column.
columnB
Another column.
)
true if operation succeeded; otherwise false.

SwapRows

#Since v5.0
Exchanges two rows.
public bool SwapRows(
rowA,
A first row.
rowB
Another row.
)
true if operation succeeded; otherwise false.

Transpose

#Since v5.0
Modifies this matrix to be its transpose.

This is like swapping rows with columns.

http://en.wikipedia.org/wiki/Transpose

public bool Transpose()
true if operation succeeded; otherwise false.

Zero

#Since v5.0
Sets all values inside the matrix to zero.
public void Zero()

Operators

OperationResultDescription
Matrix+MatrixMatrixAdds two matrices and returns a new sum matrix.
Matrix*MatrixMatrixMultiplies two matrices and returns a new product matrix.