org.ojalgo.matrix.decomposition
Class LUDecomposition<N extends Number>

java.lang.Object
  extended by org.ojalgo.matrix.decomposition.LUDecomposition<N>
All Implemented Interfaces:
LU<N>, MatrixDecomposition<N>

public abstract class LUDecomposition<N extends Number>
extends Object
implements LU<N>

You create instances of (some subclass of) this class by calling one of the static factory methods: makeBig(), makeComplex(), makePrimitive() or makeJama().

Author:
apete

Nested Class Summary
static class LUDecomposition.Pivot
           
 
Method Summary
 boolean compute(Access2D<?> aStore)
           
 boolean computeWithoutPivoting(MatrixStore<?> aStore)
          The normal MatrixDecomposition.compute(Access2D) method must handle cases where pivoting is required.
 boolean equals(MatrixDecomposition<N> aDecomp, NumberContext aCntxt)
           
 boolean equals(MatrixStore<N> aStore, NumberContext aCntxt)
           
 boolean equals(Object someObj)
           
 N getDeterminant()
           
 MatrixStore<N> getInverse()
          The output must be a "right inverse" and a "generalised inverse".
 MatrixStore<N> getInverse(DecompositionStore<N> preallocated)
           Implementiong this method is optional.
 MatrixStore<N> getL()
           
 int[] getPivotOrder()
          This can be used to create a [P] matrix using IdentityStore in combination with RowsStore or ColumnsStore.
 int getRank()
           
 int[] getReducedPivots()
           
 MatrixStore<N> getU()
          http://en.wikipedia.org/wiki/Row_echelon_form

This is the same as [D][U].
 boolean isAspectRatioNormal()
           
 boolean isComputed()
           
 boolean isFullSize()
           
 boolean isSolvable()
           
 boolean isSquareAndNotSingular()
           
static
<N extends Number>
LU<N>
make(Access2D<N> aTypical)
           
static LU<BigDecimal> makeBig()
           
static LU<ComplexNumber> makeComplex()
           
static LU<Double> makeJama()
           
static LU<Double> makePrimitive()
           
 MatrixStore<N> reconstruct()
           
 void reset()
          Delete computed results, and resets attributes to default values
 MatrixStore<N> solve(MatrixStore<N> aRHS)
          Solves [this][X] = [aRHS] by first solving
 MatrixStore<N> solve(MatrixStore<N> aRHS, DecompositionStore<N> preallocated)
          The solution will be written to "preallocated" and then returned.
 
Methods inherited from class java.lang.Object
getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 
Methods inherited from interface org.ojalgo.matrix.decomposition.MatrixDecomposition
equals, isComputed
 

Method Detail

make

public static final <N extends Number> LU<N> make(Access2D<N> aTypical)

makeBig

public static final LU<BigDecimal> makeBig()

makeComplex

public static final LU<ComplexNumber> makeComplex()

makeJama

public static final LU<Double> makeJama()

makePrimitive

public static final LU<Double> makePrimitive()

compute

public boolean compute(Access2D<?> aStore)
Specified by:
compute in interface MatrixDecomposition<N extends Number>
Parameters:
aStore - A matrix to decompose
Returns:
true if the computation suceeded; false if not

computeWithoutPivoting

public boolean computeWithoutPivoting(MatrixStore<?> aStore)
Description copied from interface: LU
The normal MatrixDecomposition.compute(Access2D) method must handle cases where pivoting is required. If you know that pivoting is not needed you may call this method instead - it's faster.

Specified by:
computeWithoutPivoting in interface LU<N extends Number>

equals

public boolean equals(MatrixStore<N> aStore,
                      NumberContext aCntxt)
Specified by:
equals in interface MatrixDecomposition<N extends Number>

getDeterminant

public N getDeterminant()
Specified by:
getDeterminant in interface LU<N extends Number>

getInverse

public MatrixStore<N> getInverse()
Description copied from interface: MatrixDecomposition
The output must be a "right inverse" and a "generalised inverse".

Specified by:
getInverse in interface MatrixDecomposition<N extends Number>
See Also:
BasicMatrix.invert()

getInverse

public MatrixStore<N> getInverse(DecompositionStore<N> preallocated)
Description copied from interface: MatrixDecomposition

Implementiong this method is optional.

Exactly how a specific implementation makes use of preallocated is not specified by this interface. It must be documented for each implementation.

Should produce the same results as calling MatrixDecomposition.getInverse().

Specified by:
getInverse in interface MatrixDecomposition<N extends Number>
Parameters:
preallocated - Preallocated memory for the results, possibly some intermediate results. You must assume this is modified, but you cannot assume it will contain the full/final/correct solution.
Returns:
The inverse

getL

public MatrixStore<N> getL()
Specified by:
getL in interface LU<N extends Number>

getPivotOrder

public int[] getPivotOrder()
Description copied from interface: LU
This can be used to create a [P] matrix using IdentityStore in combination with RowsStore or ColumnsStore.

Specified by:
getPivotOrder in interface LU<N extends Number>

getRank

public int getRank()
Specified by:
getRank in interface LU<N extends Number>

getReducedPivots

public int[] getReducedPivots()
Specified by:
getReducedPivots in interface LU<N extends Number>

getU

public MatrixStore<N> getU()
Description copied from interface: LU
http://en.wikipedia.org/wiki/Row_echelon_form

This is the same as [D][U]. Together with the pivotOrder and [L] this constitutes an alternative, more compact, way to express the decomposition.

Specified by:
getU in interface LU<N extends Number>
See Also:
LU.getPivotOrder(), LU.getL()

isFullSize

public final boolean isFullSize()
Specified by:
isFullSize in interface MatrixDecomposition<N extends Number>
Returns:
True if the implementation generates a full sized decomposition.

isSolvable

public boolean isSolvable()
Specified by:
isSolvable in interface MatrixDecomposition<N extends Number>
Returns:
true if it is ok to call MatrixDecomposition.solve(MatrixStore) (computation was successful); false if not
See Also:
MatrixDecomposition.solve(MatrixStore), MatrixDecomposition.isComputed()

isSquareAndNotSingular

public final boolean isSquareAndNotSingular()
Specified by:
isSquareAndNotSingular in interface LU<N extends Number>

reconstruct

public MatrixStore<N> reconstruct()
Specified by:
reconstruct in interface MatrixDecomposition<N extends Number>

reset

public void reset()
Description copied from interface: MatrixDecomposition
Delete computed results, and resets attributes to default values

Specified by:
reset in interface MatrixDecomposition<N extends Number>

solve

public MatrixStore<N> solve(MatrixStore<N> aRHS)
Solves [this][X] = [aRHS] by first solving
[L][Y] = [aRHS]
and then
[U][X] = [Y]
.

Specified by:
solve in interface MatrixDecomposition<N extends Number>
Parameters:
aRHS - The right hand side
Returns:
[X]

solve

public MatrixStore<N> solve(MatrixStore<N> aRHS,
                            DecompositionStore<N> preallocated)
The solution will be written to "preallocated" and then returned.

Specified by:
solve in interface MatrixDecomposition<N extends Number>
Parameters:
aRHS - The Right Hand Side, wont be modfied
preallocated - Preallocated memory for the results, possibly some intermediate results. You must assume this is modified, but you cannot assume it will contain the full/final/correct solution.
Returns:
The solution
See Also:
MatrixDecomposition.solve(org.ojalgo.matrix.store.MatrixStore, org.ojalgo.matrix.decomposition.DecompositionStore)

equals

public final boolean equals(MatrixDecomposition<N> aDecomp,
                            NumberContext aCntxt)
Specified by:
equals in interface MatrixDecomposition<N extends Number>

equals

public boolean equals(Object someObj)
Overrides:
equals in class Object

isAspectRatioNormal

public boolean isAspectRatioNormal()

isComputed

public final boolean isComputed()
Specified by:
isComputed in interface MatrixDecomposition<N extends Number>
Returns:
true if computation has been attemped; false if not.
See Also:
MatrixDecomposition.compute(Access2D), MatrixDecomposition.isSolvable()