org.ejml.data
Class Matrix64F

java.lang.Object
  extended by org.ejml.data.Matrix64F
All Implemented Interfaces:
Serializable
Direct Known Subclasses:
D1Matrix64F

public abstract class Matrix64F
extends Object
implements Serializable

An abstract class for all 64 bit floating point rectangular matrices.

Author:
Peter Abeles
See Also:
Serialized Form

Field Summary
 int numCols
          Number of columns in the matrix.
 int numRows
          Number of rows in the matrix.
 
Constructor Summary
Matrix64F()
           
 
Method Summary
abstract
<T extends Matrix64F>
T
copy()
           
abstract  double get(int row, int col)
          Returns the value of value of the specified matrix element.
 int getNumCols()
          Returns the number of columns in this matrix.
abstract  int getNumElements()
          Returns the number of elements in this matrix, which is the number of rows times the number of columns.
 int getNumRows()
          Returns the number of rows in this matrix.
 MatrixIterator iterator(boolean rowMajor, int minRow, int minCol, int maxRow, int maxCol)
          Creates a new iterator for traversing through a submatrix inside this matrix.
abstract  void print()
           
 void reshape(int numRows, int numCols)
          Equivalent to invoking reshape(numRows,numCols,false);
abstract  void reshape(int numRows, int numCols, boolean saveValues)
           Changes the number of rows and columns in the matrix, allowing its size to grow or shrink.
abstract  void set(int row, int col, double val)
          Sets the value of the specified matrix element.
 void set(Matrix64F A)
          Assigns the value of 'this' matrix to be the same as 'A'.
abstract  double unsafe_get(int row, int col)
          Same as get(int, int) but does not perform bounds check on input parameters.
abstract  void unsafe_set(int row, int col, double val)
          Same as set(int, int, double) but does not perform bounds check on input parameters.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

numRows

public int numRows
Number of rows in the matrix.


numCols

public int numCols
Number of columns in the matrix.

Constructor Detail

Matrix64F

public Matrix64F()
Method Detail

reshape

public abstract void reshape(int numRows,
                             int numCols,
                             boolean saveValues)

Changes the number of rows and columns in the matrix, allowing its size to grow or shrink. If the saveValues flag is set to true, then the previous values will be maintained, but reassigned to new elements in a row-major ordering. If saveValues is false values will only be maintained when the requested size is less than or equal to the internal array size. The primary use for this function is to encourage data reuse and avoid unnecessarily declaring and initialization of new memory.

Examples:
[ 1 2 ; 3 4 ] -> reshape( 2 , 3 , true ) = [ 1 2 3 ; 4 0 0 ]
[ 1 2 ; 3 4 ] -> reshape( 1 , 2 , true ) = [ 1 2 ]
[ 1 2 ; 3 4 ] -> reshape( 1 , 2 , false ) = [ 1 2 ]
[ 1 2 ; 3 4 ] -> reshape( 2 , 3 , false ) = [ 0 0 0 ; 0 0 0 ]

Parameters:
numRows - The new number of rows in the matrix.
numCols - The new number of columns in the matrix.
saveValues - If true then the value of each element will be save using a row-major reordering. Typically this should be false.

reshape

public void reshape(int numRows,
                    int numCols)
Equivalent to invoking reshape(numRows,numCols,false);

Parameters:
numRows - The new number of rows in the matrix.
numCols - The new number of columns in the matrix.

get

public abstract double get(int row,
                           int col)
Returns the value of value of the specified matrix element.

Parameters:
row - Matrix element's row index..
col - Matrix element's column index.
Returns:
The specified element's value.

unsafe_get

public abstract double unsafe_get(int row,
                                  int col)
Same as get(int, int) but does not perform bounds check on input parameters. This results in about a 25% speed increase but potentially sacrifices stability and makes it more difficult to track down simple errors. It is not recommended that this function be used, except in highly optimized code where the bounds are implicitly being checked.

Parameters:
row - Matrix element's row index..
col - Matrix element's column index.
Returns:
The specified element's value.

set

public abstract void set(int row,
                         int col,
                         double val)
Sets the value of the specified matrix element.

Parameters:
row - Matrix element's row index..
col - Matrix element's column index.
val - The element's new value.

unsafe_set

public abstract void unsafe_set(int row,
                                int col,
                                double val)
Same as set(int, int, double) but does not perform bounds check on input parameters. This results in about a 25% speed increase but potentially sacrifices stability and makes it more difficult to track down simple errors. It is not recommended that this function be used, except in highly optimized code where the bounds are implicitly being checked.

Parameters:
row - Matrix element's row index..
col - Matrix element's column index.
val - The element's new value.

iterator

public MatrixIterator iterator(boolean rowMajor,
                               int minRow,
                               int minCol,
                               int maxRow,
                               int maxCol)
Creates a new iterator for traversing through a submatrix inside this matrix. It can be traversed by row or by column. Range of elements is inclusive, e.g. minRow = 0 and maxRow = 1 will include rows 0 and 1. The iteration starts at (minRow,minCol) and ends at (maxRow,maxCol)

Parameters:
rowMajor - true means it will traverse through the submatrix by row first, false by columns.
minRow - first row it will start at.
minCol - first column it will start at.
maxRow - last row it will stop at.
maxCol - last column it will stop at.
Returns:
A new MatrixIterator

getNumRows

public int getNumRows()
Returns the number of rows in this matrix.

Returns:
Number of rows.

getNumCols

public int getNumCols()
Returns the number of columns in this matrix.

Returns:
Number of columns.

getNumElements

public abstract int getNumElements()
Returns the number of elements in this matrix, which is the number of rows times the number of columns.

Returns:
Number of elements in this matrix.

set

public void set(Matrix64F A)
Assigns the value of 'this' matrix to be the same as 'A'. The shape of both matrices must be the same.

Parameters:
A - The matrix whose value is to be copied into 'this'.

copy

public abstract <T extends Matrix64F> T copy()

print

public abstract void print()


Copyright © 2012. All Rights Reserved.