Procedural

From Efficient Java Matrix Library
Revision as of 06:11, 18 May 2017 by Peter (talk | contribs)
Jump to navigation Jump to search

The procedural interface in EJML provides access to all of its capabilities and provides much more control over which algorithms are used and when memory is created. The downside to this increased control is the added difficulty in programming, kinda resembles writing in assembly. Code can be made very efficient, but managing all the temporary data structures can be tedious.

The procedural supports all matrix types in EJML and follows a consistent naming pattern across all matrix types. Ops classes end in a suffix that indicate which type of matrix they can process. From the matrix name you can determine the type of element (float,double,real,complex) and it's internal data structure, e.g. row-major or block. In general, almost everyone will want to interact with row major matrices. Conversion to block format is done automatically internally when it becomes advantageous.

NOTE: In previous versions of EJML the matrix DMatrixRMaj was known as DenseMatrix64F.

Matrix Name Description
DMatrixRMaj Dense Double Real Matrix - Row Major
FMatrixRMaj Dense Float Real Matrix - Row Major
ZDMatrixRMaj Dense Double Complex Matrix - Row Major
CDMatrixRMaj Dense Float Complex Matrix - Row Major
DMatrixNxN Fixed Size Dense Real Matrix
DMatrixN Fixed Size Dense Real Vector

The list of ops suffixes is listed below and the related matrix type. Through out the manual we will default to DMatrixRMaj unless there is a specific need to do otherwise.

Ops Suffix Matrix Type
DDRM DMatrixRMaj
FDRM FMatrixRMaj
ZDRM ZMatrixRMaj
CDRM CMatrixRMaj

DenseMatrix Types

Accessors

  • get( row , col )
  • set( row , col , value )
    • Returns or sets the value of an element at the specified row and column.
  • unsafe_get( row , col )
  • unsafe_set( row , col , value )
    • Faster version of get() or set() that does not perform bounds checking.
  • get( index )
  • set( index )
    • Returns or sets the value of an element at the specified index. Useful for vectors and element-wise operations.
  • iterator( boolean rowMajor, int minRow, int minCol, int maxRow, int maxCol )
    • An iterator that iterates through the sub-matrix by row or by column.

Operations

Several "Ops" classes provide functions for manipulating different types of matrices and most are contained inside of the org.ejml.dense.* package, where * is replaced with the matrix structure package type, e.g. row for row-major. The list below is provided for DMatrixRMaj, other matrix can be found by changing the suffix as discussed above.

{{{2}}}
Provides the most common matrix operations.
{{{2}}}
Provides operations related to eigenvalues and eigenvectors.
{{{2}}}
Used to compute various features related to a matrix.
{{{2}}}
Operations for computing different matrix norms.
{{{2}}}
Operations related to singular value decompositions.
{{{2}}}
Grab bag for operations which do not fit in anywhere else.
{{{2}}}
Used to create different types of random matrices.

For fixed sized matrices FixedOpsN is provided, where N = 2 to 6. FixedOpsN is similar in functionality to CommonOps.