LitDev Extension API
LDMatrix
![](images/IntellisenseObject.png)
A 2-Dimensional matrix structure that can be used to solve linear equations or other methods.
An error will result in a return value "FAILED";
Add
![]() |
Copy
![]() |
CopyNew
![]() |
CopyToSBArray
![]() |
Create
![]() |
Delete
![]() |
GetValue
![]() |
Inverse
![]() |
Multiply
![]() |
SetValue
![]() |
Transpose
![]() |
View
![]() |
Add(matrix1,matrix2,result)
![](images/IntellisenseMethod.png)
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.
matrix1 The first matrix.
matrix2 The second matrix (or scalar value).
result The result matrix.
returns "FAILED" or "" for success.
Copy(matrix1,matrix2)
![](images/IntellisenseMethod.png)
Copy one matrix to an existing matrix.
The dimensions of the 2 matrices must be the same.
matrix1 The matrix to copy from.
matrix2 The matrix to copy to.
returns "FAILED" or "" for success.
CopyNew(matrix)
![](images/IntellisenseMethod.png)
Copy one matrix to a new matrix.
matrix The matrix to copy.
returns A copy of the matrix or "FAILED".
CopyToSBArray(matrix)
![](images/IntellisenseMethod.png)
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.
matrix The matrix name.
returns The SmallBasic array or "FAILED".
Create(rows,cols)
![](images/IntellisenseMethod.png)
Create a matrix object.
Row and column matrices can be defined with rows = 1 or cols = 1 respectively.
rows The number of rows.
cols The number of columns.
returns The matrix or "FAILED".
Delete(matrix)
![](images/IntellisenseMethod.png)
Delete an existing matrix (not generally required, but can save memory if lots of matrices are created).
matrix The matrix name.
returns "FAILED" or "" for success.
GetValue(matrix,row,col)
![](images/IntellisenseMethod.png)
Get value in matrix.
matrix The matrix name.
row The row at which to get the value (indexed starting from 1).
col The column at which to get the value (indexed starting from 1).
returns The value or "FAILED".
Inverse(matrix,inverse)
![](images/IntellisenseMethod.png)
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.
matrix The matrix to invert (unmodified by inversion).
inverse The inverse matrix.
returns "FAILED" or "SINGULAR" or "" for success.
Multiply(matrix1,matrix2,result)
![](images/IntellisenseMethod.png)
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.
matrix1 The first matrix.
matrix2 The second matrix (or scalar value).
result The result matrix.
returns "FAILED" or "" for success.
SetValue(matrix,row,col,value)
![](images/IntellisenseMethod.png)
Set value in matrix.
matrix The matrix name.
row The row at which to add the value (indexed starting from 1).
col The column at which to add the value (indexed starting from 1).
value The value.
returns "FAILED" or "" for success.
Transpose(matrix,transpose)
![](images/IntellisenseMethod.png)
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).
matrix The matrix to transpose.
transpose The resulting transposed matrix.
returns "FAILED" or "" for success.
View(matrix,modal)
![](images/IntellisenseMethod.png)
View a matrix for dubugging purposes.
matrix The matrix to display.
modal The matrix display will pause all other actions until it is closed. ("True" or "False").
returns None.