Class Matrix2x2D
- Namespace
- VirtualLabAPI.Core.Numerics
- Assembly
- VirtualLabAPI.dll
A 2 × 2 matrix with real-valued entries.
[Serializable]
public class Matrix2x2D : SerializableObjectBase, IEquatable<IObjectBase>, ICloneable
- Inheritance
-
ObjectBaseSerializableObjectBaseMatrix2x2D
- Implements
-
IEquatable<IObjectBase>
- Inherited Members
Constructors
Matrix2x2D()
Constructor which creates an empty (all zero values) 2×2-Matrix.
public Matrix2x2D()
Matrix2x2D(double)
Constructor for a diagonal matrix with a constant on the diagonal.
public Matrix2x2D(double c)
Parameters
cdoubleConstant diagonal value.
Matrix2x2D(double, double, double, double)
initializes a Matrix2x2D with 4 double values.
public Matrix2x2D(double a1, double a2, double a3, double a4)
Parameters
a1doubleElement [row, col] = (0, 0)
a2doubleElement [row, col] = (0, 1)
a3doubleElement [row, col] = (1, 0)
a4doubleElement [row, col] = (1, 1)
Matrix2x2D(Matrix2x2D)
Copy constructor.
public Matrix2x2D(Matrix2x2D matC)
Parameters
matCMatrix2x2DMatrix2x2D to be copied.
Fields
IdentityMatrix
The identity matrix.
public static readonly Matrix2x2D IdentityMatrix
Field Value
Properties
this[int, int]
Gets or sets a certain matrix element.
public double this[int row, int col] { get; set; }
Parameters
Property Value
- double
The selected matrix element.
Exceptions
- ArgumentOutOfRangeException
At least one of the two given indices is out of range.
Methods
Clone()
Creates a new object that is a copy of the current instance.
public override object Clone()
Returns
- object
A new object that is a copy of this instance.
Determinant()
Calculates the determinant of the given Matrix2x2D-object
public double Determinant()
Returns
- double
The determinant.
Equals(object, EqualityIntent)
Determines whether the specified object is equal to this instance.
public override bool Equals(object matrix, EqualityIntent equalityIntent)
Parameters
matrixobjectequalityIntentEqualityIntentDefines what kind of equality you want to check when comparing two objects, for example all values or physical equality.
Returns
GetHashCode()
Returns a hash code for this instance.
public override int GetHashCode()
Returns
- int
A hash code for this instance, suitable for use in hashing algorithms and data structures like a hash table.
GetInverse()
Calculates the inverse matrix of this one.
public Matrix2x2D GetInverse()
Returns
- Matrix2x2D
The inverse matrix.
InverseMatrix2x2D(Matrix2x2D)
Inverts the given matrix.
public static Matrix2x2D InverseMatrix2x2D(Matrix2x2D mat)
Parameters
matMatrix2x2D
Returns
- Matrix2x2D
The inverse matrix.
RotationMatrix(double)
Calculates a rotation matrix within the ℝ². If the rotation angle is positive a rotation in positive sense (counterclockwise) is done.
public static Matrix2x2D RotationMatrix(double rotAngle2D)
Parameters
rotAngle2DdoubleThe rotation angle in radians.
Returns
- Matrix2x2D
The rotation matrix.
ToString()
Returns an output string.
public override string ToString()
Returns
- string
Matrix as string in two rows.
ToString(int)
Returns an output string.
public string ToString(int digits)
Parameters
digitsintNumber of digits for the matrix entries.
Returns
- string
Matrix as string in two rows.
ToString(int, PhysicalProperty[])
Returns an output string.
public string ToString(int digits, PhysicalProperty[] physicalProperties)
Parameters
digitsintNumber of digits for the matrix entries.
physicalPropertiesPhysicalProperty[]Physical properties of the matrix entries.
Returns
- string
Matrix as string in two rows.
Operators
operator +(Matrix2x2D, Matrix2x2D)
Adds the elements of two Matrix2x2D objects.
public static Matrix2x2D operator +(Matrix2x2D a, Matrix2x2D b)
Parameters
aMatrix2x2DThe first matrix.
bMatrix2x2DThe second matrix.
Returns
- Matrix2x2D
The sum of the two matrices.
operator ==(Matrix2x2D, Matrix2x2D)
Compares two matrices. Two matrices are equal if they are equal in all elements.
public static bool operator ==(Matrix2x2D a, Matrix2x2D b)
Parameters
aMatrix2x2DThe first matrix.
bMatrix2x2DThe second matrix.
Returns
operator !=(Matrix2x2D, Matrix2x2D)
Checks two matrices for inequality.
public static bool operator !=(Matrix2x2D a, Matrix2x2D b)
Parameters
aMatrix2x2DThe first matrix.
bMatrix2x2DThe second matrix.
Returns
operator *(double, Matrix2x2D)
Multiplies a scalar with a Matrix2x2D.
public static Matrix2x2D operator *(double b, Matrix2x2D a)
Parameters
bdoubleThe scalar.
aMatrix2x2DThe matrix.
Returns
- Matrix2x2D
The product.
operator *(Matrix2x2D, double)
Multiplies a Matrix2x2D with a scalar.
public static Matrix2x2D operator *(Matrix2x2D a, double b)
Parameters
aMatrix2x2DThe matrix.
bdoubleThe scalar.
Returns
- Matrix2x2D
The product.
operator *(Matrix2x2D, Matrix2x2D)
Multiplies two Matrix2x2D objects.
public static Matrix2x2D operator *(Matrix2x2D a, Matrix2x2D b)
Parameters
aMatrix2x2DThe first matrix
bMatrix2x2DThe second matrix
Returns
- Matrix2x2D
The matrix product of the two matrices.
operator *(Matrix2x2D, VectorD)
Multiplies a Matrix with an 2-dimensional vector (A*Vec).
public static VectorD operator *(Matrix2x2D a, VectorD vec)
Parameters
aMatrix2x2D2×2 matrix.
vecVectorDVector.
Returns
- VectorD
The resulting vector.
operator -(Matrix2x2D, Matrix2x2D)
Subtracts the elements of two Matrix2x2D objects.
public static Matrix2x2D operator -(Matrix2x2D a, Matrix2x2D b)
Parameters
aMatrix2x2DThe first matrix.
bMatrix2x2DThe second matrix.
Returns
- Matrix2x2D
The difference of the two matrices.