org.ojalgo.matrix.store
Class BigDenseStore

java.lang.Object
  extended by org.ojalgo.array.BigArray
      extended by org.ojalgo.matrix.store.BigDenseStore
All Implemented Interfaces:
Serializable, Access1D<BigDecimal>, Access2D<BigDecimal>, DecompositionStore<BigDecimal>, MatrixStore<BigDecimal>, PhysicalStore<BigDecimal>

public final class BigDenseStore
extends BigArray
implements PhysicalStore<BigDecimal>, DecompositionStore<BigDecimal>

A BigDecimal implementation of PhysicalStore.

Author:
apete
See Also:
Serialized Form

Nested Class Summary
 
Nested classes/interfaces inherited from interface org.ojalgo.matrix.store.PhysicalStore
PhysicalStore.Factory<N extends Number>
 
Nested classes/interfaces inherited from interface org.ojalgo.matrix.store.MatrixStore
MatrixStore.Builder<N extends Number>
 
Field Summary
static boolean DEBUG
           
static PhysicalStore.Factory<BigDecimal> FACTORY
           
 int length
           
 
Method Summary
 BigDecimal aggregateAll(ChainableAggregator aVisitor)
           
 BigDecimal aggregateAll(CollectableAggregator aVisitor)
           
 Array1D<N> asArray1D()
           A utility facade that conveniently/consistently presents the BasicArray as a one-dimensional array.
 Array2D<BigDecimal> asArray2D()
           
 Array2D<N> asArray2D(int aRowDim, int aColDim)
           A utility facade that conveniently/consistently presents the BasicArray as a two-dimensional array.
 ArrayAnyD<N> asArrayAnyD(int[] aStructure)
           A utility facade that conveniently/consistently presents the BasicArray as a multi-dimensional array.
 Array1D<BigDecimal> asList()
           
 MatrixStore.Builder<BigDecimal> builder()
           
 void caxpy(BigDecimal aSclrA, int aColX, int aColY, int aFirstRow)
           column a * x plus y
 void computeInPlaceBidiagonal(boolean newNormalAspectRatio)
           
 boolean computeInPlaceCholesky(boolean checkForSPD)
           
 void computeInPlaceHessenberg(boolean upper)
           
 LUDecomposition.Pivot computeInPlaceLU(boolean assumeNoPivotingRequired)
           
 void computeInPlaceQR()
           
 void computeInPlaceTridiagonal()
           
 PhysicalStore<BigDecimal> computeInPlaceTridiagonal(boolean someCollectTransformations)
           
 BigDenseStore conjugate()
          Each call must produce a new instance.
 BigDenseStore copy()
          Each call must produce a new instance.
 double doubleValue(int aRow, int aCol)
          Extracts one element of this matrix as a double.
 boolean equals(MatrixStore<BigDecimal> aStore, NumberContext aCntxt)
           
 boolean equals(Object anObj)
           
 void exchangeColumns(int aColA, int aColB)
           
 void exchangeRows(int aRowA, int aRowB)
           
 void fillAll(BigDecimal aNmbr)
           
 void fillByMultiplying(MatrixStore<BigDecimal> aLeftArg, MatrixStore<BigDecimal> aRightArg)
           
 void fillColumn(int aRow, int aCol, BigDecimal aNmbr)
           
 void fillDiagonal(int aRow, int aCol, BigDecimal aNmbr)
           
 void fillMatching(Access2D<BigDecimal> aSource2D)
           
 void fillMatching(BigDecimal aLeftArg, BinaryFunction<BigDecimal> aFunc, MatrixStore<BigDecimal> aRightArg)
           Will replace the elements of [this] with the results of element wise invocation of the input binary funtion:
 void fillMatching(MatrixStore<BigDecimal> aLeftArg, BinaryFunction<BigDecimal> aFunc, BigDecimal aRightArg)
           Will replace the elements of [this] with the results of element wise invocation of the input binary funtion:
 void fillMatching(MatrixStore<BigDecimal> aLeftArg, BinaryFunction<BigDecimal> aFunc, MatrixStore<BigDecimal> aRightArg)
           Will replace the elements of [this] with the results of element wise invocation of the input binary funtion:
 void fillRow(int aRow, int aCol, BigDecimal aNmbr)
           
 Householder<BigDecimal> generateHouseholderColumn(int newI, int newIj)
           
 Householder<BigDecimal> generateHouseholderRow(int newIj, int newI)
           
 BigDecimal get(int aRow, int aCol)
           
 int getColDim()
          The size of this structure in the column-direction/dimension
 PhysicalStore.Factory<BigDecimal> getFactory()
           
 int getIndexOfLargestInColumn(int aRow, int aCol)
           
 int getIndexOfLargestInRow(int aRow, int aCol)
           
 int getMinDim()
           
 int getRowDim()
          The size of this structure in the row-direction/dimension
 int hashCode()
           
 boolean isAbsolute(int aRow, int aCol)
           
 boolean isReal(int aRow, int aCol)
           
 boolean isZero(int aRow, int aCol)
           
 void maxpy(BigDecimal aSclrA, MatrixStore<BigDecimal> aMtrxX)
           matrix a * x plus y
 void modifyAll(UnaryFunction<BigDecimal> aFunc)
           
 void modifyColumn(int aRow, int aCol, UnaryFunction<BigDecimal> aFunc)
           
 void modifyDiagonal(int aRow, int aCol, UnaryFunction<BigDecimal> aFunc)
           
 void modifyRow(int aRow, int aCol, UnaryFunction<BigDecimal> aFunc)
           
 MatrixStore<BigDecimal> multiplyLeft(MatrixStore<BigDecimal> aStore)
           
 MatrixStore<BigDecimal> multiplyRight(MatrixStore<BigDecimal> aStore)
           
 void raxpy(BigDecimal aSclrA, int aRowX, int aRowY, int aFirstCol)
           row a * x plus y
 void set(int aRow, int aCol, BigDecimal aNmbr)
           
 void set(int aRow, int aCol, double aNmbr)
           
 int size()
           
 int size()
           
 void substituteBackwards(Access2D<BigDecimal> aBody, boolean transposed)
          Will solve the equation system [A][X]=[B] where: [aBody][this]=[this] is [A][X]=[B] ("this" is the right hand side, and it will be overwritten with the solution). [A] is upper/right triangular
 void substituteForwards(Access2D<BigDecimal> aBody, boolean onesOnDiagonal, Access2D<BigDecimal> aRHS, boolean zerosAboveDiagonal)
          Will solve the equation system [A][X]=[B] where: [aBody][this]=[this] is [A][X]=[B] ("this" is the right hand side, and it will be overwritten with the solution). [A] is lower/left triangular
 Scalar<BigDecimal> toScalar(int aRow, int aCol)
           
 String toString()
           
 void transformLeft(Householder.Reference<BigDecimal> aTransf, int aFirstCol)
           
 void transformLeft(Householder<BigDecimal> aTransf, int aFirstCol)
           
 void transformLeft(Rotation<BigDecimal> aTransf)
           As in MatrixStore.multiplyLeft(MatrixStore) where the left/parameter matrix is a plane rotation.
 void transformRight(Householder.Reference<BigDecimal> aTransf, int aFirstRow)
           
 void transformRight(Householder<BigDecimal> aTransf, int aFirstRow)
           
 void transformRight(Rotation<BigDecimal> aTransf)
           As in MatrixStore.multiplyRight(MatrixStore) where the right/parameter matrix is a plane rotation.
 BigDenseStore transpose()
          Each call must produce a new instance.
 void visitAll(AggregatorFunction<BigDecimal> aVisitor)
           
 void visitColumn(int aRow, int aCol, AggregatorFunction<BigDecimal> aVisitor)
           
 void visitDiagonal(int aRow, int aCol, AggregatorFunction<BigDecimal> aVisitor)
           
 void visitRow(int aRow, int aCol, AggregatorFunction<BigDecimal> aVisitor)
           
 
Methods inherited from class org.ojalgo.array.BigArray
doubleValue, exchange, fill, fill, fill, fill, get, getIndexOfLargest, isAbsolute, isReal, isZero, modify, modify, modify, modify, modify, modify, searchAscending, set, set, sortAscending, toScalar, visit
 
Methods inherited from class java.lang.Object
getClass, notify, notifyAll, wait, wait, wait
 

Field Detail

FACTORY

public static final PhysicalStore.Factory<BigDecimal> FACTORY

DEBUG

public static boolean DEBUG

length

public final int length
Method Detail

aggregateAll

public BigDecimal aggregateAll(ChainableAggregator aVisitor)
Specified by:
aggregateAll in interface MatrixStore<BigDecimal>

aggregateAll

public BigDecimal aggregateAll(CollectableAggregator aVisitor)
Specified by:
aggregateAll in interface MatrixStore<BigDecimal>

asArray2D

public Array2D<BigDecimal> asArray2D()
Specified by:
asArray2D in interface DecompositionStore<BigDecimal>

asList

public Array1D<BigDecimal> asList()
Specified by:
asList in interface PhysicalStore<BigDecimal>
Returns:
The elements of the physical store as a fixed size (1 dimensional) list. The elements may be accessed either row or colomn major.

builder

public final MatrixStore.Builder<BigDecimal> builder()
Specified by:
builder in interface MatrixStore<BigDecimal>

caxpy

public void caxpy(BigDecimal aSclrA,
                  int aColX,
                  int aColY,
                  int aFirstRow)
Description copied from interface: PhysicalStore

column a * x plus y

[this(*,aColY)] = aSclrA [this(*,aColX)] + [this(*,aColY)]

Specified by:
caxpy in interface PhysicalStore<BigDecimal>

computeInPlaceBidiagonal

public void computeInPlaceBidiagonal(boolean newNormalAspectRatio)
Specified by:
computeInPlaceBidiagonal in interface DecompositionStore<BigDecimal>

computeInPlaceCholesky

public boolean computeInPlaceCholesky(boolean checkForSPD)
Specified by:
computeInPlaceCholesky in interface DecompositionStore<BigDecimal>

computeInPlaceHessenberg

public void computeInPlaceHessenberg(boolean upper)
Specified by:
computeInPlaceHessenberg in interface DecompositionStore<BigDecimal>

computeInPlaceLU

public LUDecomposition.Pivot computeInPlaceLU(boolean assumeNoPivotingRequired)
Specified by:
computeInPlaceLU in interface DecompositionStore<BigDecimal>

computeInPlaceQR

public void computeInPlaceQR()
Specified by:
computeInPlaceQR in interface DecompositionStore<BigDecimal>

computeInPlaceTridiagonal

public void computeInPlaceTridiagonal()
Specified by:
computeInPlaceTridiagonal in interface DecompositionStore<BigDecimal>

computeInPlaceTridiagonal

public PhysicalStore<BigDecimal> computeInPlaceTridiagonal(boolean someCollectTransformations)

conjugate

public BigDenseStore conjugate()
Description copied from interface: MatrixStore
Each call must produce a new instance.

Specified by:
conjugate in interface MatrixStore<BigDecimal>
Returns:
A new conjugated PhysicalStore copy.

copy

public BigDenseStore copy()
Description copied from interface: MatrixStore
Each call must produce a new instance.

Specified by:
copy in interface MatrixStore<BigDecimal>
Returns:
A new PhysicalStore copy.

doubleValue

public double doubleValue(int aRow,
                          int aCol)
Extracts one element of this matrix as a double.

Parameters:
aRow - A row index.
aCol - A column index.
Returns:
One matrix element

equals

public boolean equals(MatrixStore<BigDecimal> aStore,
                      NumberContext aCntxt)
Specified by:
equals in interface MatrixStore<BigDecimal>

equals

public boolean equals(Object anObj)
Overrides:
equals in class BigArray

exchangeColumns

public void exchangeColumns(int aColA,
                            int aColB)
Specified by:
exchangeColumns in interface PhysicalStore<BigDecimal>

exchangeRows

public void exchangeRows(int aRowA,
                         int aRowB)
Specified by:
exchangeRows in interface PhysicalStore<BigDecimal>

fillAll

public void fillAll(BigDecimal aNmbr)
Specified by:
fillAll in interface PhysicalStore<BigDecimal>

fillByMultiplying

public void fillByMultiplying(MatrixStore<BigDecimal> aLeftArg,
                              MatrixStore<BigDecimal> aRightArg)
Specified by:
fillByMultiplying in interface PhysicalStore<BigDecimal>

fillColumn

public void fillColumn(int aRow,
                       int aCol,
                       BigDecimal aNmbr)
Specified by:
fillColumn in interface PhysicalStore<BigDecimal>

fillDiagonal

public void fillDiagonal(int aRow,
                         int aCol,
                         BigDecimal aNmbr)
Specified by:
fillDiagonal in interface PhysicalStore<BigDecimal>

fillMatching

public void fillMatching(Access2D<BigDecimal> aSource2D)
Specified by:
fillMatching in interface PhysicalStore<BigDecimal>

fillMatching

public void fillMatching(BigDecimal aLeftArg,
                         BinaryFunction<BigDecimal> aFunc,
                         MatrixStore<BigDecimal> aRightArg)
Description copied from interface: PhysicalStore

Will replace the elements of [this] with the results of element wise invocation of the input binary funtion:

this(i,j) = aFunc.invoke(aLeftArg,aRightArg(i,j))

Specified by:
fillMatching in interface PhysicalStore<BigDecimal>

fillMatching

public void fillMatching(MatrixStore<BigDecimal> aLeftArg,
                         BinaryFunction<BigDecimal> aFunc,
                         BigDecimal aRightArg)
Description copied from interface: PhysicalStore

Will replace the elements of [this] with the results of element wise invocation of the input binary funtion:

this(i,j) = aFunc.invoke(aLeftArg(i,j),aRightArg))

Specified by:
fillMatching in interface PhysicalStore<BigDecimal>

fillMatching

public void fillMatching(MatrixStore<BigDecimal> aLeftArg,
                         BinaryFunction<BigDecimal> aFunc,
                         MatrixStore<BigDecimal> aRightArg)
Description copied from interface: PhysicalStore

Will replace the elements of [this] with the results of element wise invocation of the input binary funtion:

this(i,j) = aFunc.invoke(aLeftArg(i,j),aRightArg(i,j))

Specified by:
fillMatching in interface PhysicalStore<BigDecimal>

fillRow

public void fillRow(int aRow,
                    int aCol,
                    BigDecimal aNmbr)
Specified by:
fillRow in interface PhysicalStore<BigDecimal>

generateHouseholderColumn

public Householder<BigDecimal> generateHouseholderColumn(int newI,
                                                         int newIj)
Specified by:
generateHouseholderColumn in interface PhysicalStore<BigDecimal>

generateHouseholderRow

public Householder<BigDecimal> generateHouseholderRow(int newIj,
                                                      int newI)
Specified by:
generateHouseholderRow in interface PhysicalStore<BigDecimal>

get

public BigDecimal get(int aRow,
                      int aCol)

getColDim

public int getColDim()
The size of this structure in the column-direction/dimension

Returns:
The number of columns

getFactory

public PhysicalStore.Factory<BigDecimal> getFactory()
Specified by:
getFactory in interface MatrixStore<BigDecimal>

getIndexOfLargestInColumn

public int getIndexOfLargestInColumn(int aRow,
                                     int aCol)
Specified by:
getIndexOfLargestInColumn in interface PhysicalStore<BigDecimal>

getIndexOfLargestInRow

public int getIndexOfLargestInRow(int aRow,
                                  int aCol)
Specified by:
getIndexOfLargestInRow in interface PhysicalStore<BigDecimal>

getMinDim

public int getMinDim()
Specified by:
getMinDim in interface MatrixStore<BigDecimal>

getRowDim

public int getRowDim()
The size of this structure in the row-direction/dimension

Returns:
The number of rows

hashCode

public int hashCode()
Overrides:
hashCode in class BigArray

isAbsolute

public boolean isAbsolute(int aRow,
                          int aCol)
Specified by:
isAbsolute in interface MatrixStore<BigDecimal>
See Also:
Scalar.isAbsolute()

isReal

public boolean isReal(int aRow,
                      int aCol)
Specified by:
isReal in interface MatrixStore<BigDecimal>
See Also:
Scalar.isReal()

isZero

public boolean isZero(int aRow,
                      int aCol)
Specified by:
isZero in interface MatrixStore<BigDecimal>
See Also:
Scalar.isZero()

maxpy

public void maxpy(BigDecimal aSclrA,
                  MatrixStore<BigDecimal> aMtrxX)
Description copied from interface: PhysicalStore

matrix a * x plus y

[this] = aSclrA [aMtrxX] + [this]

Specified by:
maxpy in interface PhysicalStore<BigDecimal>

modifyAll

public void modifyAll(UnaryFunction<BigDecimal> aFunc)
Specified by:
modifyAll in interface PhysicalStore<BigDecimal>

modifyColumn

public void modifyColumn(int aRow,
                         int aCol,
                         UnaryFunction<BigDecimal> aFunc)
Specified by:
modifyColumn in interface PhysicalStore<BigDecimal>

modifyDiagonal

public void modifyDiagonal(int aRow,
                           int aCol,
                           UnaryFunction<BigDecimal> aFunc)
Specified by:
modifyDiagonal in interface PhysicalStore<BigDecimal>

modifyRow

public void modifyRow(int aRow,
                      int aCol,
                      UnaryFunction<BigDecimal> aFunc)
Specified by:
modifyRow in interface PhysicalStore<BigDecimal>

multiplyLeft

public MatrixStore<BigDecimal> multiplyLeft(MatrixStore<BigDecimal> aStore)
Specified by:
multiplyLeft in interface MatrixStore<BigDecimal>

multiplyRight

public MatrixStore<BigDecimal> multiplyRight(MatrixStore<BigDecimal> aStore)
Specified by:
multiplyRight in interface MatrixStore<BigDecimal>

raxpy

public void raxpy(BigDecimal aSclrA,
                  int aRowX,
                  int aRowY,
                  int aFirstCol)
Description copied from interface: PhysicalStore

row a * x plus y

[this(aRowY,*)] = aSclrA [this(aRowX,*)] + [this(aRowY,*)]

Specified by:
raxpy in interface PhysicalStore<BigDecimal>

set

public void set(int aRow,
                int aCol,
                BigDecimal aNmbr)
Specified by:
set in interface PhysicalStore<BigDecimal>

set

public void set(int aRow,
                int aCol,
                double aNmbr)
Specified by:
set in interface PhysicalStore<BigDecimal>

substituteBackwards

public void substituteBackwards(Access2D<BigDecimal> aBody,
                                boolean transposed)
Description copied from interface: DecompositionStore
Will solve the equation system [A][X]=[B] where:

Specified by:
substituteBackwards in interface DecompositionStore<BigDecimal>
Parameters:
aBody - The equation system body parameters [A]
transposed - true if the upper/right part of aBody is actually stored in the lower/left part of the matrix.

substituteForwards

public void substituteForwards(Access2D<BigDecimal> aBody,
                               boolean onesOnDiagonal,
                               Access2D<BigDecimal> aRHS,
                               boolean zerosAboveDiagonal)
Description copied from interface: DecompositionStore
Will solve the equation system [A][X]=[B] where:

Specified by:
substituteForwards in interface DecompositionStore<BigDecimal>
Parameters:
aBody - The equation system body parameters [A]
onesOnDiagonal - true if aBody as ones on the diagonal

toScalar

public Scalar<BigDecimal> toScalar(int aRow,
                                   int aCol)
Specified by:
toScalar in interface MatrixStore<BigDecimal>

transformLeft

public void transformLeft(Householder.Reference<BigDecimal> aTransf,
                          int aFirstCol)
Specified by:
transformLeft in interface DecompositionStore<BigDecimal>

transformLeft

public void transformLeft(Householder<BigDecimal> aTransf,
                          int aFirstCol)
Specified by:
transformLeft in interface PhysicalStore<BigDecimal>

transformLeft

public void transformLeft(Rotation<BigDecimal> aTransf)
Description copied from interface: PhysicalStore

As in MatrixStore.multiplyLeft(MatrixStore) where the left/parameter matrix is a plane rotation.

Multiplying by a plane rotation from the left means that [this] gets two of its rows updated to new combinations of those two (current) rows.

There are two ways to transpose/invert a rotation. Either you negate the angle or you interchange the two indeces that define the rotation plane.

Specified by:
transformLeft in interface PhysicalStore<BigDecimal>
See Also:
PhysicalStore.transformRight(Rotation)

transformRight

public void transformRight(Householder.Reference<BigDecimal> aTransf,
                           int aFirstRow)
Specified by:
transformRight in interface DecompositionStore<BigDecimal>

transformRight

public void transformRight(Householder<BigDecimal> aTransf,
                           int aFirstRow)
Specified by:
transformRight in interface PhysicalStore<BigDecimal>

transformRight

public void transformRight(Rotation<BigDecimal> aTransf)
Description copied from interface: PhysicalStore

As in MatrixStore.multiplyRight(MatrixStore) where the right/parameter matrix is a plane rotation.

Multiplying by a plane rotation from the right means that [this] gets two of its columns updated to new combinations of those two (current) columns.

There result is undefined if the two input indeces are the same (in which case the rotation plane is undefined).

Specified by:
transformRight in interface PhysicalStore<BigDecimal>
See Also:
PhysicalStore.transformLeft(Rotation)

transpose

public BigDenseStore transpose()
Description copied from interface: MatrixStore
Each call must produce a new instance.

Specified by:
transpose in interface MatrixStore<BigDecimal>
Returns:
A new transposed PhysicalStore copy.

visitAll

public void visitAll(AggregatorFunction<BigDecimal> aVisitor)
Specified by:
visitAll in interface MatrixStore<BigDecimal>

visitColumn

public void visitColumn(int aRow,
                        int aCol,
                        AggregatorFunction<BigDecimal> aVisitor)
Specified by:
visitColumn in interface MatrixStore<BigDecimal>

visitDiagonal

public void visitDiagonal(int aRow,
                          int aCol,
                          AggregatorFunction<BigDecimal> aVisitor)
Specified by:
visitDiagonal in interface MatrixStore<BigDecimal>

visitRow

public void visitRow(int aRow,
                     int aCol,
                     AggregatorFunction<BigDecimal> aVisitor)
Specified by:
visitRow in interface MatrixStore<BigDecimal>

size

public int size()
Returns:
The total number of elements contained in this structure

asArray1D

public final Array1D<N> asArray1D()

A utility facade that conveniently/consistently presents the BasicArray as a one-dimensional array. Note that you will modify the actual array by accessing it through this facade.

Disregards the array structure, and simply treats it as one-domensional.


asArray2D

public final Array2D<N> asArray2D(int aRowDim,
                                  int aColDim)

A utility facade that conveniently/consistently presents the BasicArray as a two-dimensional array. Note that you will modify the actual array by accessing it through this facade.

If "this" has more than two dimensions then only the first plane of the first cube of the first... is used/accessed. If this only has one dimension then everything is assumed to be in the first column of the first plane of the first cube...


asArrayAnyD

public final ArrayAnyD<N> asArrayAnyD(int[] aStructure)

A utility facade that conveniently/consistently presents the BasicArray as a multi-dimensional array. Note that you will modify the actual array by accessing it through this facade.


size

public final int size()
Returns:
The total number of elements contained in this structure

toString

public String toString()
Overrides:
toString in class Object