C# Класс LitDev.LDMatrix

Показать файл Открыть проект

Открытые методы

Метод Описание
Add ( Primitive matrix1, Primitive matrix2, Primitive result ) : Primitive

Add two matrices, the number of rows and columns of the 3 matrices given must be the same. Alternatively, if the second matrix is a scalar number then it is added to each element of the first matrix.

Copy ( Primitive matrix1, Primitive matrix2 ) : Primitive

Copy one matrix to an existing matrix. The dimensions of the 2 matrices must be the same.

CopyNew ( Primitive matrix ) : Primitive

Copy one matrix to a new matrix.

CopyToSBArray ( Primitive matrix ) : Primitive

Copy LDMatrix type to SmallBasic array type. The reverse operation (SmallBasic to LDMatrix) isn't possible becuase the SmallBasic indexes are not necessarily contiguous integers.

Create ( Primitive rows, Primitive cols ) : Primitive

Create a matrix object. Row and column matrices can be defined with rows = 1 or cols = 1 respectively.

Delete ( Primitive matrix ) : Primitive

Delete an existing matrix (not generally required, but can save memory if lots of matrices are created).

GetValue ( Primitive matrix, Primitive row, Primitive col ) : Primitive

Get value in matrix.

Inverse ( Primitive matrix, Primitive inverse ) : Primitive

Calculate the inverse of a matrix (using Gaussian Elimination). The number of rows and columns of the matrix and inverse must be the same (square matrices). A singular matrix returns "SINGULAR" and the inverse matrix will be incorrect.

Multiply ( Primitive matrix1, Primitive matrix2, Primitive result ) : Primitive

Multiply two matrices, the number of columns of the first and rows of the second matrix must be the same. The number of rows and columns of the result matrix must be the rows of the first and columns of the second. Alternatively, if the second matrix is a scalar number then it is multiplied by each element of the first matrix and the dimensions of the first and result must be the same.

SetValue ( Primitive matrix, Primitive row, Primitive col, Primitive value ) : Primitive

Set value in matrix.

Transpose ( Primitive matrix, Primitive transpose ) : Primitive

Calculate the transpose of a matrix. The number of rows and columns of the matrix and transpose must be reversed (cols = rows and vice versa).

View ( Primitive matrix, Primitive modal ) : void

View a matrix for dubugging purposes.

Приватные методы

Метод Описание
getMatrix ( string name ) : Matrix
getNewNumber ( ) : int

Описание методов

Add() публичный статический Метод

Add two matrices, the number of rows and columns of the 3 matrices given must be the same. Alternatively, if the second matrix is a scalar number then it is added to each element of the first matrix.
public static Add ( Primitive matrix1, Primitive matrix2, Primitive result ) : Primitive
matrix1 Primitive The first matrix.
matrix2 Primitive The second matrix (or scalar value).
result Primitive The result matrix.
Результат Primitive

Copy() публичный статический Метод

Copy one matrix to an existing matrix. The dimensions of the 2 matrices must be the same.
public static Copy ( Primitive matrix1, Primitive matrix2 ) : Primitive
matrix1 Primitive /// The matrix to copy from. ///
matrix2 Primitive /// The matrix to copy to. ///
Результат Primitive

CopyNew() публичный статический Метод

Copy one matrix to a new matrix.
public static CopyNew ( Primitive matrix ) : Primitive
matrix Primitive /// The matrix to copy. ///
Результат Primitive

CopyToSBArray() публичный статический Метод

Copy LDMatrix type to SmallBasic array type. The reverse operation (SmallBasic to LDMatrix) isn't possible becuase the SmallBasic indexes are not necessarily contiguous integers.
public static CopyToSBArray ( Primitive matrix ) : Primitive
matrix Primitive /// The matrix name. ///
Результат Primitive

Create() публичный статический Метод

Create a matrix object. Row and column matrices can be defined with rows = 1 or cols = 1 respectively.
public static Create ( Primitive rows, Primitive cols ) : Primitive
rows Primitive The number of rows.
cols Primitive The number of columns.
Результат Primitive

Delete() публичный статический Метод

Delete an existing matrix (not generally required, but can save memory if lots of matrices are created).
public static Delete ( Primitive matrix ) : Primitive
matrix Primitive /// The matrix name. ///
Результат Primitive

GetValue() публичный статический Метод

Get value in matrix.
public static GetValue ( Primitive matrix, Primitive row, Primitive col ) : Primitive
matrix Primitive /// The matrix name. ///
row Primitive /// The row at which to get the value (indexed starting from 1). ///
col Primitive /// The column at which to get the value (indexed starting from 1). ///
Результат Primitive

Inverse() публичный статический Метод

Calculate the inverse of a matrix (using Gaussian Elimination). The number of rows and columns of the matrix and inverse must be the same (square matrices). A singular matrix returns "SINGULAR" and the inverse matrix will be incorrect.
public static Inverse ( Primitive matrix, Primitive inverse ) : Primitive
matrix Primitive The matrix to invert (unmodified by inversion).
inverse Primitive The inverse matrix.
Результат Primitive

Multiply() публичный статический Метод

Multiply two matrices, the number of columns of the first and rows of the second matrix must be the same. The number of rows and columns of the result matrix must be the rows of the first and columns of the second. Alternatively, if the second matrix is a scalar number then it is multiplied by each element of the first matrix and the dimensions of the first and result must be the same.
public static Multiply ( Primitive matrix1, Primitive matrix2, Primitive result ) : Primitive
matrix1 Primitive The first matrix.
matrix2 Primitive The second matrix (or scalar value).
result Primitive The result matrix.
Результат Primitive

SetValue() публичный статический Метод

Set value in matrix.
public static SetValue ( Primitive matrix, Primitive row, Primitive col, Primitive value ) : Primitive
matrix Primitive /// The matrix name. ///
row Primitive /// The row at which to add the value (indexed starting from 1). ///
col Primitive /// The column at which to add the value (indexed starting from 1). ///
value Primitive /// The value. ///
Результат Primitive

Transpose() публичный статический Метод

Calculate the transpose of a matrix. The number of rows and columns of the matrix and transpose must be reversed (cols = rows and vice versa).
public static Transpose ( Primitive matrix, Primitive transpose ) : Primitive
matrix Primitive The matrix to transpose.
transpose Primitive The resulting transposed matrix.
Результат Primitive

View() публичный статический Метод

View a matrix for dubugging purposes.
public static View ( Primitive matrix, Primitive modal ) : void
matrix Primitive The matrix to display.
modal Primitive The matrix display will pause all other actions until it is closed. ("True" or "False").
Результат void