LitDev Extension API

Geography LD3DView LDArray LDBits LDBlueTooth
LDCall LDChart LDClient LDClipboard LDColours
LDCommPort LDController LDControls LDCursors LDDataBase
LDDateTime LDDebug LDDialogs LDDictionary LDEffect
LDEmail LDEncryption LDEvents LDFastArray LDFastShapes
LDFigures LDFile LDFocus LDftp LDGeography
LDGraph LDGraphicsWindow LDHashTable LDHID LDIcon
LDImage LDInline LDIOWarrior LDList LDLogic
LDMath LDMathX LDMatrix LDMusic LDNetwork
LDPhysics LDProcess LDQueue LDRegex LDResources
LDScrollBars LDSearch LDServer LDSettings LDShapes
LDShell LDSort LDSound LDSpeech LDStatistics
LDStopwatch LDText LDTextWindow LDTimer LDTranslate
LDUnits LDUtilities LDVector LDWaveForm LDWebCam
LDWindows LDxml LDZip

LDMatrix
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)
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)
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)
Copy one matrix to a new matrix.
matrix The matrix to copy.
returns A copy of the matrix or "FAILED".

CopyToSBArray(matrix)
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)
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)
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)
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)
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)
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)
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)
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)
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.