Android Programming Press on the image to return to the main documentation page.

MatrixOp

Written by Derez

List of types:

MatrixOp

MatrixOp

The library provides mathematical operations which involve matrices and scalars.
Names used here are :
Matrix is equivalent to Array of two dimensions.
The size is defined by number of rows (the first argument of the array)
and number of columns (second argument).
Vector is an Array of one dimension.
Scalar is a single number.
The library includes:
Operations of a Scalar and a Matrix
Operations between two matrices
Operations on a single matrix
There are no limitations on the size of the matrices or vectors.
There is no checking for incorrect dimensions of the matrices.
If not otherwise defined, all methods return 1 at completion.
The Library makes use of BigDecimal numbers to improve accuracy
by minimizing truncation errors.

Events:

None

Members:


  AddM (Rows As Int, Cols As Int, MatrixA(,) As Double, MatrixB(,) As Double, MatrixC(,) As Double) As Double

  AddS (Rows As Int, Cols As Int, MatrixA(,) As Double, Scalar As Double, MatrixC(,) As Double) As Double

  Clear (Rows As Int, Cols As Int, MatrixA(,) As Double) As Double

  CopyM (Rows As Int, Cols As Int, MatrixA(,) As Double, MatrixC(,) As Double) As Double

  Determinant (Size As Int, MatrixA(,) As Double) As Double

  DivS (Rows As Int, Cols As Int, MatrixA(,) As Double, Scalar As Double, MatrixC(,) As Double) As Double

  DotV (Length As Int, VectorA() As Double, VectorB() As Double) As Double

  Inverse (Size As Int, MatrixA(,) As Double, MatrixC(,) As Double) As Double

  MulM (Rows As Int, Cols As Int, MatrixA(,) As Double, MatrixB(,) As Double, MatrixC(,) As Double) As Double

  MulS (Rows As Int, Cols As Int, MatrixA(,) As Double, Scalar As Double, MatrixC(,) As Double) As Double

  Roundby As Int

  SetRound (Roundto As Int)

  SolveM (Size As Int, MatrixA(,) As Double, Cols As Int, MatrixB(,) As Double, MatrixX(,) As Double) As Double

  SolveV (Size As Int, MatrixA(,) As Double, VectorB() As Double, VectorX() As Double) As Double

  SubM (Rows As Int, Cols As Int, MatrixA(,) As Double, MatrixB(,) As Double, MatrixC(,) As Double) As Double

  SubS (Rows As Int, Cols As Int, MatrixA(,) As Double, Scalar As Double, MatrixC(,) As Double) As Double

  Transpose (Rows As Int, Cols As Int, MatrixA(,) As Double, MatrixC(,) As Double) As Double

Members description:

AddM (Rows As Int, Cols As Int, MatrixA(,) As Double, MatrixB(,) As Double, MatrixC(,) As Double) As Double
Adds two matrices.
Rows and Cols refer to the rows and columns of the three matrices,
MatrixC is the result: MatrixC = MatrixA + MatrixB.
AddS (Rows As Int, Cols As Int, MatrixA(,) As Double, Scalar As Double, MatrixC(,) As Double) As Double
Adds a Scalar to every element of MatrixA.
Rows and Cols refer to the rows and columns of MatrixA
and MatrixC which is the result : MatrixC = MatrixA + Scalar.
Clear (Rows As Int, Cols As Int, MatrixA(,) As Double) As Double
Put zeroes to all elements of MatrixA.
This method is the only method that actually changes
the referenced matrix.
CopyM (Rows As Int, Cols As Int, MatrixA(,) As Double, MatrixC(,) As Double) As Double
Copies MatrixA to MatrixC,
both have to be with the same dimensions Rows and Cols.
Determinant (Size As Int, MatrixA(,) As Double) As Double
The Determinant of the square matrix MatrixA with dimension Size
is returned as double by this method.
DivS (Rows As Int, Cols As Int, MatrixA(,) As Double, Scalar As Double, MatrixC(,) As Double) As Double
Divides every element of MatrixA by a Scalar.
Rows and Cols refer to the rows and columns of MatrixA
and MatrixC which is the result:
MatrixC = MatrixA/Scalar .
DotV (Length As Int, VectorA() As Double, VectorB() As Double) As Double
Dot-multiply two vectors
(each element is multiplied by the parallel element of the other vector
and the result is the sum of all multiplied pairs).
Length refer to the length of the two vectors which must be the same.
The result is returned by the method.
Inverse (Size As Int, MatrixA(,) As Double, MatrixC(,) As Double) As Double
MatrixA is a square matrix with dimension Size.
MatrixC is the inverse of MatrixA.
Returns 0 if the determinant is 0
(hence there is no inverse matrix).
MulM (Rows As Int, Cols As Int, MatrixA(,) As Double, MatrixB(,) As Double, MatrixC(,) As Double) As Double
Vector-Multiply two matrices.
Rows and Cols refer to the rows and columns of MatrixA,
MatrixB has to be with Cols rows and Rows columns,
MatrixC is the result and is of dimension Rows by Rows.
MatrixC = MatrixA X MatrixB.
MulS (Rows As Int, Cols As Int, MatrixA(,) As Double, Scalar As Double, MatrixC(,) As Double) As Double
Multiplies every element of MatrixA by a Scalar.
Rows and Cols refer to the rows and columns of MatrixA
and MatrixC which is the result :
MatrixC = Scalar * MatrixA.
Roundby As Int
SetRound (Roundto As Int)
SolveM (Size As Int, MatrixA(,) As Double, Cols As Int, MatrixB(,) As Double, MatrixX(,) As Double) As Double
Solves a set of linear equations of the form AX = B,
where A is represented by MatrixA, B is represented by MatrixB
and the unknown matrix X is the result MatrixX.
Returns 0 if the determinant is 0 (hence there is no solution).
Size defines the size of the square MatrixA,
Cols define the number of columns in MatrixB and in MatrixX.
SolveV (Size As Int, MatrixA(,) As Double, VectorB() As Double, VectorX() As Double) As Double
Solves a set of linear equations of the form AX = B,
where A is represented by MatrixA, B is represented by VectorB
and the unknowns vector X is the result VectorX.
Returns 0 if the determinant is 0 (hence there is no solution).
Size defines the size of the square MatrixA,
and the length of VectorB and VectorX.
SubM (Rows As Int, Cols As Int, MatrixA(,) As Double, MatrixB(,) As Double, MatrixC(,) As Double) As Double
Adds a Scalar to every element of MatrixA.
Rows and Cols refer to the rows and columns of MatrixA
and MatrixC which is the result : MatrixC = MatrixA + Scalar.
SubS (Rows As Int, Cols As Int, MatrixA(,) As Double, Scalar As Double, MatrixC(,) As Double) As Double
Subtracts a Scalar from every element of MatrixA.
Rows and Cols refer to the rows and columns of MatrixA
and MatrixC which is the result: MatrixC = MatrixA - Scalar.
Transpose (Rows As Int, Cols As Int, MatrixA(,) As Double, MatrixC(,) As Double) As Double
MatrixC is the Transpose of MatrixA which is of
Rows rows and Cols columns.
MatrixC dimensions are Cols rows and Rows columns.
Top