Table of Contents

Class Matrix3x3D

Namespace
VirtualLabAPI.Core.Numerics
Assembly
VirtualLabAPI.dll

This class defines a 3x3 Matrix of double numbers.
Operators (\(a+b\), \(a-b\)). Operator (\(a*b\)) supports \(b\) as double or Vector3D as well.

[Serializable]
public class Matrix3x3D : SerializableObjectBase, IEquatable<IObjectBase>, ICloneable
Inheritance
ObjectBase
SerializableObjectBase
Matrix3x3D
Implements
IEquatable<IObjectBase>
Inherited Members

Constructors

Matrix3x3D()

Standard constructor, creates an empty matrix where all values are zero.

public Matrix3x3D()

Matrix3x3D(double)

Constructor to get a diagonal matrix having constant value \(c\) on all diagonal elements.

public Matrix3x3D(double c)

Parameters

c double

Value \(c\) used to initialize diagonal elements.

Matrix3x3D(double, double, double, double, double, double, double, double, double)

Constructor taking nine doubles to initialize a Matrix3x3D.

public Matrix3x3D(double m11, double m21, double m31, double m12, double m22, double m32, double m13, double m23, double m33)

Parameters

m11 double

First element of first column.

m21 double

Second element of first column.

m31 double

Third element of first column.

m12 double

First element of second column.

m22 double

Second element of second column.

m32 double

Third element of second column.

m13 double

First element of third column.

m23 double

Second element of third column.

m33 double

Third element of third column.

Matrix3x3D(Matrix3x3D)

Copy constructor.

public Matrix3x3D(Matrix3x3D matC)

Parameters

matC Matrix3x3D

Matrix3x3D to be copied.

Matrix3x3D(Vector3D, Vector3D, Vector3D)

Constructor taking three Vector3D to initialize a Matrix3x3D.

public Matrix3x3D(Vector3D firstCol, Vector3D secondCol, Vector3D thirdCol)

Parameters

firstCol Vector3D

First column.

secondCol Vector3D

Second column.

thirdCol Vector3D

Third column.

Fields

Elements

The field in which the double elements are stored. Note that indices [1..9] are interpreted mathematical. [0] exists but contains no information. Mapping of rows [1..3] and columns [1..3] to one-dimensional index \(i\) is defined by: \(i := row + 3 * (column-1)\).

[Obsolete("Use the two-dimensional indexer instead.")]
public double[] Elements

Field Value

double[]

Properties

Identity

Static property which gives the identity matrix.

public static Matrix3x3D Identity { get; }

Property Value

Matrix3x3D

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 this matrix.

public double Determinant()

Returns

double

The determinant of this matrix.

Equals(object, EqualityIntent)

Compares two matrices for equality.

public override bool Equals(object matrix, EqualityIntent equalityIntent)

Parameters

matrix object

matrix to compare with

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.

GetCol(int)

Returns the specified column of this Matrix3x3D as Vector3D.

public Vector3D GetCol(int index)

Parameters

index int

Column to return (index is one-based!).

Returns

Vector3D

Result of operation.

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 Matrix3x3D GetInverse()

Returns

Matrix3x3D

The inverse matrix.

GetRow(int)

Returns the specified column of this Matrix3x3D as Vector3D.

public Vector3D GetRow(int index)

Parameters

index int

Row to return (index is one-based!).

Returns

Vector3D

Result of operation.

GetTransposed()

Returns transposed matrix of this matrix.

public Matrix3x3D GetTransposed()

Returns

Matrix3x3D

Result of operation..

InverseMatrix(Matrix3x3D)

Calculates inverse matrix of the given one.

public static Matrix3x3D InverseMatrix(Matrix3x3D mat)

Parameters

mat Matrix3x3D

Matrix3x3D to invert.

Returns

Matrix3x3D

Result of operation.

IsIdentity()

Checks whether the matrix is the identity matrix.

public bool IsIdentity()

Returns

bool

true iff the matrix is the identity matrix

IsIdentityNumericalChecks()

Checks whether the matrix is the identity matrix.

public bool IsIdentityNumericalChecks()

Returns

bool

true iff the matrix is the identity matrix

IsOrthogonal()

Checks if matrix is orthogonal, i.e. if M * M^T is the identity matrix

public bool IsOrthogonal()

Returns

bool

true iff matrix is orthogonal

ToString()

Returns an output string representing this matrix.

public override string ToString()

Returns

string

A string that represents this matrix.

TryParse(string, out Matrix3x3D)

Tries to parse a Matrix3x3D object from a string.

public static bool TryParse(string matrixText, out Matrix3x3D matrix3x3D)

Parameters

matrixText string

String which has to be formatted according to the ToString() method.

matrix3x3D Matrix3x3D

The parsed matrix if parse has been possible. Null otherwise.

Returns

bool

A flag indicating whether or not the parsing was successful.

Operators

operator +(Matrix3x3D, Matrix3x3D)

Adds the elements of two Matrix3x3D objects.

public static Matrix3x3D operator +(Matrix3x3D a, Matrix3x3D b)

Parameters

a Matrix3x3D

the first matrix

b Matrix3x3D

the second matrix

Returns

Matrix3x3D

The sum of the two matrices.

operator ==(Matrix3x3D, Matrix3x3D)

Compares two matrices. Two matrices are equal when they are equal in all elements.

public static bool operator ==(Matrix3x3D a, Matrix3x3D b)

Parameters

a Matrix3x3D

First matrix.

b Matrix3x3D

Second matrix.

Returns

bool

true if they are equal, otherwise false.

operator !=(Matrix3x3D, Matrix3x3D)

Checks two matrices for inequality.

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

Parameters

a Matrix3x3D

first matrix

b Matrix3x3D

second matrix

Returns

bool

false if they are equal, otherwise true.

operator *(double, Matrix3x3D)

Multiplies a Matrix3x3D with a scalar.

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

Parameters

b double

scalar

a Matrix3x3D

matrix

Returns

Matrix3x3D

Result of operation.

operator *(Matrix3x3D, double)

Multiplies a Matrix3x3D with a scalar.

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

Parameters

a Matrix3x3D

matrix

b double

scalar

Returns

Matrix3x3D

Result of operation.

operator *(Matrix3x3D, Matrix3x3D)

Multiplies the elements of two Matrix3x3D objects.

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

Parameters

a Matrix3x3D

the first matrix

b Matrix3x3D

the second matrix

Returns

Matrix3x3D

The product of the two matrices.

operator *(Matrix3x3D, Vector3C)

Multiplies a Matrix with an 3-dimensional complex Vector (A*Vec).

public static Vector3C operator *(Matrix3x3D a, Vector3C vec)

Parameters

a Matrix3x3D

3x3 matrix

vec Vector3C

Complex vector.

Returns

Vector3C

Result of operation.

operator *(Matrix3x3D, Vector3D)

Multiplies a Matrix with an 3-dimensional vector (A*Vec).

public static Vector3D operator *(Matrix3x3D a, Vector3D vec)

Parameters

a Matrix3x3D

3x3 matrix

vec Vector3D

vector

Returns

Vector3D

Result of operation.

operator -(Matrix3x3D, Matrix3x3D)

Subtracts the elements of two Matrix3x3D objects.

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

Parameters

a Matrix3x3D

the first matrix

b Matrix3x3D

the second matrix

Returns

Matrix3x3D

The Difference of the two matrices.