Skip to content

DiGi.Math.Classes

github-actions[bot] edited this page Jul 15, 2026 · 2 revisions

DiGi.Math.Classes Namespace

Classes

BilinearInterpolation Class

Class to perform Bilinear Interpolation on a set of data.

public class BilinearInterpolation : DiGi.Core.Classes.SerializableObject, DiGi.Math.Interfaces.IInterpolation, DiGi.Core.Interfaces.ISerializableObject, DiGi.Core.Interfaces.ICloneableObject<DiGi.Core.Interfaces.ISerializableObject>, DiGi.Core.Interfaces.ICloneableObject, DiGi.Core.Interfaces.IObject

Inheritance System.ObjectDiGi.Core.Classes.ObjectDiGi.Core.Classes.SerializableObject → BilinearInterpolation

Implements IInterpolation, DiGi.Core.Interfaces.ISerializableObject, DiGi.Core.Interfaces.ICloneableObject<DiGi.Core.Interfaces.ISerializableObject>, DiGi.Core.Interfaces.ICloneableObject, DiGi.Core.Interfaces.IObject

Constructors

BilinearInterpolation() Constructor

Default constructor. Initializes a new instance of the BilinearInterpolation class.

public BilinearInterpolation();

BilinearInterpolation(BilinearInterpolation) Constructor

Copy constructor. Initializes a new instance of the BilinearInterpolation class by copying an existing instance.

public BilinearInterpolation(DiGi.Math.Classes.BilinearInterpolation? bilinearInterpolation);

Parameters

bilinearInterpolation BilinearInterpolation

The instance to copy.

BilinearInterpolation(double[,]) Constructor

Initializes a new instance of the BilinearInterpolation class using a 2D data array.

public BilinearInterpolation(double[,]? data);

Parameters

data System.Double[]

The 2D data array.

BilinearInterpolation(JsonObject) Constructor

Initializes a new instance of the BilinearInterpolation class using a System.Text.Json.Nodes.JsonObject.

public BilinearInterpolation(System.Text.Json.Nodes.JsonObject? jsonObject);

Parameters

jsonObject System.Text.Json.Nodes.JsonObject

The JSON object containing the data to be deserialized into this instance.

Fields

BilinearInterpolation.values Field

The data matrix for interpolation, in [y, x] format.

private double[,]? values;

Field Value

System.Double[]

BilinearInterpolation.xArray Field

Array of row (horizontal) values.

private readonly double[]? xArray;

Field Value

System.Double[]

BilinearInterpolation.yArray Field

Array of column (vertical) values.

private readonly double[]? yArray;

Field Value

System.Double[]

Methods

BilinearInterpolation.Calculate(double, double) Method

Calculate value

public double Calculate(double x, double y);

Parameters

x System.Double

Column value (Horizontal value)

y System.Double

Row value (Vertical value)

Returns

System.Double

BilinearInterpolation.FromJsonObject(JsonObject) Method

Populates the object's properties from a JsonObject.

public override bool FromJsonObject(System.Text.Json.Nodes.JsonObject? jsonObject);

Parameters

jsonObject System.Text.Json.Nodes.JsonObject

The System.Text.Json.Nodes.JsonObject containing the data to populate the object.

Implements FromJsonObject(JsonObject)

Returns

System.Boolean
True if the object was successfully populated; otherwise, false.

BilinearInterpolation.ToJsonObject() Method

Converts the object into a JsonObject for serialization.

public override System.Text.Json.Nodes.JsonObject? ToJsonObject();

Implements ToJsonObject()

Returns

System.Text.Json.Nodes.JsonObject
A System.Text.Json.Nodes.JsonObject representation of the object, or null if conversion fails.

LinearEquation Class

Equation in format y = Ax + B

public class LinearEquation : DiGi.Core.Classes.SerializableObject, DiGi.Math.Interfaces.IEquation, DiGi.Core.Interfaces.ISerializableObject, DiGi.Core.Interfaces.ICloneableObject<DiGi.Core.Interfaces.ISerializableObject>, DiGi.Core.Interfaces.ICloneableObject, DiGi.Core.Interfaces.IObject

Inheritance System.ObjectDiGi.Core.Classes.ObjectDiGi.Core.Classes.SerializableObject → LinearEquation

Implements IEquation, DiGi.Core.Interfaces.ISerializableObject, DiGi.Core.Interfaces.ICloneableObject<DiGi.Core.Interfaces.ISerializableObject>, DiGi.Core.Interfaces.ICloneableObject, DiGi.Core.Interfaces.IObject

Constructors

LinearEquation(LinearEquation) Constructor

Initializes a new instance of the LinearEquation class by copying an existing LinearEquation instance.

public LinearEquation(DiGi.Math.Classes.LinearEquation linearEquation);

Parameters

linearEquation LinearEquation

The source equation to copy from.

LinearEquation(double, double) Constructor

Initializes a new instance of the LinearEquation class with specified coefficients A and B.

public LinearEquation(double a, double b);

Parameters

a System.Double

The coefficient A (slope) of the linear equation.

b System.Double

The coefficient B (y-intercept) of the linear equation.

LinearEquation(JsonObject) Constructor

Initializes a new instance of the LinearEquation class using a System.Text.Json.Nodes.JsonObject.

public LinearEquation(System.Text.Json.Nodes.JsonObject jsonObject);

Parameters

jsonObject System.Text.Json.Nodes.JsonObject

The JSON object containing the equation data.

Properties

LinearEquation.A Property

Coefficient A in the equation

public double A { get; }

Property Value

System.Double

LinearEquation.B Property

Coefficient B in the equation

public double B { get; }

Property Value

System.Double

LinearEquation.Coefficients Property

Gets the coefficients of the equation

public System.Collections.Generic.List<double> Coefficients { get; }

Property Value

System.Collections.Generic.List<System.Double>

Methods

LinearEquation.Evaluate(double) Method

Evaluates the equation for a given value of x

public double Evaluate(double value);

Parameters

value System.Double

The value of x

Implements Evaluate(double)

Returns

System.Double
The value of y for the given value of x

LinearEquation.Evaluate(IEnumerable<double>) Method

Evaluates the equation for a collection of values of x

public System.Collections.Generic.List<double>? Evaluate(System.Collections.Generic.IEnumerable<double>? values);

Parameters

values System.Collections.Generic.IEnumerable<System.Double>

The collection of values of x

Implements Evaluate(IEnumerable<double>)

Returns

System.Collections.Generic.List<System.Double>
A list of corresponding values of y

LinearInterpolation Class

Linear Interpolation of given vlues

public class LinearInterpolation : DiGi.Core.Classes.SerializableObject, DiGi.Math.Interfaces.IInterpolation, DiGi.Core.Interfaces.ISerializableObject, DiGi.Core.Interfaces.ICloneableObject<DiGi.Core.Interfaces.ISerializableObject>, DiGi.Core.Interfaces.ICloneableObject, DiGi.Core.Interfaces.IObject

Inheritance System.ObjectDiGi.Core.Classes.ObjectDiGi.Core.Classes.SerializableObject → LinearInterpolation

Implements IInterpolation, DiGi.Core.Interfaces.ISerializableObject, DiGi.Core.Interfaces.ICloneableObject<DiGi.Core.Interfaces.ISerializableObject>, DiGi.Core.Interfaces.ICloneableObject, DiGi.Core.Interfaces.IObject

Constructors

LinearInterpolation() Constructor

Initializes a new instance of the LinearInterpolation class.

public LinearInterpolation();

LinearInterpolation(LinearInterpolation) Constructor

Initializes a new instance of the LinearInterpolation class by copying values from an existing interpolation object.

public LinearInterpolation(DiGi.Math.Classes.LinearInterpolation? linearInterpolation);

Parameters

linearInterpolation LinearInterpolation

The source LinearInterpolation instance to copy.

LinearInterpolation(double, double, double, double) Constructor

Initializes a new instance of the LinearInterpolation class with two initial data points.

public LinearInterpolation(double x_1, double y_1, double x_2, double y_2);

Parameters

x_1 System.Double

The X coordinate of the first point.

y_1 System.Double

The Y coordinate of the first point.

x_2 System.Double

The X coordinate of the second point.

y_2 System.Double

The Y coordinate of the second point.

LinearInterpolation(double[,]) Constructor

Initializes a new instance of the LinearInterpolation class using a 2D array where the first dimension represents axes (0 for X, 1 for Y) and the second dimension represents points.

public LinearInterpolation(double[,]? data);

Parameters

data System.Double[]

A 2D array containing coordinate pairs.

LinearInterpolation(JsonObject) Constructor

Initializes a new instance of the LinearInterpolation class using a System.Text.Json.Nodes.JsonObject for deserialization.

public LinearInterpolation(System.Text.Json.Nodes.JsonObject? jsonObject);

Parameters

jsonObject System.Text.Json.Nodes.JsonObject

The JSON object containing the interpolation data.

Properties

LinearInterpolation.Count Property

Gets the number of data points stored in the interpolation set. Returns -1 if the values collection is not initialized.

public int Count { get; }

Property Value

System.Int32

LinearInterpolation.MaxX Property

Gets the maximum X value among all stored data points. Returns System.Double.NaN if no values are present.

public double MaxX { get; }

Property Value

System.Double

LinearInterpolation.MinX Property

Gets the minimum X value among all stored data points. Returns System.Double.NaN if no values are present.

public double MinX { get; }

Property Value

System.Double

Methods

LinearInterpolation.Add(double, double) Method

Adds a coordinate pair to the interpolation set.

public bool Add(double x, double y);

Parameters

x System.Double

The X coordinate.

y System.Double

The Y coordinate.

Returns

System.Boolean
True if the point was added; false if either X or Y is System.Double.NaN.

LinearInterpolation.Add(KeyValuePair<double,double>) Method

Adds a coordinate pair to the interpolation set.

public bool Add(System.Collections.Generic.KeyValuePair<double,double> keyValuePair);

Parameters

keyValuePair System.Collections.Generic.KeyValuePair<System.Double,System.Double>

A System.Collections.Generic.KeyValuePair<> where Key is X and Value is Y.

Returns

System.Boolean
True if the point was successfully added; otherwise, false.

LinearInterpolation.CalculateY(double) Method

Calculates a single interpolated Y value for the given X coordinate.

public double CalculateY(double x);

Parameters

x System.Double

The X coordinate to interpolate.

Returns

System.Double
The interpolated Y value, or System.Double.NaN if interpolation is not possible.

LinearInterpolation.CalculateYs(double, int) Method

Calculates a list of interpolated Y values for the given X coordinate.

public System.Collections.Generic.List<double>? CalculateYs(double x, int maxCount=int.MaxValue);

Parameters

x System.Double

The X coordinate to interpolate.

maxCount System.Int32

The maximum number of results to return.

Returns

System.Collections.Generic.List<System.Double>
A System.Collections.Generic.List<> of interpolated Y values, or null if the input is invalid or out of range.

LinearInterpolation.InRange(double) Method

Checks whether the specified X coordinate falls within the range defined by the minimum and maximum stored X values.

public bool InRange(double x);

Parameters

x System.Double

The X coordinate to check.

Returns

System.Boolean
True if the value is within the inclusive range [MinX, MaxX]; otherwise, false.

Matrix Class

Represents a mathematical matrix with double-precision floating-point elements.

public class Matrix : DiGi.Core.Classes.SerializableObject, DiGi.Math.Interfaces.IMatrix, DiGi.Core.Interfaces.ISerializableObject, DiGi.Core.Interfaces.ICloneableObject<DiGi.Core.Interfaces.ISerializableObject>, DiGi.Core.Interfaces.ICloneableObject, DiGi.Core.Interfaces.IObject

Inheritance System.ObjectDiGi.Core.Classes.ObjectDiGi.Core.Classes.SerializableObject → Matrix

Derived
Matrix2D
Matrix3D
Matrix4D

Implements IMatrix, DiGi.Core.Interfaces.ISerializableObject, DiGi.Core.Interfaces.ICloneableObject<DiGi.Core.Interfaces.ISerializableObject>, DiGi.Core.Interfaces.ICloneableObject, DiGi.Core.Interfaces.IObject

Constructors

Matrix(Matrix) Constructor

Initializes a new instance of the Matrix class by copying another matrix.

public Matrix(DiGi.Math.Classes.Matrix? matrix);

Parameters

matrix Matrix

The source matrix to copy.

Matrix(double[,]) Constructor

Initializes a new instance of the Matrix class from a 2D array of values.

public Matrix(double[,]? values);

Parameters

values System.Double[]

The 2D array containing the matrix elements.

Matrix(double[]) Constructor

Initializes a new instance of the Matrix class from a 1D array of values.

public Matrix(double[]? values);

Parameters

values System.Double[]

An array of values to be used as the first row of the matrix.

Matrix(int, int) Constructor

Initializes a new instance of the Matrix class with the specified number of rows and columns.

public Matrix(int rowCount, int columnCount);

Parameters

rowCount System.Int32

The number of rows in the matrix.

columnCount System.Int32

The number of columns in the matrix.

Matrix(JsonObject) Constructor

Initializes a new instance of the Matrix class from a JSON object.

public Matrix(System.Text.Json.Nodes.JsonObject? jsonObject);

Parameters

jsonObject System.Text.Json.Nodes.JsonObject

The JSON object containing matrix data.

Properties

Matrix.this[int, int] Property

Gets or sets the element at the specified row and column.

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

Parameters

row System.Int32

The zero-based index of the row.

column System.Int32

The zero-based index of the column.

Property Value

System.Double

Methods

Matrix.Clone() Method

Creates a shallow copy of the current matrix.

public override DiGi.Core.Interfaces.ISerializableObject? Clone();

Implements Clone()

Returns

DiGi.Core.Interfaces.ISerializableObject
A clone of the current matrix.

Matrix.ColumnCount() Method

Gets the number of columns in the matrix.

public int ColumnCount();

Returns

System.Int32
The column count, or -1 if values are null.

Matrix.CountNonZeroRows(double) Method

Counts the number of rows that contain at least one non-zero element.

public int CountNonZeroRows(double tolerance=1E-06);

Parameters

tolerance System.Double

The tolerance value for determining if an element is non-zero.

Returns

System.Int32
The count of non-zero rows.

Matrix.Determinant() Method

Calculates the determinant of the matrix.

public double Determinant();

Returns

System.Double
The determinant value, or NaN if the matrix is not square or values are null.

Matrix.Eigenvalues(double) Method

Calculates the eigenvalues of a 3x3 symmetric matrix.

public double[]? Eigenvalues(double tolerance=1E-06);

Parameters

tolerance System.Double

The tolerance value for symmetry check.

Returns

System.Double[]
An array containing the real eigenvalues, or null if calculation fails.

Exceptions

System.NotImplementedException
Thrown when matrix is not 3x3 or not symmetric.

Matrix.Equals(object) Method

Determines whether the specified object is equal to the current matrix.

public override bool Equals(object? obj);

Parameters

obj System.Object

The object to compare with the current matrix.

Returns

System.Boolean
True if the objects are equal; otherwise, false.

Matrix.FromJsonObject(JsonObject) Method

Populates the object's properties from a JsonObject.

public override bool FromJsonObject(System.Text.Json.Nodes.JsonObject? jsonObject);

Parameters

jsonObject System.Text.Json.Nodes.JsonObject

The System.Text.Json.Nodes.JsonObject containing the data to populate the object.

Implements FromJsonObject(JsonObject)

Returns

System.Boolean
True if the object was successfully populated; otherwise, false.

Matrix.GetCofactorsMatrix() Method

Generates the matrix of cofactors for the current matrix, where each element is the signed minor determinant (-1)^(row+column) multiplied by the determinant of the corresponding minor matrix.

public DiGi.Math.Classes.Matrix? GetCofactorsMatrix();

Returns

Matrix
The cofactor matrix, or null if values are null or the matrix is not square.

Matrix.GetHashCode() Method

Gets the hash code for the current matrix.

public override int GetHashCode();

Returns

System.Int32
A 32-bit signed integer hash code.

Matrix.GetInversed() Method

Returns a new matrix that is the inverse of the current matrix.

public DiGi.Math.Classes.Matrix? GetInversed();

Returns

Matrix
The inversed matrix, or null if the matrix is not square.

Matrix.GetMinorMatrix(int, int) Method

Gets the minor matrix obtained by removing the specified row and column.

public DiGi.Math.Classes.Matrix? GetMinorMatrix(int row, int column);

Parameters

row System.Int32

The index of the row to remove.

column System.Int32

The index of the column to remove.

Returns

Matrix
The resulting minor matrix, or null if values are null or dimensions are too small.

Matrix.GetMinorsMatrix() Method

Generates the matrix of minors for the current matrix.

public DiGi.Math.Classes.Matrix? GetMinorsMatrix();

Returns

Matrix
The matrix of minors, or null if values are null.

Matrix.GetTransposed() Method

Returns a new matrix that is the transpose of the current matrix.

public DiGi.Math.Classes.Matrix? GetTransposed();

Returns

Matrix
The transposed matrix.

Matrix.Inverse() Method

Inverts the current matrix in place.

public void Inverse();

Matrix.IsSquare() Method

Determines whether the current matrix is square.

public bool IsSquare();

Returns

System.Boolean
True if the matrix is square; otherwise, false.

Matrix.Multiply(Matrix) Method

Multiplies the current matrix by another matrix.

public DiGi.Math.Classes.Matrix? Multiply(DiGi.Math.Classes.Matrix? matrix);

Parameters

matrix Matrix

The matrix to multiply with.

Returns

Matrix
The result of the multiplication, or null if dimensions are incompatible.

Matrix.Multiply(double) Method

Multiplies every element of the current matrix by a scalar value.

public DiGi.Math.Classes.Matrix? Multiply(double value);

Parameters

value System.Double

The scalar value.

Returns

Matrix
The result of the multiplication, or null if values are null.

Matrix.Negate() Method

Negates every element of the current matrix in place.

public void Negate();

Matrix.REFTolerance(double) Method

Calculates a tolerance value for Row Echelon Form based on matrix dimensions and maximum row sum.

public double REFTolerance(double tolerance=1E-06);

Parameters

tolerance System.Double

The base tolerance value.

Returns

System.Double
The calculated REF tolerance.

Matrix.Round(double) Method

Rounds every element of the current matrix to the specified tolerance in place.

public void Round(double tolerance=1E-06);

Parameters

tolerance System.Double

The precision to round to.

Matrix.RowCount() Method

Gets the number of rows in the matrix.

public int RowCount();

Returns

System.Int32
The row count, or -1 if values are null.

Matrix.RowEchelonForm(bool, double) Method

Transforms the matrix into row echelon form or reduced row echelon form.

public DiGi.Math.Classes.Matrix? RowEchelonForm(bool reduced=true, double tolerance=1E-06);

Parameters

reduced System.Boolean

If true, calculates the reduced row echelon form.

tolerance System.Double

The tolerance for zero detection during elimination.

Returns

Matrix
A new matrix in (reduced) row echelon form, or null if cloning fails.

Matrix.SetValues(double) Method

Sets all elements of the current matrix to a specified value in place.

public void SetValues(double value);

Parameters

value System.Double

The value to set.

Matrix.Size() Method

Returns a new matrix containing the dimensions of the current matrix.

public DiGi.Math.Classes.Matrix? Size();

Returns

Matrix
A 1x2 matrix with row and column counts, or null if values are null.

Matrix.SizeEqual(Matrix) Method

Checks if the current matrix has the same dimensions as another matrix.

public bool SizeEqual(DiGi.Math.Classes.Matrix? matrix);

Parameters

matrix Matrix

The other matrix to compare.

Returns

System.Boolean
True if sizes are equal; otherwise, false.

Matrix.ToArray() Method

Converts the current matrix to a 2D array of doubles.

public double[,]? ToArray();

Returns

System.Double[]
A copy of the matrix elements as a 2D array, or null if values are null.

Matrix.ToJsonObject() Method

Converts the object into a JsonObject for serialization.

public override System.Text.Json.Nodes.JsonObject? ToJsonObject();

Implements ToJsonObject()

Returns

System.Text.Json.Nodes.JsonObject
A System.Text.Json.Nodes.JsonObject representation of the object, or null if conversion fails.

Matrix.Transpose() Method

Transposes the current matrix in place.

public void Transpose();

Operators

Matrix.operator +(Matrix, Matrix) Operator

Adds two matrices together element-wise.

public static DiGi.Math.Classes.Matrix? operator +(DiGi.Math.Classes.Matrix? matrix_1, DiGi.Math.Classes.Matrix? matrix_2);

Parameters

matrix_1 Matrix

The first matrix to add.

matrix_2 Matrix

The second matrix to add.

Returns

Matrix
A new Matrix containing the sum of the two matrices, or null if either input is null or if the matrices have different dimensions.

Matrix.operator +(Matrix, double) Operator

Adds a scalar value to every element of the matrix.

public static DiGi.Math.Classes.Matrix? operator +(DiGi.Math.Classes.Matrix? matrix, double value);

Parameters

matrix Matrix

The matrix to which the scalar value will be added.

value System.Double

The scalar value to add to each element.

Returns

Matrix
A new Matrix containing the result of the addition, or null if the input matrix is null.

Matrix.explicit operator Matrix(double[,]) Operator

Explicitly converts a two-dimensional array of doubles to a Matrix.

public static DiGi.Math.Classes.Matrix? explicit operator DiGi.Math.Classes.Matrix?(double[,]? values);

Parameters

values System.Double[]

The two-dimensional array of doubles to convert.

Returns

Matrix
A new Matrix instance created from the provided values, or null if the input array is null.

Matrix.operator *(Matrix, Matrix) Operator

Multiplies two matrices together using matrix multiplication.

public static DiGi.Math.Classes.Matrix? operator *(DiGi.Math.Classes.Matrix? matrix_1, DiGi.Math.Classes.Matrix? matrix_2);

Parameters

matrix_1 Matrix

The first matrix to multiply.

matrix_2 Matrix

The second matrix to multiply.

Returns

Matrix
A new Matrix representing the product of the two matrices, or null if either input is null or if the number of columns in the first matrix does not match the number of rows in the second matrix.

Matrix.operator *(Matrix, double) Operator

Multiplies every element of the matrix by a scalar value.

public static DiGi.Math.Classes.Matrix? operator *(DiGi.Math.Classes.Matrix? matrix, double value);

Parameters

matrix Matrix

The matrix to be multiplied.

value System.Double

The scalar value to multiply each element by.

Returns

Matrix
A new Matrix containing the result of the multiplication, or null if the input matrix is null.

Matrix.operator -(Matrix, Matrix) Operator

Subtracts the second matrix from the first matrix element-wise.

public static DiGi.Math.Classes.Matrix? operator -(DiGi.Math.Classes.Matrix? matrix_1, DiGi.Math.Classes.Matrix? matrix_2);

Parameters

matrix_1 Matrix

The first matrix to subtract from.

matrix_2 Matrix

The second matrix to be subtracted.

Returns

Matrix
A new Matrix containing the result of the subtraction, or null if either input is null or the matrices have different dimensions.

Matrix.operator -(Matrix, double) Operator

Subtracts a scalar value from every element of the matrix.

public static DiGi.Math.Classes.Matrix? operator -(DiGi.Math.Classes.Matrix? matrix, double value);

Parameters

matrix Matrix

The matrix to subtract the value from.

value System.Double

The scalar value to be subtracted from each element.

Returns

Matrix
A new Matrix representing the result of the subtraction, or null if the input matrix is null.

Matrix2D Class

Represents a 2x2 square matrix providing specialized mathematical operations and serialization capabilities.

public class Matrix2D : DiGi.Math.Classes.Matrix, DiGi.Math.Interfaces.ISquareMatrix, DiGi.Math.Interfaces.IMatrix, DiGi.Core.Interfaces.ISerializableObject, DiGi.Core.Interfaces.ICloneableObject<DiGi.Core.Interfaces.ISerializableObject>, DiGi.Core.Interfaces.ICloneableObject, DiGi.Core.Interfaces.IObject

Inheritance System.ObjectDiGi.Core.Classes.ObjectDiGi.Core.Classes.SerializableObjectMatrix → Matrix2D

Implements ISquareMatrix, IMatrix, DiGi.Core.Interfaces.ISerializableObject, DiGi.Core.Interfaces.ICloneableObject<DiGi.Core.Interfaces.ISerializableObject>, DiGi.Core.Interfaces.ICloneableObject, DiGi.Core.Interfaces.IObject

Constructors

Matrix2D() Constructor

Initializes a new instance of the Matrix2D class with default dimensions of 2x2.

public Matrix2D();

Matrix2D(Matrix2D) Constructor

Initializes a new instance of the Matrix2D class by copying the values from an existing Matrix2D instance.

public Matrix2D(DiGi.Math.Classes.Matrix2D? matrix2D);

Parameters

matrix2D Matrix2D

The source matrix to copy.

Matrix2D(JsonObject) Constructor

Initializes a new instance of the Matrix2D class using the provided JSON object for deserialization.

public Matrix2D(System.Text.Json.Nodes.JsonObject? jsonObject);

Parameters

jsonObject System.Text.Json.Nodes.JsonObject

The System.Text.Json.Nodes.JsonObject containing the matrix data.

Methods

Matrix2D.Clone() Method

Creates a deep copy of the current Matrix2D instance.

public override DiGi.Core.Interfaces.ISerializableObject? Clone();

Implements Clone()

Returns

DiGi.Core.Interfaces.ISerializableObject
A new DiGi.Core.Interfaces.ISerializableObject representing the cloned matrix, or null.

Operators

Matrix2D.operator +(Matrix2D, Matrix2D) Operator

Adds two Matrix2D instances together.

public static DiGi.Math.Classes.Matrix2D? operator +(DiGi.Math.Classes.Matrix2D? matrix2D_1, DiGi.Math.Classes.Matrix2D? matrix2D_2);

Parameters

matrix2D_1 Matrix2D

The first matrix operand.

matrix2D_2 Matrix2D

The second matrix operand to add to the first.

Returns

Matrix2D
The result of the addition as a Matrix2D, or null if either operand is null.

Matrix2D.operator +(Matrix2D, double) Operator

Adds a scalar value to every element of the Matrix2D.

public static DiGi.Math.Classes.Matrix2D? operator +(DiGi.Math.Classes.Matrix2D? matrix2D, double value);

Parameters

matrix2D Matrix2D

The matrix operand.

value System.Double

The scalar value to add.

Returns

Matrix2D
A new Matrix2D containing the result, or null if the matrix is null.

Matrix2D.explicit operator Matrix2D(double[,]) Operator

Explicitly converts a two-dimensional array of doubles into a Matrix2D instance.

public static DiGi.Math.Classes.Matrix2D? explicit operator DiGi.Math.Classes.Matrix2D?(double[,]? values);

Parameters

values System.Double[]

The 2D double array to convert.

Returns

Matrix2D
A Matrix2D instance created from the values, or null if the input is null.

Matrix2D.operator *(Matrix2D, Matrix2D) Operator

Performs matrix multiplication between two Matrix2D instances.

public static DiGi.Math.Classes.Matrix2D? operator *(DiGi.Math.Classes.Matrix2D? matrix2D_1, DiGi.Math.Classes.Matrix2D? matrix2D_2);

Parameters

matrix2D_1 Matrix2D

The left-hand side matrix operand.

matrix2D_2 Matrix2D

The right-hand side matrix operand.

Returns

Matrix2D
The resulting product as a Matrix2D, or null if either operand is null.

Matrix2D.operator *(Matrix2D, double) Operator

Multiplies every element of the Matrix2D by a scalar value.

public static DiGi.Math.Classes.Matrix2D? operator *(DiGi.Math.Classes.Matrix2D? matrix2D, double value);

Parameters

matrix2D Matrix2D

The matrix operand.

value System.Double

The scalar multiplier.

Returns

Matrix2D
A new Matrix2D containing the result, or null if the matrix is null.

Matrix2D.operator -(Matrix2D, Matrix2D) Operator

Subtracts one Matrix2D from another.

public static DiGi.Math.Classes.Matrix2D? operator -(DiGi.Math.Classes.Matrix2D? matrix2D_1, DiGi.Math.Classes.Matrix2D? matrix2D_2);

Parameters

matrix2D_1 Matrix2D

The first matrix operand.

matrix2D_2 Matrix2D

The second matrix operand to subtract from the first.

Returns

Matrix2D
The result of the subtraction as a Matrix2D, or null if either operand is null.

Matrix2D.operator -(Matrix2D, double) Operator

Subtracts a scalar value from every element of the Matrix2D.

public static DiGi.Math.Classes.Matrix2D? operator -(DiGi.Math.Classes.Matrix2D? matrix2D, double value);

Parameters

matrix2D Matrix2D

The matrix operand.

value System.Double

The scalar value to subtract.

Returns

Matrix2D
A new Matrix2D containing the result, or null if the matrix is null.

Matrix3D Class

Represents a 3x3 square matrix used for three-dimensional mathematical operations.

public class Matrix3D : DiGi.Math.Classes.Matrix, DiGi.Math.Interfaces.ISquareMatrix, DiGi.Math.Interfaces.IMatrix, DiGi.Core.Interfaces.ISerializableObject, DiGi.Core.Interfaces.ICloneableObject<DiGi.Core.Interfaces.ISerializableObject>, DiGi.Core.Interfaces.ICloneableObject, DiGi.Core.Interfaces.IObject

Inheritance System.ObjectDiGi.Core.Classes.ObjectDiGi.Core.Classes.SerializableObjectMatrix → Matrix3D

Implements ISquareMatrix, IMatrix, DiGi.Core.Interfaces.ISerializableObject, DiGi.Core.Interfaces.ICloneableObject<DiGi.Core.Interfaces.ISerializableObject>, DiGi.Core.Interfaces.ICloneableObject, DiGi.Core.Interfaces.IObject

Constructors

Matrix3D() Constructor

Initializes a new instance of the Matrix3D class as a 3x3 matrix.

public Matrix3D();

Matrix3D(Matrix3D) Constructor

Initializes a new instance of the Matrix3D class by copying an existing Matrix3D instance.

public Matrix3D(DiGi.Math.Classes.Matrix3D? matrix3D);

Parameters

matrix3D Matrix3D

The source Matrix3D to copy.

Matrix3D(JsonObject) Constructor

Initializes a new instance of the Matrix3D class from the specified JSON object.

public Matrix3D(System.Text.Json.Nodes.JsonObject? jsonObject);

Parameters

jsonObject System.Text.Json.Nodes.JsonObject

The System.Text.Json.Nodes.JsonObject containing the matrix data.

Methods

Matrix3D.Clone() Method

Creates a deep copy of the current Matrix3D instance.

public override DiGi.Core.Interfaces.ISerializableObject? Clone();

Implements Clone()

Returns

DiGi.Core.Interfaces.ISerializableObject
A new DiGi.Core.Interfaces.ISerializableObject representing the cloned matrix.

Operators

Matrix3D.operator +(Matrix3D, Matrix3D) Operator

Adds two Matrix3D instances together.

public static DiGi.Math.Classes.Matrix3D? operator +(DiGi.Math.Classes.Matrix3D? matrix3D_1, DiGi.Math.Classes.Matrix3D? matrix3D_2);

Parameters

matrix3D_1 Matrix3D

The first Matrix3D.

matrix3D_2 Matrix3D

The second Matrix3D to add to the first.

Returns

Matrix3D
The result of the addition as a Matrix3D, or null if either operand is null.

Matrix3D.operator +(Matrix3D, double) Operator

Adds a scalar value to each element of the Matrix3D.

public static DiGi.Math.Classes.Matrix3D? operator +(DiGi.Math.Classes.Matrix3D? matrix3D, double value);

Parameters

matrix3D Matrix3D

The Matrix3D instance.

value System.Double

The double value to add.

Returns

Matrix3D
A new Matrix3D containing the result, or null if the matrix is null.

Matrix3D.explicit operator Matrix3D(double[,]) Operator

Explicitly converts a two-dimensional array of doubles to a Matrix3D.

public static DiGi.Math.Classes.Matrix3D? explicit operator DiGi.Math.Classes.Matrix3D?(double[,]? values);

Parameters

values System.Double[]

The 2D double array containing the matrix elements.

Returns

Matrix3D
A Matrix3D instance created from the values, or null if the input is null.

Matrix3D.operator *(Matrix3D, Matrix3D) Operator

Performs matrix multiplication between two Matrix3D instances.

public static DiGi.Math.Classes.Matrix3D? operator *(DiGi.Math.Classes.Matrix3D? matrix3D_1, DiGi.Math.Classes.Matrix3D? matrix3D_2);

Parameters

matrix3D_1 Matrix3D

The left-hand side Matrix3D.

matrix3D_2 Matrix3D

The right-hand side Matrix3D.

Returns

Matrix3D
The resulting Matrix3D from the multiplication, or null if either operand is null.

Matrix3D.operator *(Matrix3D, double) Operator

Multiplies each element of the Matrix3D by a scalar value.

public static DiGi.Math.Classes.Matrix3D? operator *(DiGi.Math.Classes.Matrix3D? matrix3D, double value);

Parameters

matrix3D Matrix3D

The Matrix3D instance.

value System.Double

The double value to multiply by.

Returns

Matrix3D
A new Matrix3D containing the result, or null if the matrix is null.

Matrix3D.operator -(Matrix3D, Matrix3D) Operator

Subtracts one Matrix3D from another.

public static DiGi.Math.Classes.Matrix3D? operator -(DiGi.Math.Classes.Matrix3D? matrix3D_1, DiGi.Math.Classes.Matrix3D? matrix3D_2);

Parameters

matrix3D_1 Matrix3D

The first Matrix3D.

matrix3D_2 Matrix3D

The second Matrix3D to subtract from the first.

Returns

Matrix3D
The result of the subtraction as a Matrix3D, or null if either operand is null.

Matrix3D.operator -(Matrix3D, double) Operator

Subtracts a scalar value from each element of the Matrix3D.

public static DiGi.Math.Classes.Matrix3D? operator -(DiGi.Math.Classes.Matrix3D? matrix3D, double value);

Parameters

matrix3D Matrix3D

The Matrix3D instance.

value System.Double

The double value to subtract.

Returns

Matrix3D
A new Matrix3D containing the result, or null if the matrix is null.

Matrix4D Class

Represents a 4x4 square matrix providing mathematical operations and serialization capabilities.

public class Matrix4D : DiGi.Math.Classes.Matrix, DiGi.Math.Interfaces.ISquareMatrix, DiGi.Math.Interfaces.IMatrix, DiGi.Core.Interfaces.ISerializableObject, DiGi.Core.Interfaces.ICloneableObject<DiGi.Core.Interfaces.ISerializableObject>, DiGi.Core.Interfaces.ICloneableObject, DiGi.Core.Interfaces.IObject

Inheritance System.ObjectDiGi.Core.Classes.ObjectDiGi.Core.Classes.SerializableObjectMatrix → Matrix4D

Implements ISquareMatrix, IMatrix, DiGi.Core.Interfaces.ISerializableObject, DiGi.Core.Interfaces.ICloneableObject<DiGi.Core.Interfaces.ISerializableObject>, DiGi.Core.Interfaces.ICloneableObject, DiGi.Core.Interfaces.IObject

Constructors

Matrix4D() Constructor

Initializes a new instance of the Matrix4D class as a 4x4 matrix.

public Matrix4D();

Matrix4D(Matrix4D) Constructor

Initializes a new instance of the Matrix4D class by copying an existing matrix.

public Matrix4D(DiGi.Math.Classes.Matrix4D? matrix4D);

Parameters

matrix4D Matrix4D

The source Matrix4D to copy.

Matrix4D(JsonObject) Constructor

Initializes a new instance of the Matrix4D class using a JSON object.

public Matrix4D(System.Text.Json.Nodes.JsonObject? jsonObject);

Parameters

jsonObject System.Text.Json.Nodes.JsonObject

The System.Text.Json.Nodes.JsonObject containing the matrix data.

Methods

Matrix4D.Clone() Method

Creates a deep copy of the current Matrix4D instance.

public override DiGi.Core.Interfaces.ISerializableObject? Clone();

Implements Clone()

Returns

DiGi.Core.Interfaces.ISerializableObject
A new DiGi.Core.Interfaces.ISerializableObject representing the cloned matrix, or null.

Operators

Matrix4D.operator +(Matrix4D, Matrix4D) Operator

Adds two Matrix4D matrices together.

public static DiGi.Math.Classes.Matrix4D? operator +(DiGi.Math.Classes.Matrix4D? matrix4D_1, DiGi.Math.Classes.Matrix4D? matrix4D_2);

Parameters

matrix4D_1 Matrix4D

The first matrix.

matrix4D_2 Matrix4D

The second matrix to add to the first.

Returns

Matrix4D
The result of the addition as a Matrix4D, or null if either operand is null.

Matrix4D.operator +(Matrix4D, double) Operator

Adds a scalar value to each element of the Matrix4D.

public static DiGi.Math.Classes.Matrix4D? operator +(DiGi.Math.Classes.Matrix4D? matrix4D, double value);

Parameters

matrix4D Matrix4D

The matrix to add to.

value System.Double

The scalar value to add.

Returns

Matrix4D
A new Matrix4D containing the result, or null if the matrix is null.

Matrix4D.explicit operator Matrix4D(double[,]) Operator

Explicitly converts a two-dimensional array of doubles to a Matrix4D.

public static DiGi.Math.Classes.Matrix4D? explicit operator DiGi.Math.Classes.Matrix4D?(double[,]? values);

Parameters

values System.Double[]

The 2D double array containing the matrix elements.

Returns

Matrix4D
A Matrix4D instance created from the values, or null if the input is null.

Matrix4D.operator *(Matrix4D, Matrix4D) Operator

Multiplies two Matrix4D matrices.

public static DiGi.Math.Classes.Matrix4D? operator *(DiGi.Math.Classes.Matrix4D? matrix4D_1, DiGi.Math.Classes.Matrix4D? matrix4D_2);

Parameters

matrix4D_1 Matrix4D

The first matrix.

matrix4D_2 Matrix4D

The second matrix.

Returns

Matrix4D
The result of the multiplication as a Matrix4D, or null if either operand is null.

Matrix4D.operator *(Matrix4D, double) Operator

Multiplies each element of the Matrix4D by a scalar value.

public static DiGi.Math.Classes.Matrix4D? operator *(DiGi.Math.Classes.Matrix4D? matrix4D, double value);

Parameters

matrix4D Matrix4D

The matrix to multiply.

value System.Double

The scalar multiplier.

Returns

Matrix4D
A new Matrix4D containing the result, or null if the matrix is null.

Matrix4D.operator -(Matrix4D, Matrix4D) Operator

Subtracts one Matrix4D from another.

public static DiGi.Math.Classes.Matrix4D? operator -(DiGi.Math.Classes.Matrix4D? matrix4D_1, DiGi.Math.Classes.Matrix4D? matrix4D_2);

Parameters

matrix4D_1 Matrix4D

The first matrix.

matrix4D_2 Matrix4D

The second matrix to subtract from the first.

Returns

Matrix4D
The result of the subtraction as a Matrix4D, or null if either operand is null.

Matrix4D.operator -(Matrix4D, double) Operator

Subtracts a scalar value from each element of the Matrix4D.

public static DiGi.Math.Classes.Matrix4D? operator -(DiGi.Math.Classes.Matrix4D? matrix4D, double value);

Parameters

matrix4D Matrix4D

The matrix to subtract from.

value System.Double

The scalar value to subtract.

Returns

Matrix4D
A new Matrix4D containing the result, or null if the matrix is null.

PolynomialEquation Class

Represents a polynomial equation of the form a(n)*x^(n) + a(n-1)*x^(n-1) + a(n-2)*x^(n-2) + [...] + a(1)*x + a(0) = 0.

public class PolynomialEquation : DiGi.Core.Classes.SerializableObject, DiGi.Math.Interfaces.IEquation, DiGi.Core.Interfaces.ISerializableObject, DiGi.Core.Interfaces.ICloneableObject<DiGi.Core.Interfaces.ISerializableObject>, DiGi.Core.Interfaces.ICloneableObject, DiGi.Core.Interfaces.IObject

Inheritance System.ObjectDiGi.Core.Classes.ObjectDiGi.Core.Classes.SerializableObject → PolynomialEquation

Implements IEquation, DiGi.Core.Interfaces.ISerializableObject, DiGi.Core.Interfaces.ICloneableObject<DiGi.Core.Interfaces.ISerializableObject>, DiGi.Core.Interfaces.ICloneableObject, DiGi.Core.Interfaces.IObject

Constructors

PolynomialEquation(PolynomialEquation) Constructor

Initializes a new instance of the PolynomialEquation class using another PolynomialEquation object.

public PolynomialEquation(DiGi.Math.Classes.PolynomialEquation? polynomialEquation);

Parameters

polynomialEquation PolynomialEquation

The PolynomialEquation to copy from.

PolynomialEquation(IEnumerable<double>) Constructor

Initializes a new instance of the PolynomialEquation class using coefficients.

public PolynomialEquation(System.Collections.Generic.IEnumerable<double>? coefficients);

Parameters

coefficients System.Collections.Generic.IEnumerable<System.Double>

The coefficients of the polynomial equation.

PolynomialEquation(JsonObject) Constructor

Initializes a new instance of the PolynomialEquation class using a System.Text.Json.Nodes.JsonObject.

public PolynomialEquation(System.Text.Json.Nodes.JsonObject? jsonObject);

Parameters

jsonObject System.Text.Json.Nodes.JsonObject

The JSON object containing the polynomial equation data.

Properties

PolynomialEquation.Coefficients Property

Gets the coefficients of the polynomial equation.

public System.Collections.Generic.List<double>? Coefficients { get; }

Property Value

System.Collections.Generic.List<System.Double>

PolynomialEquation.Degree Property

Gets the degree of the polynomial equation.

public int Degree { get; }

Property Value

System.Int32

Methods

PolynomialEquation.Evaluate(double) Method

Evaluates the polynomial equation for a given x value.

public double Evaluate(double value);

Parameters

value System.Double

The x value to evaluate the polynomial equation for.

Implements Evaluate(double)

Returns

System.Double
The result of the polynomial equation.

PolynomialEquation.Evaluate(IEnumerable<double>) Method

Evaluates the polynomial equation for a given set of x values.

public System.Collections.Generic.List<double>? Evaluate(System.Collections.Generic.IEnumerable<double>? values);

Parameters

values System.Collections.Generic.IEnumerable<System.Double>

The x values to evaluate the polynomial equation for.

Implements Evaluate(IEnumerable<double>)

Returns

System.Collections.Generic.List<System.Double>
The results of the polynomial equation.

Operators

PolynomialEquation.explicit operator PolynomialEquation(LinearEquation) Operator

Explicitly converts a LinearEquation to a PolynomialEquation.

public static DiGi.Math.Classes.PolynomialEquation? explicit operator DiGi.Math.Classes.PolynomialEquation?(DiGi.Math.Classes.LinearEquation? linearEquation);

Parameters

linearEquation LinearEquation

The linear equation to convert.

Returns

PolynomialEquation
A PolynomialEquation instance created from the provided linear equation, or null if the input is null.

Clone this wiki locally