Table of Contents

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
ObjectBase
SerializableObjectBase
Matrix2x2D
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

c double

Constant 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

a1 double

Element [row, col] = (0, 0)

a2 double

Element [row, col] = (0, 1)

a3 double

Element [row, col] = (1, 0)

a4 double

Element [row, col] = (1, 1)

Matrix2x2D(Matrix2x2D)

Copy constructor.

public Matrix2x2D(Matrix2x2D matC)

Parameters

matC Matrix2x2D

Matrix2x2D to be copied.

Fields

IdentityMatrix

The identity matrix.

public static readonly Matrix2x2D IdentityMatrix

Field Value

Matrix2x2D

Properties

this[int, int]

Gets or sets a certain matrix element.

public double this[int row, int col] { get; set; }

Parameters

row int

The zero-based row index.

col int

The zero-based column index.

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

matrix object
equalityIntent EqualityIntent

Defines what kind of equality you want to check when comparing two objects, for example all values or physical equality.

Returns

bool

true if the specified object is equal to this instance; otherwise, false.

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

mat Matrix2x2D

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

rotAngle2D double

The 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

digits int

Number 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

digits int

Number of digits for the matrix entries.

physicalProperties PhysicalProperty[]

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

a Matrix2x2D

The first matrix.

b Matrix2x2D

The 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

a Matrix2x2D

The first matrix.

b Matrix2x2D

The second matrix.

Returns

bool

true if they are equal.

operator !=(Matrix2x2D, Matrix2x2D)

Checks two matrices for inequality.

public static bool operator !=(Matrix2x2D a, Matrix2x2D b)

Parameters

a Matrix2x2D

The first matrix.

b Matrix2x2D

The second matrix.

Returns

bool

false if they are equal.

operator *(double, Matrix2x2D)

Multiplies a scalar with a Matrix2x2D.

public static Matrix2x2D operator *(double b, Matrix2x2D a)

Parameters

b double

The scalar.

a Matrix2x2D

The matrix.

Returns

Matrix2x2D

The product.

operator *(Matrix2x2D, double)

Multiplies a Matrix2x2D with a scalar.

public static Matrix2x2D operator *(Matrix2x2D a, double b)

Parameters

a Matrix2x2D

The matrix.

b double

The scalar.

Returns

Matrix2x2D

The product.

operator *(Matrix2x2D, Matrix2x2D)

Multiplies two Matrix2x2D objects.

public static Matrix2x2D operator *(Matrix2x2D a, Matrix2x2D b)

Parameters

a Matrix2x2D

The first matrix

b Matrix2x2D

The 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

a Matrix2x2D

2×2 matrix.

vec VectorD

Vector.

Returns

VectorD

The resulting vector.

operator -(Matrix2x2D, Matrix2x2D)

Subtracts the elements of two Matrix2x2D objects.

public static Matrix2x2D operator -(Matrix2x2D a, Matrix2x2D b)

Parameters

a Matrix2x2D

The first matrix.

b Matrix2x2D

The second matrix.

Returns

Matrix2x2D

The difference of the two matrices.