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.decomposition.DecompositionStore
DecompositionStore.ExchangeColumnsCaller<N extends Number>, DecompositionStore.HouseholderReference<N extends Number>, DecompositionStore.NegateColumnCaller<N extends Number>, DecompositionStore.RotateRightCaller<N extends Number>
 
Nested classes/interfaces inherited from interface org.ojalgo.matrix.store.PhysicalStore
PhysicalStore.Factory<N extends Number,I extends PhysicalStore<N>>
 
Nested classes/interfaces inherited from interface org.ojalgo.matrix.store.MatrixStore
MatrixStore.Builder<N extends Number>
 
Field Summary
static PhysicalStore.Factory<BigDecimal,BigDenseStore> FACTORY
           
 int length
           
 
Method Summary
 BigDecimal aggregateAll(Aggregator aVisitor)
           
 void applyCholesky(int iterationPoint, ArrayAccess<BigDecimal> multipliers)
           
 void applyLU(int iterationPoint, ArrayAccess<BigDecimal> multipliers)
           
 Array2D<BigDecimal> asArray2D()
           
 Array1D<BigDecimal> asList()
           
 MatrixStore.Builder<BigDecimal> builder()
           
 void caxpy(BigDecimal aSclrA, int aColX, int aColY, int aFirstRow)
           column a * x plus y
 Array1D<ComplexNumber> computeInPlaceSchur(PhysicalStore<BigDecimal> aTransformationCollector, boolean eigenvalue)
           
 BigDenseStore conjugate()
          Each call must produce a new instance.
 BigDenseStore copy()
          Each call must produce a new instance.
 void divideAndCopyColumn(int aRow, int aCol, ArrayAccess<BigDecimal> aDestination)
           
 double doubleValue(int anInd)
           
 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> aLeftStore, MatrixStore<BigDecimal> aRightStore)
           
 void fillColumn(int aRow, int aCol, BigDecimal aNmbr)
           
 void fillDiagonal(int aRow, int aCol, BigDecimal aNmbr)
           
 void fillMatching(Access2D<? extends Number> 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)
           
 boolean generateApplyAndCopyHouseholderColumn(int aRow, int aCol, Householder<BigDecimal> aDestination)
           
 boolean generateApplyAndCopyHouseholderRow(int aRow, int aCol, Householder<BigDecimal> aDestination)
           
 N get(int anInd)
           
 BigDecimal get(int aRow, int aCol)
           
 int getColDim()
          The size of this structure in the column-direction/dimension
 PhysicalStore.Factory<BigDecimal,BigDenseStore> getFactory()
           
 int getIndexOfLargestInColumn(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 isLowerLeftShaded()
          The entries below (left of) the first subdiagonal are zero - effectively an upper Hessenberg matrix.
 boolean isPositive(int aRow, int aCol)
           
 boolean isReal(int aRow, int aCol)
           
 boolean isUpperRightShaded()
          The entries above (right of) the first superdiagonal are zero - effectively a lower Hessenberg matrix.
 boolean isZero(int aRow, int aCol)
           
 Iterator<N> iterator()
           
 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 modifyOne(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 negateColumn(int aCol)
           
 void raxpy(BigDecimal aSclrA, int aRowX, int aRowY, int aFirstCol)
           row a * x plus y
 void rotateRight(int aLow, int aHigh, double aCos, double aSin)
           
 void set(int aRow, int aCol, BigDecimal aNmbr)
           
 void set(int aRow, int aCol, double aNmbr)
           
 void setToIdentity(int aCol)
           
 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, 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<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<BigDecimal> aTransf, int aFirstRow)
           
 void transformRight(Rotation<BigDecimal> aTransf)
           As in MatrixStore.multiplyRight(MatrixStore) where the right/parameter matrix is a plane rotation.
 void transformSymmetric(Householder<BigDecimal> aTransf)
           
 BigDenseStore transpose()
          Each call must produce a new instance.
 void tred2(ArrayAccess<BigDecimal> mainDiagonal, ArrayAccess<BigDecimal> offDiagonal, boolean yesvecs)
           
 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, get
 
Methods inherited from class java.lang.Object
getClass, notify, notifyAll, wait, wait, wait
 
Methods inherited from interface java.lang.Iterable
iterator
 

Field Detail

FACTORY

public static final PhysicalStore.Factory<BigDecimal,BigDenseStore> FACTORY

length

public final int length
Method Detail

aggregateAll

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

applyCholesky

public void applyCholesky(int iterationPoint,
                          ArrayAccess<BigDecimal> multipliers)
Specified by:
applyCholesky in interface DecompositionStore<BigDecimal>

applyLU

public void applyLU(int iterationPoint,
                    ArrayAccess<BigDecimal> multipliers)
Specified by:
applyLU in interface DecompositionStore<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>

computeInPlaceSchur

public Array1D<ComplexNumber> computeInPlaceSchur(PhysicalStore<BigDecimal> aTransformationCollector,
                                                  boolean eigenvalue)
Specified by:
computeInPlaceSchur in interface DecompositionStore<BigDecimal>

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.

divideAndCopyColumn

public void divideAndCopyColumn(int aRow,
                                int aCol,
                                ArrayAccess<BigDecimal> aDestination)
Specified by:
divideAndCopyColumn in interface DecompositionStore<BigDecimal>

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> aLeftStore,
                              MatrixStore<BigDecimal> aRightStore)
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<? extends Number> 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>

generateApplyAndCopyHouseholderColumn

public boolean generateApplyAndCopyHouseholderColumn(int aRow,
                                                     int aCol,
                                                     Householder<BigDecimal> aDestination)
Specified by:
generateApplyAndCopyHouseholderColumn in interface DecompositionStore<BigDecimal>

generateApplyAndCopyHouseholderRow

public boolean generateApplyAndCopyHouseholderRow(int aRow,
                                                  int aCol,
                                                  Householder<BigDecimal> aDestination)
Specified by:
generateApplyAndCopyHouseholderRow in interface DecompositionStore<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,BigDenseStore> getFactory()
Specified by:
getFactory in interface MatrixStore<BigDecimal>

getIndexOfLargestInColumn

public int getIndexOfLargestInColumn(int aRow,
                                     int aCol)
Specified by:
getIndexOfLargestInColumn in interface DecompositionStore<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()

isLowerLeftShaded

public boolean isLowerLeftShaded()
Description copied from interface: MatrixStore
The entries below (left of) the first subdiagonal are zero - effectively an upper Hessenberg matrix.

Specified by:
isLowerLeftShaded in interface MatrixStore<BigDecimal>
See Also:
MatrixStore.isUpperRightShaded()

isPositive

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

isReal

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

isUpperRightShaded

public boolean isUpperRightShaded()
Description copied from interface: MatrixStore
The entries above (right of) the first superdiagonal are zero - effectively a lower Hessenberg matrix.

Specified by:
isUpperRightShaded in interface MatrixStore<BigDecimal>
See Also:
MatrixStore.isLowerLeftShaded()

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>

modifyOne

public void modifyOne(int aRow,
                      int aCol,
                      UnaryFunction<BigDecimal> aFunc)
Specified by:
modifyOne 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>

negateColumn

public void negateColumn(int aCol)
Specified by:
negateColumn in interface DecompositionStore<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>

rotateRight

public void rotateRight(int aLow,
                        int aHigh,
                        double aCos,
                        double aSin)
Specified by:
rotateRight in interface DecompositionStore<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>

setToIdentity

public void setToIdentity(int aCol)
Specified by:
setToIdentity in interface DecompositionStore<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,
                               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<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<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)

transformSymmetric

public void transformSymmetric(Householder<BigDecimal> aTransf)
Specified by:
transformSymmetric in interface DecompositionStore<BigDecimal>

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.

tred2

public void tred2(ArrayAccess<BigDecimal> mainDiagonal,
                  ArrayAccess<BigDecimal> offDiagonal,
                  boolean yesvecs)
Specified by:
tred2 in interface DecompositionStore<BigDecimal>

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

doubleValue

public double doubleValue(int anInd)

get

public N get(int anInd)

iterator

public final Iterator<N> iterator()

size

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

toString

public String toString()
Overrides:
toString in class Object