org.apache.commons.math.linear
Class Array2DRowFieldMatrix<T extends FieldElement<T>>

java.lang.Object
  extended by org.apache.commons.math.linear.AbstractFieldMatrix<T>
      extended by org.apache.commons.math.linear.Array2DRowFieldMatrix<T>
Type Parameters:
T - the type of the field elements
All Implemented Interfaces:
Serializable, AnyMatrix, FieldMatrix<T>

public class Array2DRowFieldMatrix<T extends FieldElement<T>>
extends AbstractFieldMatrix<T>
implements Serializable

Implementation of FieldMatrix using a FieldElement[][] array to store entries.

As specified in the FieldMatrix interface, matrix element indexing is 0-based -- e.g., getEntry(0, 0) returns the element in the first row, first column of the matrix.

Version:
$Revision: 1073158 $ $Date: 2011-02-21 22:46:52 +0100 (lun. 21 févr. 2011) $
See Also:
Serialized Form

Field Summary
protected  T[][] data
          Entries of the matrix
 
Constructor Summary
Array2DRowFieldMatrix(Field<T> field)
          Creates a matrix with no data
Array2DRowFieldMatrix(Field<T> field, int rowDimension, int columnDimension)
          Create a new FieldMatrix with the supplied row and column dimensions.
Array2DRowFieldMatrix(T[] v)
          Create a new (column) FieldMatrix using v as the data for the unique column of the v.length x 1 matrix created.
Array2DRowFieldMatrix(T[][] d)
          Create a new FieldMatrix using the input array as the underlying data array.
Array2DRowFieldMatrix(T[][] d, boolean copyArray)
          Create a new FieldMatrix using the input array as the underlying data array.
 
Method Summary
 Array2DRowFieldMatrix<T> add(Array2DRowFieldMatrix<T> m)
          Compute the sum of this and m.
 FieldMatrix<T> add(FieldMatrix<T> m)
          Compute the sum of this and m.
 void addToEntry(int row, int column, T increment)
          Change an entry in the specified row and column.
 FieldMatrix<T> copy()
          Returns a (deep) copy of this.
 FieldMatrix<T> createMatrix(int rowDimension, int columnDimension)
          Create a new FieldMatrix of the same type as the instance with the supplied row and column dimensions.
 int getColumnDimension()
          Returns the number of columns in the matrix.
 T[][] getData()
          Returns matrix entries as a two-dimensional array.
 T[][] getDataRef()
          Returns a reference to the underlying data array.
 T getEntry(int row, int column)
          Returns the entry in the specified row and column.
 int getRowDimension()
          Returns the number of rows in the matrix.
 Array2DRowFieldMatrix<T> multiply(Array2DRowFieldMatrix<T> m)
          Returns the result of postmultiplying this by m.
 FieldMatrix<T> multiply(FieldMatrix<T> m)
          Returns the result of postmultiplying this by m.
 void multiplyEntry(int row, int column, T factor)
          Change an entry in the specified row and column.
 T[] operate(T[] v)
          Returns the result of multiplying this by the vector v.
 T[] preMultiply(T[] v)
          Returns the (row) vector result of premultiplying this by the vector v.
 void setEntry(int row, int column, T value)
          Set the entry in the specified row and column.
 void setSubMatrix(T[][] subMatrix, int row, int column)
          Replace the submatrix starting at row, column using data in the input subMatrix array.
 Array2DRowFieldMatrix<T> subtract(Array2DRowFieldMatrix<T> m)
          Compute this minus m.
 FieldMatrix<T> subtract(FieldMatrix<T> m)
          Compute this minus m.
 T walkInColumnOrder(FieldMatrixChangingVisitor<T> visitor)
          Visit (and possibly change) all matrix entries in column order.
 T walkInColumnOrder(FieldMatrixChangingVisitor<T> visitor, int startRow, int endRow, int startColumn, int endColumn)
          Visit (and possibly change) some matrix entries in column order.
 T walkInColumnOrder(FieldMatrixPreservingVisitor<T> visitor)
          Visit (but don't change) all matrix entries in column order.
 T walkInColumnOrder(FieldMatrixPreservingVisitor<T> visitor, int startRow, int endRow, int startColumn, int endColumn)
          Visit (but don't change) some matrix entries in column order.
 T walkInRowOrder(FieldMatrixChangingVisitor<T> visitor)
          Visit (and possibly change) all matrix entries in row order.
 T walkInRowOrder(FieldMatrixChangingVisitor<T> visitor, int startRow, int endRow, int startColumn, int endColumn)
          Visit (and possibly change) some matrix entries in row order.
 T walkInRowOrder(FieldMatrixPreservingVisitor<T> visitor)
          Visit (but don't change) all matrix entries in row order.
 T walkInRowOrder(FieldMatrixPreservingVisitor<T> visitor, int startRow, int endRow, int startColumn, int endColumn)
          Visit (but don't change) some matrix entries in row order.
 
Methods inherited from class org.apache.commons.math.linear.AbstractFieldMatrix
buildArray, buildArray, checkAdditionCompatible, checkColumnIndex, checkMultiplicationCompatible, checkRowIndex, checkSubMatrixIndex, checkSubMatrixIndex, checkSubtractionCompatible, copySubMatrix, copySubMatrix, equals, extractField, extractField, getColumn, getColumnMatrix, getColumnVector, getField, getRow, getRowMatrix, getRowVector, getSubMatrix, getSubMatrix, getTrace, hashCode, isSquare, operate, preMultiply, preMultiply, scalarAdd, scalarMultiply, setColumn, setColumnMatrix, setColumnVector, setRow, setRowMatrix, setRowVector, toString, transpose, walkInOptimizedOrder, walkInOptimizedOrder, walkInOptimizedOrder, walkInOptimizedOrder
 
Methods inherited from class java.lang.Object
clone, finalize, getClass, notify, notifyAll, wait, wait, wait
 

Field Detail

data

protected T extends FieldElement<T>[][] data
Entries of the matrix

Constructor Detail

Array2DRowFieldMatrix

public Array2DRowFieldMatrix(Field<T> field)
Creates a matrix with no data

Parameters:
field - field to which the elements belong

Array2DRowFieldMatrix

public Array2DRowFieldMatrix(Field<T> field,
                             int rowDimension,
                             int columnDimension)
                      throws IllegalArgumentException
Create a new FieldMatrix with the supplied row and column dimensions.

Parameters:
field - field to which the elements belong
rowDimension - the number of rows in the new matrix
columnDimension - the number of columns in the new matrix
Throws:
IllegalArgumentException - if row or column dimension is not positive

Array2DRowFieldMatrix

public Array2DRowFieldMatrix(T[][] d)
                      throws IllegalArgumentException,
                             NullPointerException
Create a new FieldMatrix using the input array as the underlying data array.

The input array is copied, not referenced. This constructor has the same effect as calling Array2DRowFieldMatrix(FieldElement[][], boolean) with the second argument set to true.

Parameters:
d - data for new matrix
Throws:
IllegalArgumentException - if d is not rectangular (not all rows have the same length) or empty
NullPointerException - if d is null
See Also:
Array2DRowFieldMatrix(FieldElement[][], boolean)

Array2DRowFieldMatrix

public Array2DRowFieldMatrix(T[][] d,
                             boolean copyArray)
                      throws IllegalArgumentException,
                             NullPointerException
Create a new FieldMatrix using the input array as the underlying data array.

If an array is built specially in order to be embedded in a FieldMatrix and not used directly, the copyArray may be set to false

Parameters:
d - data for new matrix
copyArray - if true, the input array will be copied, otherwise it will be referenced
Throws:
IllegalArgumentException - if d is not rectangular (not all rows have the same length) or empty
NullPointerException - if d is null
See Also:
Array2DRowFieldMatrix(FieldElement[][])

Array2DRowFieldMatrix

public Array2DRowFieldMatrix(T[] v)
Create a new (column) FieldMatrix using v as the data for the unique column of the v.length x 1 matrix created.

The input array is copied, not referenced.

Parameters:
v - column vector holding data for new matrix
Method Detail

createMatrix

public FieldMatrix<T> createMatrix(int rowDimension,
                                   int columnDimension)
                                                    throws IllegalArgumentException
Create a new FieldMatrix of the same type as the instance with the supplied row and column dimensions.

Specified by:
createMatrix in interface FieldMatrix<T extends FieldElement<T>>
Specified by:
createMatrix in class AbstractFieldMatrix<T extends FieldElement<T>>
Parameters:
rowDimension - the number of rows in the new matrix
columnDimension - the number of columns in the new matrix
Returns:
a new matrix of the same type as the instance
Throws:
IllegalArgumentException - if row or column dimension is not positive

copy

public FieldMatrix<T> copy()
Returns a (deep) copy of this.

Specified by:
copy in interface FieldMatrix<T extends FieldElement<T>>
Specified by:
copy in class AbstractFieldMatrix<T extends FieldElement<T>>
Returns:
matrix copy

add

public FieldMatrix<T> add(FieldMatrix<T> m)
                                           throws IllegalArgumentException
Compute the sum of this and m.

Specified by:
add in interface FieldMatrix<T extends FieldElement<T>>
Overrides:
add in class AbstractFieldMatrix<T extends FieldElement<T>>
Parameters:
m - matrix to be added
Returns:
this + m
Throws:
IllegalArgumentException - if m is not the same size as this

add

public Array2DRowFieldMatrix<T> add(Array2DRowFieldMatrix<T> m)
                                                     throws IllegalArgumentException
Compute the sum of this and m.

Parameters:
m - matrix to be added
Returns:
this + m
Throws:
IllegalArgumentException - if m is not the same size as this

subtract

public FieldMatrix<T> subtract(FieldMatrix<T> m)
                                                throws IllegalArgumentException
Compute this minus m.

Specified by:
subtract in interface FieldMatrix<T extends FieldElement<T>>
Overrides:
subtract in class AbstractFieldMatrix<T extends FieldElement<T>>
Parameters:
m - matrix to be subtracted
Returns:
this + m
Throws:
IllegalArgumentException - if m is not the same size as this

subtract

public Array2DRowFieldMatrix<T> subtract(Array2DRowFieldMatrix<T> m)
                                                          throws IllegalArgumentException
Compute this minus m.

Parameters:
m - matrix to be subtracted
Returns:
this + m
Throws:
IllegalArgumentException - if m is not the same size as this

multiply

public FieldMatrix<T> multiply(FieldMatrix<T> m)
                                                throws IllegalArgumentException
Returns the result of postmultiplying this by m.

Specified by:
multiply in interface FieldMatrix<T extends FieldElement<T>>
Overrides:
multiply in class AbstractFieldMatrix<T extends FieldElement<T>>
Parameters:
m - matrix to postmultiply by
Returns:
this * m
Throws:
IllegalArgumentException - if columnDimension(this) != rowDimension(m)

multiply

public Array2DRowFieldMatrix<T> multiply(Array2DRowFieldMatrix<T> m)
                                                          throws IllegalArgumentException
Returns the result of postmultiplying this by m.

Parameters:
m - matrix to postmultiply by
Returns:
this*m
Throws:
IllegalArgumentException - if columnDimension(this) != rowDimension(m)

getData

public T[][] getData()
Returns matrix entries as a two-dimensional array.

Specified by:
getData in interface FieldMatrix<T extends FieldElement<T>>
Overrides:
getData in class AbstractFieldMatrix<T extends FieldElement<T>>
Returns:
2-dimensional array of entries

getDataRef

public T[][] getDataRef()
Returns a reference to the underlying data array.

Does not make a fresh copy of the underlying data.

Returns:
2-dimensional array of entries

setSubMatrix

public void setSubMatrix(T[][] subMatrix,
                         int row,
                         int column)
                  throws MatrixIndexException
Replace the submatrix starting at row, column using data in the input subMatrix array. Indexes are 0-based.

Example:
Starting with

 1  2  3  4
 5  6  7  8
 9  0  1  2
 
and subMatrix = {{3, 4} {5,6}}, invoking setSubMatrix(subMatrix,1,1)) will result in
 1  2  3  4
 5  3  4  8
 9  5  6  2
 

Specified by:
setSubMatrix in interface FieldMatrix<T extends FieldElement<T>>
Overrides:
setSubMatrix in class AbstractFieldMatrix<T extends FieldElement<T>>
Parameters:
subMatrix - array containing the submatrix replacement data
row - row coordinate of the top, left element to be replaced
column - column coordinate of the top, left element to be replaced
Throws:
MatrixIndexException - if subMatrix does not fit into this matrix from element in (row, column)

getEntry

public T getEntry(int row,
                  int column)
                                   throws MatrixIndexException
Returns the entry in the specified row and column.

Row and column indices start at 0 and must satisfy

  • 0 <= row < rowDimension
  • 0 <= column < columnDimension
otherwise a MatrixIndexException is thrown.

Specified by:
getEntry in interface FieldMatrix<T extends FieldElement<T>>
Specified by:
getEntry in class AbstractFieldMatrix<T extends FieldElement<T>>
Parameters:
row - row location of entry to be fetched
column - column location of entry to be fetched
Returns:
matrix entry in row,column
Throws:
MatrixIndexException - if the row or column index is not valid

setEntry

public void setEntry(int row,
                     int column,
                     T value)
              throws MatrixIndexException
Set the entry in the specified row and column.

Row and column indices start at 0 and must satisfy

  • 0 <= row < rowDimension
  • 0 <= column < columnDimension
otherwise a MatrixIndexException is thrown.

Specified by:
setEntry in interface FieldMatrix<T extends FieldElement<T>>
Specified by:
setEntry in class AbstractFieldMatrix<T extends FieldElement<T>>
Parameters:
row - row location of entry to be set
column - column location of entry to be set
value - matrix entry to be set in row,column
Throws:
MatrixIndexException - if the row or column index is not valid

addToEntry

public void addToEntry(int row,
                       int column,
                       T increment)
                throws MatrixIndexException
Change an entry in the specified row and column.

Row and column indices start at 0 and must satisfy

  • 0 <= row < rowDimension
  • 0 <= column < columnDimension
otherwise a MatrixIndexException is thrown.

Specified by:
addToEntry in interface FieldMatrix<T extends FieldElement<T>>
Specified by:
addToEntry in class AbstractFieldMatrix<T extends FieldElement<T>>
Parameters:
row - row location of entry to be set
column - column location of entry to be set
increment - value to add to the current matrix entry in row,column
Throws:
MatrixIndexException - if the row or column index is not valid

multiplyEntry

public void multiplyEntry(int row,
                          int column,
                          T factor)
                   throws MatrixIndexException
Change an entry in the specified row and column.

Row and column indices start at 0 and must satisfy

  • 0 <= row < rowDimension
  • 0 <= column < columnDimension
otherwise a MatrixIndexException is thrown.

Specified by:
multiplyEntry in interface FieldMatrix<T extends FieldElement<T>>
Specified by:
multiplyEntry in class AbstractFieldMatrix<T extends FieldElement<T>>
Parameters:
row - row location of entry to be set
column - column location of entry to be set
factor - multiplication factor for the current matrix entry in row,column
Throws:
MatrixIndexException - if the row or column index is not valid

getRowDimension

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

Specified by:
getRowDimension in interface AnyMatrix
Specified by:
getRowDimension in class AbstractFieldMatrix<T extends FieldElement<T>>
Returns:
rowDimension

getColumnDimension

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

Specified by:
getColumnDimension in interface AnyMatrix
Specified by:
getColumnDimension in class AbstractFieldMatrix<T extends FieldElement<T>>
Returns:
columnDimension

operate

public T[] operate(T[] v)
                                    throws IllegalArgumentException
Returns the result of multiplying this by the vector v.

Specified by:
operate in interface FieldMatrix<T extends FieldElement<T>>
Overrides:
operate in class AbstractFieldMatrix<T extends FieldElement<T>>
Parameters:
v - the vector to operate on
Returns:
this*v
Throws:
IllegalArgumentException - if columnDimension != v.size()

preMultiply

public T[] preMultiply(T[] v)
                                        throws IllegalArgumentException
Returns the (row) vector result of premultiplying this by the vector v.

Specified by:
preMultiply in interface FieldMatrix<T extends FieldElement<T>>
Overrides:
preMultiply in class AbstractFieldMatrix<T extends FieldElement<T>>
Parameters:
v - the row vector to premultiply by
Returns:
v*this
Throws:
IllegalArgumentException - if rowDimension != v.size()

walkInRowOrder

public T walkInRowOrder(FieldMatrixChangingVisitor<T> visitor)
                                         throws MatrixVisitorException
Visit (and possibly change) all matrix entries in row order.

Row order starts at upper left and iterating through all elements of a row from left to right before going to the leftmost element of the next row.

Specified by:
walkInRowOrder in interface FieldMatrix<T extends FieldElement<T>>
Overrides:
walkInRowOrder in class AbstractFieldMatrix<T extends FieldElement<T>>
Parameters:
visitor - visitor used to process all matrix entries
Returns:
the value returned by FieldMatrixChangingVisitor.end() at the end of the walk
Throws:
MatrixVisitorException - if the visitor cannot process an entry
See Also:
FieldMatrix.walkInRowOrder(FieldMatrixPreservingVisitor), FieldMatrix.walkInRowOrder(FieldMatrixChangingVisitor, int, int, int, int), FieldMatrix.walkInRowOrder(FieldMatrixPreservingVisitor, int, int, int, int), FieldMatrix.walkInColumnOrder(FieldMatrixChangingVisitor), FieldMatrix.walkInColumnOrder(FieldMatrixPreservingVisitor), FieldMatrix.walkInColumnOrder(FieldMatrixChangingVisitor, int, int, int, int), FieldMatrix.walkInColumnOrder(FieldMatrixPreservingVisitor, int, int, int, int), FieldMatrix.walkInOptimizedOrder(FieldMatrixChangingVisitor), FieldMatrix.walkInOptimizedOrder(FieldMatrixPreservingVisitor), FieldMatrix.walkInOptimizedOrder(FieldMatrixChangingVisitor, int, int, int, int), FieldMatrix.walkInOptimizedOrder(FieldMatrixPreservingVisitor, int, int, int, int)

walkInRowOrder

public T walkInRowOrder(FieldMatrixPreservingVisitor<T> visitor)
                                         throws MatrixVisitorException
Visit (but don't change) all matrix entries in row order.

Row order starts at upper left and iterating through all elements of a row from left to right before going to the leftmost element of the next row.

Specified by:
walkInRowOrder in interface FieldMatrix<T extends FieldElement<T>>
Overrides:
walkInRowOrder in class AbstractFieldMatrix<T extends FieldElement<T>>
Parameters:
visitor - visitor used to process all matrix entries
Returns:
the value returned by FieldMatrixPreservingVisitor.end() at the end of the walk
Throws:
MatrixVisitorException - if the visitor cannot process an entry
See Also:
FieldMatrix.walkInRowOrder(FieldMatrixChangingVisitor), FieldMatrix.walkInRowOrder(FieldMatrixChangingVisitor, int, int, int, int), FieldMatrix.walkInRowOrder(FieldMatrixPreservingVisitor, int, int, int, int), FieldMatrix.walkInColumnOrder(FieldMatrixChangingVisitor), FieldMatrix.walkInColumnOrder(FieldMatrixPreservingVisitor), FieldMatrix.walkInColumnOrder(FieldMatrixChangingVisitor, int, int, int, int), FieldMatrix.walkInColumnOrder(FieldMatrixPreservingVisitor, int, int, int, int), FieldMatrix.walkInOptimizedOrder(FieldMatrixChangingVisitor), FieldMatrix.walkInOptimizedOrder(FieldMatrixPreservingVisitor), FieldMatrix.walkInOptimizedOrder(FieldMatrixChangingVisitor, int, int, int, int), FieldMatrix.walkInOptimizedOrder(FieldMatrixPreservingVisitor, int, int, int, int)

walkInRowOrder

public T walkInRowOrder(FieldMatrixChangingVisitor<T> visitor,
                        int startRow,
                        int endRow,
                        int startColumn,
                        int endColumn)
                                         throws MatrixIndexException,
                                                MatrixVisitorException
Visit (and possibly change) some matrix entries in row order.

Row order starts at upper left and iterating through all elements of a row from left to right before going to the leftmost element of the next row.

Specified by:
walkInRowOrder in interface FieldMatrix<T extends FieldElement<T>>
Overrides:
walkInRowOrder in class AbstractFieldMatrix<T extends FieldElement<T>>
Parameters:
visitor - visitor used to process all matrix entries
startRow - Initial row index
endRow - Final row index (inclusive)
startColumn - Initial column index
endColumn - Final column index
Returns:
the value returned by FieldMatrixChangingVisitor.end() at the end of the walk
Throws:
MatrixIndexException - if the indices are not valid
MatrixVisitorException - if the visitor cannot process an entry
See Also:
FieldMatrix.walkInRowOrder(FieldMatrixChangingVisitor), FieldMatrix.walkInRowOrder(FieldMatrixPreservingVisitor), FieldMatrix.walkInRowOrder(FieldMatrixPreservingVisitor, int, int, int, int), FieldMatrix.walkInColumnOrder(FieldMatrixChangingVisitor), FieldMatrix.walkInColumnOrder(FieldMatrixPreservingVisitor), FieldMatrix.walkInColumnOrder(FieldMatrixChangingVisitor, int, int, int, int), FieldMatrix.walkInColumnOrder(FieldMatrixPreservingVisitor, int, int, int, int), FieldMatrix.walkInOptimizedOrder(FieldMatrixChangingVisitor), FieldMatrix.walkInOptimizedOrder(FieldMatrixPreservingVisitor), FieldMatrix.walkInOptimizedOrder(FieldMatrixChangingVisitor, int, int, int, int), FieldMatrix.walkInOptimizedOrder(FieldMatrixPreservingVisitor, int, int, int, int)

walkInRowOrder

public T walkInRowOrder(FieldMatrixPreservingVisitor<T> visitor,
                        int startRow,
                        int endRow,
                        int startColumn,
                        int endColumn)
                                         throws MatrixIndexException,
                                                MatrixVisitorException
Visit (but don't change) some matrix entries in row order.

Row order starts at upper left and iterating through all elements of a row from left to right before going to the leftmost element of the next row.

Specified by:
walkInRowOrder in interface FieldMatrix<T extends FieldElement<T>>
Overrides:
walkInRowOrder in class AbstractFieldMatrix<T extends FieldElement<T>>
Parameters:
visitor - visitor used to process all matrix entries
startRow - Initial row index
endRow - Final row index (inclusive)
startColumn - Initial column index
endColumn - Final column index
Returns:
the value returned by FieldMatrixPreservingVisitor.end() at the end of the walk
Throws:
MatrixIndexException - if the indices are not valid
MatrixVisitorException - if the visitor cannot process an entry
See Also:
FieldMatrix.walkInRowOrder(FieldMatrixChangingVisitor), FieldMatrix.walkInRowOrder(FieldMatrixPreservingVisitor), FieldMatrix.walkInRowOrder(FieldMatrixChangingVisitor, int, int, int, int), FieldMatrix.walkInColumnOrder(FieldMatrixChangingVisitor), FieldMatrix.walkInColumnOrder(FieldMatrixPreservingVisitor), FieldMatrix.walkInColumnOrder(FieldMatrixChangingVisitor, int, int, int, int), FieldMatrix.walkInColumnOrder(FieldMatrixPreservingVisitor, int, int, int, int), FieldMatrix.walkInOptimizedOrder(FieldMatrixChangingVisitor), FieldMatrix.walkInOptimizedOrder(FieldMatrixPreservingVisitor), FieldMatrix.walkInOptimizedOrder(FieldMatrixChangingVisitor, int, int, int, int), FieldMatrix.walkInOptimizedOrder(FieldMatrixPreservingVisitor, int, int, int, int)

walkInColumnOrder

public T walkInColumnOrder(FieldMatrixChangingVisitor<T> visitor)
                                            throws MatrixVisitorException
Visit (and possibly change) all matrix entries in column order.

Column order starts at upper left and iterating through all elements of a column from top to bottom before going to the topmost element of the next column.

Specified by:
walkInColumnOrder in interface FieldMatrix<T extends FieldElement<T>>
Overrides:
walkInColumnOrder in class AbstractFieldMatrix<T extends FieldElement<T>>
Parameters:
visitor - visitor used to process all matrix entries
Returns:
the value returned by FieldMatrixChangingVisitor.end() at the end of the walk
Throws:
MatrixVisitorException - if the visitor cannot process an entry
See Also:
FieldMatrix.walkInRowOrder(FieldMatrixChangingVisitor), FieldMatrix.walkInRowOrder(FieldMatrixPreservingVisitor), FieldMatrix.walkInRowOrder(FieldMatrixChangingVisitor, int, int, int, int), FieldMatrix.walkInRowOrder(FieldMatrixPreservingVisitor, int, int, int, int), FieldMatrix.walkInColumnOrder(FieldMatrixPreservingVisitor), FieldMatrix.walkInColumnOrder(FieldMatrixChangingVisitor, int, int, int, int), FieldMatrix.walkInColumnOrder(FieldMatrixPreservingVisitor, int, int, int, int), FieldMatrix.walkInOptimizedOrder(FieldMatrixChangingVisitor), FieldMatrix.walkInOptimizedOrder(FieldMatrixPreservingVisitor), FieldMatrix.walkInOptimizedOrder(FieldMatrixChangingVisitor, int, int, int, int), FieldMatrix.walkInOptimizedOrder(FieldMatrixPreservingVisitor, int, int, int, int)

walkInColumnOrder

public T walkInColumnOrder(FieldMatrixPreservingVisitor<T> visitor)
                                            throws MatrixVisitorException
Visit (but don't change) all matrix entries in column order.

Column order starts at upper left and iterating through all elements of a column from top to bottom before going to the topmost element of the next column.

Specified by:
walkInColumnOrder in interface FieldMatrix<T extends FieldElement<T>>
Overrides:
walkInColumnOrder in class AbstractFieldMatrix<T extends FieldElement<T>>
Parameters:
visitor - visitor used to process all matrix entries
Returns:
the value returned by FieldMatrixPreservingVisitor.end() at the end of the walk
Throws:
MatrixVisitorException - if the visitor cannot process an entry
See Also:
FieldMatrix.walkInRowOrder(FieldMatrixChangingVisitor), FieldMatrix.walkInRowOrder(FieldMatrixPreservingVisitor), FieldMatrix.walkInRowOrder(FieldMatrixChangingVisitor, int, int, int, int), FieldMatrix.walkInRowOrder(FieldMatrixPreservingVisitor, int, int, int, int), FieldMatrix.walkInColumnOrder(FieldMatrixChangingVisitor), FieldMatrix.walkInColumnOrder(FieldMatrixChangingVisitor, int, int, int, int), FieldMatrix.walkInColumnOrder(FieldMatrixPreservingVisitor, int, int, int, int), FieldMatrix.walkInOptimizedOrder(FieldMatrixChangingVisitor), FieldMatrix.walkInOptimizedOrder(FieldMatrixPreservingVisitor), FieldMatrix.walkInOptimizedOrder(FieldMatrixChangingVisitor, int, int, int, int), FieldMatrix.walkInOptimizedOrder(FieldMatrixPreservingVisitor, int, int, int, int)

walkInColumnOrder

public T walkInColumnOrder(FieldMatrixChangingVisitor<T> visitor,
                           int startRow,
                           int endRow,
                           int startColumn,
                           int endColumn)
                                            throws MatrixIndexException,
                                                   MatrixVisitorException
Visit (and possibly change) some matrix entries in column order.

Column order starts at upper left and iterating through all elements of a column from top to bottom before going to the topmost element of the next column.

Specified by:
walkInColumnOrder in interface FieldMatrix<T extends FieldElement<T>>
Overrides:
walkInColumnOrder in class AbstractFieldMatrix<T extends FieldElement<T>>
Parameters:
visitor - visitor used to process all matrix entries
startRow - Initial row index
endRow - Final row index (inclusive)
startColumn - Initial column index
endColumn - Final column index
Returns:
the value returned by FieldMatrixChangingVisitor.end() at the end of the walk
Throws:
MatrixIndexException - if the indices are not valid
MatrixVisitorException - if the visitor cannot process an entry
See Also:
FieldMatrix.walkInRowOrder(FieldMatrixChangingVisitor), FieldMatrix.walkInRowOrder(FieldMatrixPreservingVisitor), FieldMatrix.walkInRowOrder(FieldMatrixChangingVisitor, int, int, int, int), FieldMatrix.walkInRowOrder(FieldMatrixPreservingVisitor, int, int, int, int), FieldMatrix.walkInColumnOrder(FieldMatrixChangingVisitor), FieldMatrix.walkInColumnOrder(FieldMatrixPreservingVisitor), FieldMatrix.walkInColumnOrder(FieldMatrixPreservingVisitor, int, int, int, int), FieldMatrix.walkInOptimizedOrder(FieldMatrixChangingVisitor), FieldMatrix.walkInOptimizedOrder(FieldMatrixPreservingVisitor), FieldMatrix.walkInOptimizedOrder(FieldMatrixChangingVisitor, int, int, int, int), FieldMatrix.walkInOptimizedOrder(FieldMatrixPreservingVisitor, int, int, int, int)

walkInColumnOrder

public T walkInColumnOrder(FieldMatrixPreservingVisitor<T> visitor,
                           int startRow,
                           int endRow,
                           int startColumn,
                           int endColumn)
                                            throws MatrixIndexException,
                                                   MatrixVisitorException
Visit (but don't change) some matrix entries in column order.

Column order starts at upper left and iterating through all elements of a column from top to bottom before going to the topmost element of the next column.

Specified by:
walkInColumnOrder in interface FieldMatrix<T extends FieldElement<T>>
Overrides:
walkInColumnOrder in class AbstractFieldMatrix<T extends FieldElement<T>>
Parameters:
visitor - visitor used to process all matrix entries
startRow - Initial row index
endRow - Final row index (inclusive)
startColumn - Initial column index
endColumn - Final column index
Returns:
the value returned by FieldMatrixPreservingVisitor.end() at the end of the walk
Throws:
MatrixIndexException - if the indices are not valid
MatrixVisitorException - if the visitor cannot process an entry
See Also:
FieldMatrix.walkInRowOrder(FieldMatrixChangingVisitor), FieldMatrix.walkInRowOrder(FieldMatrixPreservingVisitor), FieldMatrix.walkInRowOrder(FieldMatrixChangingVisitor, int, int, int, int), FieldMatrix.walkInRowOrder(FieldMatrixPreservingVisitor, int, int, int, int), FieldMatrix.walkInColumnOrder(FieldMatrixChangingVisitor), FieldMatrix.walkInColumnOrder(FieldMatrixPreservingVisitor), FieldMatrix.walkInColumnOrder(FieldMatrixChangingVisitor, int, int, int, int), FieldMatrix.walkInOptimizedOrder(FieldMatrixChangingVisitor), FieldMatrix.walkInOptimizedOrder(FieldMatrixPreservingVisitor), FieldMatrix.walkInOptimizedOrder(FieldMatrixChangingVisitor, int, int, int, int), FieldMatrix.walkInOptimizedOrder(FieldMatrixPreservingVisitor, int, int, int, int)


Copyright © 2003-2011 The Apache Software Foundation. All Rights Reserved.