Class Matrix2x2C
- Namespace
- VirtualLabAPI.Core.Numerics
- Assembly
- VirtualLabAPI.dll
A 2 × 2 matrix with complex-valued entries.
[Serializable]
public class Matrix2x2C : SerializableObjectBase, IEquatable<IObjectBase>, ICloneable
- Inheritance
-
ObjectBaseSerializableObjectBaseMatrix2x2C
- Implements
-
IEquatable<IObjectBase>
- Inherited Members
Constructors
Matrix2x2C()
Constructor which creates an empty (all zero values) 2×2 matrix.
public Matrix2x2C()
Matrix2x2C(Complex)
Constructor for a diagonal matrix with a constant on the diagonal.
public Matrix2x2C(Complex c)
Parameters
cComplexConstant diagonal value.
Matrix2x2C(Complex, Complex, Complex, Complex)
Initialize Matrix2x2C with 4 complex values.
public Matrix2x2C(Complex a11, Complex a12, Complex a21, Complex a22)
Parameters
a11ComplexMatrix entry 11 in a 2×2 matrix: {{11,12},{21,22}}.
a12ComplexMatrix entry 12 in a 2×2 matrix: {{11,12},{21,22}}.
a21ComplexMatrix entry 21 in a 2×2 matrix: {{11,12},{21,22}}.
a22ComplexMatrix entry 22 in a 2×2 matrix: {{11,12},{21,22}}.
Matrix2x2C(Matrix2x2C)
Copy constructor.
public Matrix2x2C(Matrix2x2C matC)
Parameters
matCMatrix2x2CMatrix2x2C to be copied.
Properties
IsUndefined
Gets whether a least one component of the matrix is undefined.
public bool IsUndefined { get; }
Property Value
MEntry11
Matrix entry 11 in a 2×2 matrix: {{11,12},{21,22}}.
public Complex MEntry11 { get; set; }
Property Value
MEntry12
Matrix entry 21 in a 2×2 matrix: {{11,12},{21,22}}.
public Complex MEntry12 { get; set; }
Property Value
MEntry21
Matrix entry 12 in a 2×2 matrix: {{11,12},{21,22}}.
public Complex MEntry21 { get; set; }
Property Value
MEntry22
Matrix entry 22 in a 2×2 matrix: {{11,12},{21,22}}.
public Complex MEntry22 { get; set; }
Property Value
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 Matrix2x2C-object.
public Complex Determinant()
Returns
- Complex
Determinant of this matrix
Equals(object, EqualityIntent)
Determines whether the specified object is equal to this instance.
public override bool Equals(object otherObject, EqualityIntent equalityIntent)
Parameters
otherObjectobjectThe object to compare with this instance.
equalityIntentEqualityIntentDefines 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 matrix.
public Matrix2x2C GetInverse()
Returns
- Matrix2x2C
The inverse matrix of this matrix.
InverseMatrix2x2C(Matrix2x2C)
Inverts the given matrix.
public static Matrix2x2C InverseMatrix2x2C(Matrix2x2C mat)
Parameters
matMatrix2x2C
Returns
- Matrix2x2C
The inverse matrix.
IsEveryEntryZero()
Tests if every entry of the matrix is 0.
public bool IsEveryEntryZero()
Returns
IsHermitian()
Is the matrix Hermitian (self-adjoint), i.e. is it a square matrix which is equal to its own conjugate transpose (adjoint)?
public bool IsHermitian()
Returns
IsUnitary()
Is the matrix unitary, i.e. has it an inverse which is equal to its conjugate transpose (adjoint)?
public bool IsUnitary()
Returns
ToString()
Returns matrix as string.
public override string ToString()
Returns
- string
matrix as string
ToString(int)
Gets a string representing this instance.
public string ToString(int numberOfSignificantDigits)
Parameters
numberOfSignificantDigitsintThe number of digits used for formatting of the floating point numbers.
Returns
- string
The formatted value.
isAnyEntryNull()
Tests if any entry of the matrix is null.
public bool isAnyEntryNull()
Returns
Operators
operator +(Matrix2x2C, Matrix2x2C)
Adds the elements of two Matrix2x2C objects.
public static Matrix2x2C operator +(Matrix2x2C a, Matrix2x2C b)
Parameters
aMatrix2x2CThe first matrix.
bMatrix2x2CThe second matrix.
Returns
- Matrix2x2C
The sum of the two matrices.
operator ==(Matrix2x2C, Matrix2x2C)
Compares two matrices. Two matrices are equal when they are equal in all elements.
public static bool operator ==(Matrix2x2C a, Matrix2x2C b)
Parameters
aMatrix2x2CThe first matrix.
bMatrix2x2CThe second matrix.
Returns
implicit operator Matrix2x2C(Matrix2x2D)
Performs an implicit conversion from Matrix2x2D to Matrix2x2C.
public static implicit operator Matrix2x2C(Matrix2x2D doubleMatrix)
Parameters
doubleMatrixMatrix2x2DThe double matrix.
Returns
- Matrix2x2C
The result of the conversion.
operator !=(Matrix2x2C, Matrix2x2C)
Checks to matrices for inequality.
public static bool operator !=(Matrix2x2C a, Matrix2x2C b)
Parameters
aMatrix2x2Cfirst matrix
bMatrix2x2Csecond matrix
Returns
operator *(Complex, Matrix2x2C)
Multiplies a scalar with a Matrix2x2C.
public static Matrix2x2C operator *(Complex b, Matrix2x2C a)
Parameters
bComplexscalar
aMatrix2x2CMatrix
Returns
- Matrix2x2C
The product.
operator *(Matrix2x2C, Complex)
Multiplies a Matrix2x2C with a scalar.
public static Matrix2x2C operator *(Matrix2x2C a, Complex b)
Parameters
aMatrix2x2CThe matrix.
bComplexThe scalar.
Returns
- Matrix2x2C
The product.
operator *(Matrix2x2C, Matrix2x2C)
Multiplies two Matrix2x2C objects.
public static Matrix2x2C operator *(Matrix2x2C a, Matrix2x2C b)
Parameters
aMatrix2x2CThe first matrix.
bMatrix2x2CThe second matrix.
Returns
- Matrix2x2C
The matrix product of the two matrices.
operator *(Matrix2x2C, Matrix2x2D)
Multiplies the elements of a Matrix2x2C and a Matrix2x2D object.
public static Matrix2x2C operator *(Matrix2x2C a, Matrix2x2D b)
Parameters
aMatrix2x2CThe first matrix.
bMatrix2x2DThe second matrix.
Returns
- Matrix2x2C
The product of the two matrices.
operator *(Matrix2x2C, VectorC)
Multiplies a Matrix with a 2-dimensional Vector (AVec). Important: This is not identical to VecA!
public static VectorC operator *(Matrix2x2C a, VectorC vec)
Parameters
aMatrix2x2C2×2 matrix.
vecVectorCVector
Returns
- VectorC
The resulting vector.
operator *(Matrix2x2D, Matrix2x2C)
Multiplies the elements of a Matrix2x2D and a Matrix2x2C object.
public static Matrix2x2C operator *(Matrix2x2D a, Matrix2x2C b)
Parameters
aMatrix2x2DThe first matrix.
bMatrix2x2CThe second matrix.
Returns
- Matrix2x2C
The product of the two matrices.
operator -(Matrix2x2C, Matrix2x2C)
Subtracts the elements of two Matrix2x2C objects.
public static Matrix2x2C operator -(Matrix2x2C a, Matrix2x2C b)
Parameters
aMatrix2x2CThe first matrix.
bMatrix2x2CThe second matrix.
Returns
- Matrix2x2C
The difference of the two matrices.