Class Matrix
- Namespace
- NominalSystems.Maths
- Assembly
- NominalSystems.Maths.dll
[NominalSystems] A column-major matrix class
public sealed class Matrix : IEnumerable<double>, IEnumerable
- Inheritance
-
Matrix
- Implements
Constructors
Matrix()
Default constructor
public Matrix()
Matrix(IMatrix)
Default constructor
public Matrix(IMatrix a)
Parameters
a
IMatrixa matrix
Matrix(Matrix)
Default constructor
public Matrix(Matrix a)
Parameters
a
Matrixa matrix
Matrix(IEnumerable<Vector>)
public Matrix(IEnumerable<Vector> rows)
Parameters
rows
IEnumerable<Vector>
Matrix(double[,])
Creates a Matrix from a 2D array
public Matrix(double[,] array)
Parameters
array
double[,]A 2D array
Matrix(int, int)
Default constructor
public Matrix(int r, int c)
Parameters
Matrix(int, int, IVector)
Default constructor
public Matrix(int r, int c, IVector a)
Parameters
Matrix(int, int, double)
Default constructor
public Matrix(int r, int c, double x)
Parameters
Matrix(uint, uint)
Default constructor
public Matrix(uint r, uint c)
Parameters
Fields
Values
The 'Matrix' values
public readonly double[] Values
Field Value
- double[]
Properties
Absolute
Returns the absolute value of each value in the matrix
public Matrix Absolute { get; }
Property Value
CholeskyFactor
Returns the Cholesky Factor matrix
public Matrix CholeskyFactor { get; }
Property Value
Cols
The total column size
public uint Cols { get; }
Property Value
Determinant
Returns the determinant for this matrix
public double Determinant { get; }
Property Value
Inverse
Returns the inverse of a 'Matrix'
public Matrix Inverse { get; }
Property Value
this[int]
Get/Set 'Matrix' values
public double this[int i] { get; set; }
Parameters
i
intindex
Property Value
this[int, int]
Get/Set 'Matrix' values
public double this[int r, int c] { get; set; }
Parameters
Property Value
this[uint]
Get/Set 'Matrix' values
public double this[uint i] { get; set; }
Parameters
i
uintindex
Property Value
this[uint, uint]
Get/Set 'Matrix' values
public double this[uint r, uint c] { get; set; }
Parameters
Property Value
Rows
The total row size
public uint Rows { get; }
Property Value
Transpose
Returns the Transposed matrix
public Matrix Transpose { get; }
Property Value
UpperTriangularRFactor
Returns the upper triangular R factor
public Matrix UpperTriangularRFactor { get; }
Property Value
Methods
CoeffDivide(Matrix, Matrix)
'Matrix' / 'Matrix' = 'Matrix' This is a coefficient divide
public static Matrix CoeffDivide(Matrix a, Matrix b)
Parameters
Returns
CoeffMultiply(Matrix, Matrix)
'Matrix' * 'Matrix' = 'Matrix' This is a coefficient multiply
public static Matrix CoeffMultiply(Matrix a, Matrix b)
Parameters
Returns
Equals(object)
public override bool Equals(object obj)
Parameters
obj
object
Returns
Equals(object, double)
Determine whether the specified object is equal to the current matrix, with some specified precision
public bool Equals(object obj, double precision)
Parameters
obj
objectThe object to compare with the current object
precision
doubleThe precision within which values are considered equal
Returns
- bool
true if the specified object is equal to the current object; otherwise, false
GetColumn(int)
Get 'Matrix' column at index
public Vector GetColumn(int index)
Parameters
index
intcolumn index
Returns
GetEnumerator()
public IEnumerator<double> GetEnumerator()
Returns
GetHashCode()
public override int GetHashCode()
Returns
GetRow(int)
Get 'Matrix' row at index
public Vector GetRow(int index)
Parameters
index
introw index
Returns
GetRow(uint)
Get 'Matrix' row at index
public Vector GetRow(uint index)
Parameters
index
uintrow index
Returns
GetSubMatrix(int, int, int, int)
THIS FUNCTION NEEDS TO BE IMPROVED...
public Matrix GetSubMatrix(int row_index, int row_count, int col_index, int col_count)
Parameters
row_index
intthe row index
row_count
intthe row count
col_index
intthe column index
col_count
intthe column count
Returns
IsZero()
Is 'Matrix' all zeros
public bool IsZero()
Returns
Map(Matrix, Func<double, double, double>)
Map a 'Matrix' value into this matrix
public void Map(Matrix a, Func<double, double, double> func)
Parameters
Map(Func<double, double>)
Map all value in this matrix
public void Map(Func<double, double> func)
Parameters
Map(Func<double, int, double>)
Map all value in this matrix
public void Map(Func<double, int, double> func)
Parameters
Map(Func<double, int, int, double>)
Map all value in this matrix
public void Map(Func<double, int, int, double> func)
Parameters
SetColumn(int, Vector)
Set 'Matrix' column data at index
public void SetColumn(int index, Vector value)
Parameters
SetIdentity(double)
Set the matrix identity to some double. Default value is 1.0.
public void SetIdentity(double value = 1)
Parameters
value
doubleValue to set on Matrix diagonal
SetRow(int, Vector)
Set 'Matrix' row data at index
public void SetRow(int index, Vector value)
Parameters
SetSubMatrix(int, int, int, int, Matrix)
THIS FUNCTION NEEDS TO BE IMPROVED...
public void SetSubMatrix(int row_index, int row_count, int col_index, int col_count, Matrix m)
Parameters
row_index
intthe row index
row_count
intthe row count
col_index
intthe column index
col_count
intthe column count
m
Matrixthe value to set
ToString()
public override string ToString()
Returns
ToString(string)
public string ToString(string format)
Parameters
format
string
Returns
Operators
operator +(Matrix, Matrix)
Returns the addition of a 'Matrix' with a 'Matrix'
public static Matrix operator +(Matrix a, Matrix b)
Parameters
Returns
operator +(Matrix, double)
Returns the addition of a 'double' with a 'Matrix'
public static Matrix operator +(Matrix a, double b)
Parameters
Returns
operator +(double, Matrix)
Returns the addition of a 'Matrix' with a 'double'
public static Matrix operator +(double a, Matrix b)
Parameters
Returns
operator /(Matrix, double)
Returns the division of a 'double' with a 'Matrix'
public static Matrix operator /(Matrix a, double b)
Parameters
Returns
operator /(double, Matrix)
Returns the division of a 'Matrix' with a 'double'
public static Matrix operator /(double a, Matrix b)
Parameters
Returns
operator ==(Matrix, Matrix)
Returns true if 'Matrix' is equal to 'Matrix'
public static bool operator ==(Matrix a, Matrix b)
Parameters
Returns
operator ==(Matrix, double)
Returns true if 'Matrix' is equal to 'double'
public static bool operator ==(Matrix a, double b)
Parameters
Returns
operator ==(double, Matrix)
Returns true if 'double' is equal to 'Matrix'
public static bool operator ==(double a, Matrix b)
Parameters
Returns
explicit operator Matrix(Vector3)
Casts a vector3 to a matrix as a column vector
public static explicit operator Matrix(Vector3 a)
Parameters
a
Vector3The vector3
Returns
operator >(Matrix, Matrix)
Returns true if 'Matrix' is greater than 'Matrix'
public static bool operator >(Matrix a, Matrix b)
Parameters
Returns
operator >(Matrix, double)
Returns true if 'Matrix' is greater than 'double'
public static bool operator >(Matrix a, double b)
Parameters
Returns
operator >(double, Matrix)
Returns true if 'double' is greater than 'Matrix'
public static bool operator >(double a, Matrix b)
Parameters
Returns
operator >=(Matrix, Matrix)
Returns true if 'Matrix' is greater than or equal to 'Matrix'
public static bool operator >=(Matrix a, Matrix b)
Parameters
Returns
operator >=(Matrix, double)
Returns true if 'Matrix' is greater than or equal to 'double'
public static bool operator >=(Matrix a, double b)
Parameters
Returns
operator >=(double, Matrix)
Returns true if 'double' is greater than or equal to 'Matrix'
public static bool operator >=(double a, Matrix b)
Parameters
Returns
implicit operator Vector(Matrix)
Implicit cast 'Matrix' to 'Vector'
public static implicit operator Vector(Matrix a)
Parameters
a
Matrix
Returns
implicit operator Matrix(Matrix3)
Implicit cast 'Matrix3' to 'Matrix'
public static implicit operator Matrix(Matrix3 a)
Parameters
a
Matrix3
Returns
implicit operator Matrix(Matrix4)
Implicit cast 'Matrix4' to 'Vector'
public static implicit operator Matrix(Matrix4 a)
Parameters
a
Matrix4
Returns
operator !=(Matrix, Matrix)
Returns true if 'Matrix' is not equal to 'Matrix'
public static bool operator !=(Matrix a, Matrix b)
Parameters
Returns
operator !=(Matrix, double)
Returns true if 'Matrix' is not equal to 'double'
public static bool operator !=(Matrix a, double b)
Parameters
Returns
operator !=(double, Matrix)
Returns true if 'double' is not equal to 'Matrix'
public static bool operator !=(double a, Matrix b)
Parameters
Returns
operator <(Matrix, Matrix)
Returns true if 'Matrix' is less than 'Matrix'
public static bool operator <(Matrix a, Matrix b)
Parameters
Returns
operator <(Matrix, double)
Returns true if 'Matrix' is less than 'double'
public static bool operator <(Matrix a, double b)
Parameters
Returns
operator <(double, Matrix)
Returns true if 'double' is less than 'Matrix'
public static bool operator <(double a, Matrix b)
Parameters
Returns
operator <=(Matrix, Matrix)
Returns true if 'Matrix' is less than or equal to 'Matrix'
public static bool operator <=(Matrix a, Matrix b)
Parameters
Returns
operator <=(Matrix, double)
Returns true if 'Matrix' is less than or equal to 'double'
public static bool operator <=(Matrix a, double b)
Parameters
Returns
operator <=(double, Matrix)
Returns true if 'double' is less than or equal to 'Matrix'
public static bool operator <=(double a, Matrix b)
Parameters
Returns
operator *(Matrix, Matrix)
Returns the multiplication of a 'Matrix' with a 'Matrix'
public static Matrix operator *(Matrix a, Matrix b)
Parameters
Returns
operator *(Matrix, Vector)
public static Vector operator *(Matrix a, Vector b)
Parameters
Returns
operator *(Matrix, double)
Returns the multiplication of a 'Matrix' with a 'double'
public static Matrix operator *(Matrix a, double b)
Parameters
Returns
operator *(Vector, Matrix)
Returns the multiplication of a 'Vector' with a 'Matrix'
public static Vector operator *(Vector a, Matrix b)
Parameters
Returns
operator *(double, Matrix)
Returns the multiplication of a 'double' with a 'Matrix'
public static Matrix operator *(double a, Matrix b)
Parameters
Returns
operator -(Matrix, Matrix)
Returns the subtraction of a 'Matrix' with a 'Matrix'
public static Matrix operator -(Matrix a, Matrix b)
Parameters
Returns
operator -(Matrix, double)
Returns the subtraction of a 'Matrix' with a 'double'
public static Matrix operator -(Matrix a, double b)
Parameters
Returns
operator -(double, Matrix)
Returns the subtraction of a 'double' with a 'Matrix'
public static Matrix operator -(double a, Matrix b)
Parameters
Returns
operator -(Matrix)
Returns the negation of a 'Matrix'
public static Matrix operator -(Matrix a)
Parameters
a
Matrix