Press on the image to return to the main documentation page. |

A fast and easy to use dense matrix linear algebra library written in Java.

http://code.google.com/p/efficient-java-matrix-library/

Not all the functionality of EJML is exposed to Basic4android

This library exposes SimpleMatrix which is an interface that provides an easy to use

object oriented way of doing linear algebra.

SimpleMatrix

Simplified ways to use popular matrix decompositions are provided.

These decompositions should meet most people needs.

SVD : Computes the singular value decomposition of 'this' matrix.

EIG : Computes the eigen value decomposition of 'this' matrix.

EJML and therefore also this library is licensed under the GNU Lesser General Public License.

http://www.gnu.org/licenses/lgpl.html

Copies of both the General Public License and Lesser General Public License are in the provided archive.

Copyright 2013 Anywhere Software

SimpleMatrix

SimpleSVD

Eigenvalues and eigenvectors have the following property: A*v=λ*v

where A is a square matrix and v is an eigenvector associated with the eigenvalue λ.

In general, both eigenvalues and eigenvectors can be complex numbers.

For symmetric matrices the eigenvalues and eigenvectors are always real numbers.

EJML does not support complex matrices but it does have minimal support for complex numbers.

As a result complex eigenvalues are found, but only the real eigenvectors are computed.

For symmetric matrices the returned eigenvalue will always be a real number,

which means the imaginary component will be equal to zero.

NOTE: The order of the eigenvalues is dependent upon the decomposition algorithm used.

This means that they may or may not be ordered by magnitude.

If an eigenvector is associated with a complex eigenvalue then null is returned instead.

A value close to or less than 1e-15 is considered to be within machine precision.

This function must be called before the original matrix has been modified

or else it will produce meaningless results.

It is a wrapper around the operation interface in EJML and was originally inspired by Jama.

When using SimpleMatrix memory management is automatically handled and it allows commands to be chained

together as many of the operations return the SimpleMatrix itself.

For example A.Transpose().Mult(B).Scale(12).Invert. Such expressions are evaluated left to right.

The typical method in SimpleMatrix takes at least one SimpleMatrix as an input and returns a SimpleMatrix.

None of the input matrices are modified during function calls, a new matrix is always returned.

The names of the methods in this library are as far as possible the names in the original EJML libray.

The EJML documentation should be studied for more information on SimpleMatrix.

SimpleMatrix

B is written into A at the specified location if needed the size of A is increased by growing it.

A is grown by padding the new area with zeros.

While useful when adding data to a matrix which will be solved for it is also much less efficient than

predeclaring a matrix and inserting data into it.

If insertRow or insertCol is set to SimpleMatrix.END then it will be combined at the last row or column respectively.

A value near one indicates that it is a well conditioned matrix.

Eigenvalues and eigenvectors have the following property: A*v=λ*v

where A is a square matrix and v is an eigenvector associated with the eigenvalue λ.

In general, both eigenvalues and eigenvectors can be complex numbers.

For symmetric matrices the eigenvalues and eigenvectors are always real numbers.

EJML does not support complex matrices but it does have minimal support for complex numbers.

As a result complex eigenvalues are found, but only the real eigenvectors are computed.

Returns a SimpleEVD for assignment to a SimpleEVD variable.

This is equivalent the the infinite p-norm of the matrix.

Ci,j = Ai,j*Bi,j

The returned vector will either be a row or column vector depending on the input type.

extractRow - If true a row will be extracted.

element - The row or column the vector is contained in.

Performs a bounds check to make sure the requested element is part of the matrix.

which is equal to the number of rows times the number of columns.

Returns True if an element is NaN or infinite, False otherwise.

It is assumed that 'data' has a row-major formatting: data[ row ][ column ]

Note that

Dim NewMatrix As SimpleMatrix

NewMatrix.Initialize3(OldMatrix)

is identical to

Dim NewMatrix As SimpleMatrix

NewMatrix = OldMatrix.Copy

The values of the diagonal elements are specified by the parameter 'values'.

This method is one of the few that changes this matrix rather returning a new one.

If the matrix could not be inverted then SingularMatrixException is thrown.

Even if no exception is thrown the matrix could still be singular or nearly singular.

C = kron(A,B)

where C is the returned matrix, A is this matrix, and B is the passed in matrix.

where C is the returned matrix, A is this matrix, and B is the passed in matrix.

where C is the returned matrix, A is this matrix, and B is the passed in matrix.

where C is the returned matrix, Z is this matrix, and B is the passed in matrix.

If the total number of elements is <= number of elements it had before the data is saved.

Otherwise a new internal array is declared and the old data lost.

This method is one of the few that changes this matrix rather returning a new one.

For the file format see MatrixIO in the original EJML documentation.

A(offset:(offset + values.length),column) = values

Both matrix must have the same dimension.

A(offset:(offset + values.length),row) = values

where 'A' is this matrix and 'B' is an n by p matrix.

If the system could not be solved then a SingularMatrixException is thrown.

Even if no exception is thrown 'A' could still be singular or nearly singular.

where A is m by n, and U and V are orthogonal matrices, and W is a diagonal matrix.

The eigenvalues are ordered from largest to smallest.

Returns a SimpleSVD for assignment to a SimpleSVD variable.

If compact is True then compact matrices will be returned from the SVD.

See the help for SimpleSVD for a definition of compact matrices.

where A is m by n, and U and V are orthogonal matrices, and W is a diagonal matrix.

The dimension of U,W,V depends if it is a compact SVD or not.

If not compact then U is m by m, *W is m by n, V is n by n.

If compact then let s be the number of singular values, U is m by s, W is s by s, and V is n by s.

The singular values are ordered from largest to smallest.

The null space is a set of non-zero vectors that when multiplied by the original matrix return zero.

The null space is found by extracting the columns in V that are associated singular values less than or equal to the threshold.

In some situations a non-compact SVD is required.

Top