Struct MatrixValue
- Namespace
- xFunc.Maths.Expressions.Matrices
- Assembly
- xFunc.Maths.dll
Represent the Matrix value.
public readonly struct MatrixValue : IEquatable<MatrixValue>
- Implements
- Inherited Members
Properties
Columns
Gets the count of columns.
public int Columns { get; }
Property Value
IsSquare
Gets a value indicating whether matrix is square.
public bool IsSquare { get; }
Property Value
this[int]
Gets the VectorValue at the specified index.
public VectorValue this[int index] { get; }
Parameters
index
intThe index.
Property Value
- VectorValue
The VectorValue.
Rows
Gets the count of rows.
public int Rows { get; }
Property Value
Methods
Add(MatrixValue, MatrixValue)
Adds the right
matrix to the left
matrix.
public static MatrixValue Add(MatrixValue left, MatrixValue right)
Parameters
left
MatrixValueThe left matrix.
right
MatrixValueThe right matrix.
Returns
- MatrixValue
The sum of matrices.
Exceptions
- ArgumentException
The size of matrices is invalid.
Create(VectorValue)
Creates a new instance of MatrixValue.
public static MatrixValue Create(VectorValue value)
Parameters
value
VectorValueThe item of a new matrix.
Returns
- MatrixValue
The matrix.
Create(VectorValue[])
Creates a new instance of MatrixValue.
public static MatrixValue Create(VectorValue[] vectors)
Parameters
vectors
VectorValue[]The array.
Returns
- MatrixValue
The matrix.
Create(NumberValue)
Creates a new instance of MatrixValue.
public static MatrixValue Create(NumberValue value)
Parameters
value
NumberValueThe item of a new matrix.
Returns
- MatrixValue
The matrix.
Create(NumberValue[][])
Creates a new instance of MatrixValue.
public static MatrixValue Create(NumberValue[][] values)
Parameters
values
NumberValue[][]The array.
Returns
- MatrixValue
The matrix.
Determinant(MatrixValue)
Calculates a determinant of specified matrix.
public static NumberValue Determinant(MatrixValue matrix)
Parameters
matrix
MatrixValueThe matrix.
Returns
- NumberValue
The determinant of matrix.
Exceptions
- ArgumentException
The size of matrices is invalid.
Equals(object?)
Indicates whether this instance and a specified object are equal.
public override bool Equals(object? obj)
Parameters
obj
objectThe object to compare with the current instance.
Returns
- bool
true if
obj
and this instance are the same type and represent the same value; otherwise, false.
Equals(MatrixValue)
Indicates whether the current object is equal to another object of the same type.
public bool Equals(MatrixValue other)
Parameters
other
MatrixValueAn object to compare with this object.
Returns
GetHashCode()
Returns the hash code for this instance.
public override int GetHashCode()
Returns
- int
A 32-bit signed integer that is the hash code for this instance.
Inverse(MatrixValue)
Inverts a matrix.
public static MatrixValue Inverse(MatrixValue matrix)
Parameters
matrix
MatrixValueThe matrix.
Returns
- MatrixValue
An inverse matrix.
Mul(MatrixValue, MatrixValue)
Multiplies the left
matrix by the right
matrix.
public static MatrixValue Mul(MatrixValue left, MatrixValue right)
Parameters
left
MatrixValueThe left matrix.
right
MatrixValueThe right matrix.
Returns
- MatrixValue
The product of matrices.
Exceptions
- ArgumentException
The size of matrices is invalid.
Mul(MatrixValue, VectorValue)
Multiplies the left
matrix by the right
vector.
public static MatrixValue Mul(MatrixValue left, VectorValue right)
Parameters
left
MatrixValueThe left matrix.
right
VectorValueThe right vector.
Returns
- MatrixValue
The product of matrices.
Exceptions
- ArgumentException
The size of matrices is invalid.
Mul(MatrixValue, NumberValue)
Multiplies matrix
by number
.
public static MatrixValue Mul(MatrixValue matrix, NumberValue number)
Parameters
matrix
MatrixValueThe matrix.
number
NumberValueThe number.
Returns
- MatrixValue
The product of matrix and number.
Mul(VectorValue, MatrixValue)
Multiplies the left
vector by the right
matrix.
public static MatrixValue Mul(VectorValue left, MatrixValue right)
Parameters
left
VectorValueThe left vector.
right
MatrixValueThe right matrix.
Returns
- MatrixValue
The product of matrices.
Exceptions
- ArgumentException
The size of matrices is invalid.
Sub(MatrixValue, MatrixValue)
Subtracts the right
matrix from the left
matrix.
public static MatrixValue Sub(MatrixValue left, MatrixValue right)
Parameters
left
MatrixValueThe left matrix.
right
MatrixValueThe right matrix.
Returns
- MatrixValue
The difference of matrices.
Exceptions
- ArgumentException
The size of matrices is invalid.
ToArray()
Converts the current matrix to a two dimensional array.
public NumberValue[][] ToArray()
Returns
- NumberValue[][]
The array.
ToString()
Returns the fully qualified type name of this instance.
public override string ToString()
Returns
- string
The fully qualified type name.
Transpose(MatrixValue)
Transposes the specified matrix.
public static MatrixValue Transpose(MatrixValue matrix)
Parameters
matrix
MatrixValueThe matrix.
Returns
- MatrixValue
The transposed matrix.
Operators
operator +(MatrixValue, MatrixValue)
Adds two objects of MatrixValue.
public static MatrixValue operator +(MatrixValue left, MatrixValue right)
Parameters
left
MatrixValueThe first object to add.
right
MatrixValueThe second object to add.
Returns
- MatrixValue
An object that is the sum of
left
andright
.
operator ==(MatrixValue, MatrixValue)
Determines whether two specified instances of MatrixValue are equal.
public static bool operator ==(MatrixValue left, MatrixValue right)
Parameters
left
MatrixValueThe first object to compare.
right
MatrixValueThe second object to compare.
Returns
- bool
true
ifleft
is equal toright
; otherwise,false
.
operator !=(MatrixValue, MatrixValue)
Determines whether two specified instances of MatrixValue are not equal.
public static bool operator !=(MatrixValue left, MatrixValue right)
Parameters
left
MatrixValueThe first object to compare.
right
MatrixValueThe second object to compare.
Returns
- bool
true
ifleft
is not equal toright
; otherwise,false
.
operator *(MatrixValue, MatrixValue)
Multiplies two objects of MatrixValue.
public static MatrixValue operator *(MatrixValue left, MatrixValue right)
Parameters
left
MatrixValueThe first object to multiply.
right
MatrixValueThe second object to multiply.
Returns
- MatrixValue
An object that is the product of
left
andright
.
operator *(MatrixValue, VectorValue)
Multiplies MatrixValue and VectorValue.
public static MatrixValue operator *(MatrixValue left, VectorValue right)
Parameters
left
MatrixValueThe first object to multiply.
right
VectorValueThe second object to multiply.
Returns
- MatrixValue
An object that is the product of
left
andright
.
operator *(MatrixValue, NumberValue)
Multiplies MatrixValue and NumberValue.
public static MatrixValue operator *(MatrixValue left, NumberValue right)
Parameters
left
MatrixValueThe first object to multiply.
right
NumberValueThe second object to multiply.
Returns
- MatrixValue
An object that is the product of
left
andright
.
operator *(VectorValue, MatrixValue)
Multiplies VectorValue and MatrixValue.
public static MatrixValue operator *(VectorValue left, MatrixValue right)
Parameters
left
VectorValueThe first object to multiply.
right
MatrixValueThe second object to multiply.
Returns
- MatrixValue
An object that is the product of
left
andright
.
operator -(MatrixValue, MatrixValue)
Subtracts two objects of MatrixValue.
public static MatrixValue operator -(MatrixValue left, MatrixValue right)
Parameters
left
MatrixValueThe first object to sub.
right
MatrixValueThe second object to sub.
Returns
- MatrixValue
An object that is the difference of
left
andright
.