linearalgebra.numeric
Class AbstractMatrix

java.lang.Object
  extended by linearalgebra.numeric.AbstractMatrix
All Implemented Interfaces:
java.lang.Cloneable, MatrixInterface, NumericMatrixInterface
Direct Known Subclasses:
Matrix, TransposeWrapper

public abstract class AbstractMatrix
extends java.lang.Object
implements NumericMatrixInterface


Nested Class Summary
private  class AbstractMatrix.ColumnVector
           
private  class AbstractMatrix.RowVector
           
 
Field Summary
protected  boolean m_bFrontPivot
           
private  int m_colCount
           
private  int m_rowCount
           
 
Constructor Summary
AbstractMatrix(int rows, int cols)
           
 
Method Summary
private  MatrixInterface choleskyDecomposition()
           
 java.lang.Object clone()
           
 void combineRows(int srcRow, int dstRow, double scalar)
           
 void eliminateRowsBeneath(int rowStart, int colStart, PermutationMatrix p, NumericMatrixInterface l)
           
 boolean equals(java.lang.Object o)
           
 MatrixInterface factorInverse()
           
 MatrixInterface factorL(PermutationMatrix p)
           
 MatrixInterface factorL(PermutationMatrix p, boolean partialPivot)
           
 MatrixInterface factorU(PermutationMatrix p)
           
 int getColumnBottomPivotIndex(int col)
           
 int getColumnCount()
           
 int getColumnTopPivotIndex(int col)
           
 ColumnInterface getColumnView(int colIndex)
           
 NumericColumnInterface getNumericColumnView(int colIndex)
           
 NumericRowInterface getNumericRowView(int rowIndex)
           
 MatrixInterface getOrthogonalProjectionMatrix()
           
 MatrixInterface getProjectionMatrix()
           
 MatrixInterface getReflectionMatrix()
           
 int getRowCount()
           
 int getRowLeftPivotIndex(int row)
           
private  int getRowPivotIndex(int row)
           
 int getRowRightPivotIndex(int row)
           
 RowInterface getRowView(int rowIndex)
           
 boolean hasColumnPivot(int col)
           
 boolean hasRowPivot(int row)
           
abstract  void incrementElement(int row, int col, double value)
           
 boolean isIdentity()
           
 boolean isLowerLeftTriangular()
           
 boolean isOrthogonal()
           
 boolean isPositiveDefinite()
           
 boolean isSymmetric()
           
 boolean isUpperRightTriangular()
           
 NumericMatrixInterface minus(NumericMatrixInterface m)
           
 NumericMatrixInterface minusEquals(NumericMatrixInterface m)
           
 NumericMatrixInterface multiply(double scalar)
           
 NumericMatrixInterface multiplyEquals(double scalar)
           
 void multiplyRow(int row, double scalar)
           
private  boolean partialPivotDown(int row, int col, PermutationMatrix p, MatrixInterface l)
           
 void pivotIndexForL()
           
 void pivotIndexForU()
           
 NumericMatrixInterface plus(NumericMatrixInterface m)
           
 NumericMatrixInterface plusEquals(NumericMatrixInterface m)
           
 NumericMatrixInterface power(int power)
           
 NumericMatrixInterface product(NumericMatrixInterface right)
           
abstract  void scaleElement(int row, int col, double scalar)
           
private static void setDiagonalToOne(AbstractMatrix m)
           
abstract  void setElement(int row, int col, double element)
           
private  boolean setupColumnPivot(int row, int col, PermutationMatrix p, MatrixInterface l, boolean partialPivot)
           
 void swapRows(int row1, int row2)
           
 java.lang.String toString()
           
 
Methods inherited from class java.lang.Object
finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
 
Methods inherited from interface linearalgebra.numeric.NumericMatrixInterface
getElement
 
Methods inherited from interface linearalgebra.MatrixInterface
getTranspose, isIdempotent, swapRows
 

Field Detail

m_rowCount

private int m_rowCount

m_colCount

private int m_colCount

m_bFrontPivot

protected boolean m_bFrontPivot
Constructor Detail

AbstractMatrix

public AbstractMatrix(int rows,
                      int cols)
Method Detail

setElement

public abstract void setElement(int row,
                                int col,
                                double element)
Specified by:
setElement in interface NumericMatrixInterface

scaleElement

public abstract void scaleElement(int row,
                                  int col,
                                  double scalar)
Specified by:
scaleElement in interface NumericMatrixInterface

incrementElement

public abstract void incrementElement(int row,
                                      int col,
                                      double value)
Specified by:
incrementElement in interface NumericMatrixInterface

clone

public java.lang.Object clone()
Specified by:
clone in interface NumericMatrixInterface
Overrides:
clone in class java.lang.Object

getRowCount

public final int getRowCount()
Specified by:
getRowCount in interface MatrixInterface

getColumnCount

public final int getColumnCount()
Specified by:
getColumnCount in interface MatrixInterface

swapRows

public void swapRows(int row1,
                     int row2)
Specified by:
swapRows in interface MatrixInterface

hasRowPivot

public boolean hasRowPivot(int row)
Specified by:
hasRowPivot in interface MatrixInterface

hasColumnPivot

public boolean hasColumnPivot(int col)
Specified by:
hasColumnPivot in interface MatrixInterface

getRowLeftPivotIndex

public int getRowLeftPivotIndex(int row)
Specified by:
getRowLeftPivotIndex in interface MatrixInterface

getRowRightPivotIndex

public int getRowRightPivotIndex(int row)
Specified by:
getRowRightPivotIndex in interface MatrixInterface

getColumnTopPivotIndex

public int getColumnTopPivotIndex(int col)
Specified by:
getColumnTopPivotIndex in interface MatrixInterface

getColumnBottomPivotIndex

public int getColumnBottomPivotIndex(int col)
Specified by:
getColumnBottomPivotIndex in interface MatrixInterface

getRowPivotIndex

private int getRowPivotIndex(int row)

multiplyRow

public void multiplyRow(int row,
                        double scalar)
Specified by:
multiplyRow in interface NumericMatrixInterface

combineRows

public void combineRows(int srcRow,
                        int dstRow,
                        double scalar)
Specified by:
combineRows in interface NumericMatrixInterface

plus

public final NumericMatrixInterface plus(NumericMatrixInterface m)
Specified by:
plus in interface NumericMatrixInterface

multiply

public final NumericMatrixInterface multiply(double scalar)
Specified by:
multiply in interface NumericMatrixInterface

plusEquals

public NumericMatrixInterface plusEquals(NumericMatrixInterface m)
Specified by:
plusEquals in interface NumericMatrixInterface

multiplyEquals

public NumericMatrixInterface multiplyEquals(double scalar)
Specified by:
multiplyEquals in interface NumericMatrixInterface

product

public NumericMatrixInterface product(NumericMatrixInterface right)
Specified by:
product in interface NumericMatrixInterface

power

public NumericMatrixInterface power(int power)
Specified by:
power in interface NumericMatrixInterface

factorL

public MatrixInterface factorL(PermutationMatrix p)
Specified by:
factorL in interface MatrixInterface

setupColumnPivot

private boolean setupColumnPivot(int row,
                                 int col,
                                 PermutationMatrix p,
                                 MatrixInterface l,
                                 boolean partialPivot)

eliminateRowsBeneath

public void eliminateRowsBeneath(int rowStart,
                                 int colStart,
                                 PermutationMatrix p,
                                 NumericMatrixInterface l)

factorL

public MatrixInterface factorL(PermutationMatrix p,
                               boolean partialPivot)
Specified by:
factorL in interface MatrixInterface

factorU

public MatrixInterface factorU(PermutationMatrix p)
Specified by:
factorU in interface MatrixInterface

factorInverse

public MatrixInterface factorInverse()
                              throws UninvertibleMatrixException
Specified by:
factorInverse in interface MatrixInterface
Throws:
UninvertibleMatrixException

isIdentity

public boolean isIdentity()
Specified by:
isIdentity in interface MatrixInterface

isUpperRightTriangular

public boolean isUpperRightTriangular()
Specified by:
isUpperRightTriangular in interface MatrixInterface

isLowerLeftTriangular

public boolean isLowerLeftTriangular()
Specified by:
isLowerLeftTriangular in interface MatrixInterface

isSymmetric

public boolean isSymmetric()
Specified by:
isSymmetric in interface MatrixInterface

isPositiveDefinite

public boolean isPositiveDefinite()
Specified by:
isPositiveDefinite in interface MatrixInterface

equals

public boolean equals(java.lang.Object o)
Specified by:
equals in interface MatrixInterface
Overrides:
equals in class java.lang.Object

toString

public java.lang.String toString()
Overrides:
toString in class java.lang.Object

getColumnView

public final ColumnInterface getColumnView(int colIndex)

getRowView

public final RowInterface getRowView(int rowIndex)

getNumericColumnView

public NumericColumnInterface getNumericColumnView(int colIndex)
Specified by:
getNumericColumnView in interface NumericMatrixInterface

getNumericRowView

public NumericRowInterface getNumericRowView(int rowIndex)
Specified by:
getNumericRowView in interface NumericMatrixInterface

pivotIndexForL

public void pivotIndexForL()

pivotIndexForU

public void pivotIndexForU()

setDiagonalToOne

private static void setDiagonalToOne(AbstractMatrix m)

partialPivotDown

private boolean partialPivotDown(int row,
                                 int col,
                                 PermutationMatrix p,
                                 MatrixInterface l)

choleskyDecomposition

private MatrixInterface choleskyDecomposition()

getProjectionMatrix

public MatrixInterface getProjectionMatrix()
Specified by:
getProjectionMatrix in interface MatrixInterface

getOrthogonalProjectionMatrix

public MatrixInterface getOrthogonalProjectionMatrix()
Specified by:
getOrthogonalProjectionMatrix in interface MatrixInterface

getReflectionMatrix

public MatrixInterface getReflectionMatrix()
Specified by:
getReflectionMatrix in interface MatrixInterface

minus

public NumericMatrixInterface minus(NumericMatrixInterface m)
Specified by:
minus in interface NumericMatrixInterface

minusEquals

public NumericMatrixInterface minusEquals(NumericMatrixInterface m)
Specified by:
minusEquals in interface NumericMatrixInterface

isOrthogonal

public boolean isOrthogonal()
Specified by:
isOrthogonal in interface MatrixInterface