org.ojalgo.matrix.store
Class ComplexDenseStore

java.lang.Object
  extended by org.ojalgo.array.ComplexArray
      extended by org.ojalgo.matrix.store.ComplexDenseStore
All Implemented Interfaces:
Serializable, CholeskyDecomposition.CholeskyStore<ComplexNumber>, LUDecomposition.LUStore<ComplexNumber>, QRDecomposition.QRStore<ComplexNumber>, MatrixStore<ComplexNumber>, PhysicalStore<ComplexNumber>

public final class ComplexDenseStore
extends ComplexArray
implements PhysicalStore<ComplexNumber>, CholeskyDecomposition.CholeskyStore<ComplexNumber>, LUDecomposition.LUStore<ComplexNumber>, QRDecomposition.QRStore<ComplexNumber>, Serializable

A ComplexNumber implementation of PhysicalStore.

Author:
apete
See Also:
Serialized Form

Field Summary
static PhysicalFactory<ComplexNumber> FACTORY
           
 int length
           
 
Method Summary
 void add(ComplexNumber aNmbr)
           
 void add(PhysicalStore<ComplexNumber> aStore)
           
 void applyHouseholder(int aFirstTargetCol, MatrixStore<ComplexNumber> aHouseholderStore, int aHouseholderCol, Object aColumnArray)
           
 ComplexNumber calculateColumnNorm(int aRow, int aCol, int aDegree)
           
 ComplexNumber calculateRowNorm(int aRow, int aCol, int aDegree)
           
 ComplexNumber calculateTrace()
           
 ComplexNumber calculateVectorNorm(int aDegree)
           
 ComplexNumber calculateVectorProduct(PhysicalStore<ComplexNumber> aStore)
           
 boolean computeCholesky()
           
 LUDecomposition.Pivot computeLU()
           
 void computeQR()
           
 ComplexDenseStore copy()
          Each call must produce a new instance.
 ComplexNumber countNonZeroElements()
           
 void divide(ComplexNumber aNmbr)
           
 void divideElements(PhysicalStore<ComplexNumber> aStore)
           
 double doubleValue(int anInd)
           
 double doubleValue(int aRow, int aCol)
           
 boolean equals(Object anObj)
           
 boolean equals(PhysicalStore<ComplexNumber> aStore, NumberContext aCntxt)
           
 boolean equals(org.ojalgo.array.ReferenceTypeArray<N> anArray)
           
 void exchangeRows(int aRowA, int aRowB)
           
 void exchangeSets(int aFirstA, int aFirstB, int aStep, int aCount)
           
 void fillAll(N aNmbr)
           
 void fillOne(int anInd, N aNmbr)
           
 void fillSet(int[] someIndeces, N aNmbr)
           
 void fillSet(int aFirst, int aLimit, int aStep, N aNmbr)
           
 int getColDim()
           
 ComplexNumber getLargestElement()
           
 int getMinDim()
           
 N getNumber(int anInd)
           
 ComplexNumber getNumber(int aRow, int aCol)
           
 PhysicalFactory<ComplexNumber> getPhysicalFactory()
           
 int getRowDim()
           
 int hashCode()
           
 boolean isAbsolute(int aRow, int aCol)
           
 boolean isLowerLeftShaded()
           The lower (left) triangle is shaded leaving an upper Hessenberg matrix.
 boolean isShaded()
           Either the lower (left) or the upper (right) triangles are shaded.
 boolean isUpperRightShaded()
           The upper (right) triangle is shaded leaving a lower Hessenberg matrix.
 boolean isZero(int aRow, int aCol)
           
 void modifyAll(BinaryFunction<N> aFunc, N aNmbr)
           
 void modifyAll(ParameterFunction<N> aFunc, int aParam)
           
 void modifyAll(UnaryFunction<N> aFunc)
           
 void modifyOne(int anInd, BinaryFunction<N> aFunc, N aNmbr)
           
 void modifyOne(int anInd, ParameterFunction<N> aFunc, int aParam)
           
 void modifyOne(int anInd, UnaryFunction<N> aFunc)
           
 void modifySet(int[] someIndeces, BinaryFunction<N> aFunc, N aNmbr)
           
 void modifySet(int[] someIndeces, ParameterFunction<N> aFunc, int aParam)
           
 void modifySet(int[] someIndeces, UnaryFunction<N> aFunc)
           
 void modifySet(int aFirst, int aLimit, int aStep, BinaryFunction<N> aFunc, N aNmbr)
           
 void modifySet(int aFirst, int aLimit, int aStep, ParameterFunction<N> aFunc, int aParam)
           
 void modifySet(int aFirst, int aLimit, int aStep, UnaryFunction<N> aFunc)
           
 void multiply(ComplexNumber aNmbr)
           
 ComplexNumber multiplyBothSides(MatrixStore<ComplexNumber> aStore)
          Calculates [aStore]T[this][aStore] as in a quadratic function [x]T[Q][x].
 void multiplyElements(PhysicalStore<ComplexNumber> aStore)
           
 MatrixStore<ComplexNumber> multiplyLeft(MatrixStore<ComplexNumber> aStore)
           
 void multiplyLeft(Rotation<ComplexNumber> aRotation)
           
 MatrixStore<ComplexNumber> multiplyRight(MatrixStore<ComplexNumber> aStore)
           
 void multiplyRight(Rotation<ComplexNumber> aRotation)
           
 void negateAll()
           
 void rotateLeft(int aLowerIndex, int aHigherIndex, ComplexNumber anAngle)
           As in MatrixStore.multiplyLeft(MatrixStore) where the left/parameter matrix is a plane rotation.
 void rotateRight(int aLowerIndex, int aHigherIndex, ComplexNumber anAngle)
           As in MatrixStore.multiplyRight(MatrixStore) where the right/parameter matrix is a plane rotation.
 int searchAscending(N aNmbr)
           
 void set(int aRow, int aCol, ComplexNumber aNmbr)
           
 void set(int aRow, int aCol, double aNmbr)
           
 void shadeLowerLeft()
           Shades the lower (left) triangle, leaving an upper Hessenberg matrix.
 void shadeUpperRight()
           Shades the upper (right) triangle, leaving a lower Hessenberg matrix.
 int size()
           
 void sortAscending()
           
 void substituteBackwards(MatrixStore<ComplexNumber> aBody, boolean assumeOne)
           
 void substituteForwards(MatrixStore<ComplexNumber> aBody, boolean assumeOne)
           
 void subtract(ComplexNumber aNmbr)
           
 void subtract(PhysicalStore<ComplexNumber> aStore)
           
 List<ComplexNumber> toList()
           
 PhysicalStore<ComplexNumber> toPhysicalStore()
          May (probably will) return the same instance with every call.
 double[][] toRawCopy()
           
 Scalar<ComplexNumber> toScalar(int aRow, int aCol)
           
 String toString()
           
 Array1Dim<N> toUtility1Dim()
           A utility facade that conveniently/consistently presents the BasicArray as a one-dimensional array.
 Array2Dim<N> toUtility2Dim()
           A utility facade that conveniently/consistently presents the BasicArray as a two-dimensional array.
 ArrayAnyDim<N> toUtilityAnyDim()
           A utility facade that conveniently/consistently presents the BasicArray as a multi-dimensional array.
 void unshade()
          Unshades both the lower (left) and upper (right) triangles.
 void visitAll(AggregatorFunction<N> aVisitor)
           
 void visitOne(int anInd, AggregatorFunction<N> aVisitor)
           
 void visitSet(int[] someIndeces, AggregatorFunction<N> aVisitor)
           
 void visitSet(int aFirst, int aLimit, int aStep, AggregatorFunction<N> aVisitor)
           
 
Methods inherited from class org.ojalgo.array.ComplexArray
enforceAll, isAbsolute, isReal, isZero, toScalar
 
Methods inherited from class java.lang.Object
getClass, notify, notifyAll, wait, wait, wait
 
Methods inherited from interface org.ojalgo.matrix.store.PhysicalStore
enforceAll, fillAll, visitAll
 

Field Detail

FACTORY

public static final PhysicalFactory<ComplexNumber> FACTORY

length

public final int length
Method Detail

add

public void add(ComplexNumber aNmbr)
Specified by:
add in interface PhysicalStore<ComplexNumber>

add

public void add(PhysicalStore<ComplexNumber> aStore)
Specified by:
add in interface PhysicalStore<ComplexNumber>

applyHouseholder

public void applyHouseholder(int aFirstTargetCol,
                             MatrixStore<ComplexNumber> aHouseholderStore,
                             int aHouseholderCol,
                             Object aColumnArray)
Parameters:
aFirstTargetCol - The first column of "this" to be transformed.
aHouseholderStore - The MatrixStore where the householder column is stored.
aHouseholderCol - the index of the householder column in aHouseholderStore.
aColumnArray - An array (values not set) for internal/temporary storage of the householder column. Should be of type N[] or double[].

calculateColumnNorm

public ComplexNumber calculateColumnNorm(int aRow,
                                         int aCol,
                                         int aDegree)
Specified by:
calculateColumnNorm in interface PhysicalStore<ComplexNumber>

calculateRowNorm

public ComplexNumber calculateRowNorm(int aRow,
                                      int aCol,
                                      int aDegree)
Specified by:
calculateRowNorm in interface PhysicalStore<ComplexNumber>

calculateTrace

public ComplexNumber calculateTrace()
Specified by:
calculateTrace in interface PhysicalStore<ComplexNumber>

calculateVectorNorm

public ComplexNumber calculateVectorNorm(int aDegree)
Specified by:
calculateVectorNorm in interface PhysicalStore<ComplexNumber>

calculateVectorProduct

public ComplexNumber calculateVectorProduct(PhysicalStore<ComplexNumber> aStore)
Specified by:
calculateVectorProduct in interface PhysicalStore<ComplexNumber>

computeCholesky

public boolean computeCholesky()
Specified by:
computeCholesky in interface CholeskyDecomposition.CholeskyStore<ComplexNumber>

computeLU

public LUDecomposition.Pivot computeLU()
Specified by:
computeLU in interface LUDecomposition.LUStore<ComplexNumber>

computeQR

public void computeQR()
Specified by:
computeQR in interface QRDecomposition.QRStore<ComplexNumber>

copy

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

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

countNonZeroElements

public ComplexNumber countNonZeroElements()
Specified by:
countNonZeroElements in interface PhysicalStore<ComplexNumber>

divide

public void divide(ComplexNumber aNmbr)
Specified by:
divide in interface PhysicalStore<ComplexNumber>

divideElements

public void divideElements(PhysicalStore<ComplexNumber> aStore)
Specified by:
divideElements in interface PhysicalStore<ComplexNumber>

doubleValue

public double doubleValue(int aRow,
                          int aCol)
Specified by:
doubleValue in interface MatrixStore<ComplexNumber>

equals

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

exchangeRows

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

getColDim

public int getColDim()
Specified by:
getColDim in interface MatrixStore<ComplexNumber>

getLargestElement

public ComplexNumber getLargestElement()
Specified by:
getLargestElement in interface PhysicalStore<ComplexNumber>

getMinDim

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

getNumber

public ComplexNumber getNumber(int aRow,
                               int aCol)
Specified by:
getNumber in interface MatrixStore<ComplexNumber>

getPhysicalFactory

public PhysicalFactory<ComplexNumber> getPhysicalFactory()
Specified by:
getPhysicalFactory in interface MatrixStore<ComplexNumber>

getRowDim

public int getRowDim()
Specified by:
getRowDim in interface MatrixStore<ComplexNumber>

isAbsolute

public boolean isAbsolute(int aRow,
                          int aCol)
Specified by:
isAbsolute in interface PhysicalStore<ComplexNumber>

isLowerLeftShaded

public boolean isLowerLeftShaded()
Description copied from interface: MatrixStore

The lower (left) triangle is shaded leaving an upper Hessenberg matrix.

Specified by:
isLowerLeftShaded in interface MatrixStore<ComplexNumber>
See Also:
MatrixStore.isUpperRightShaded(), MatrixStore.isShaded(), PhysicalStore.shadeLowerLeft(), PhysicalStore.unshade()

isShaded

public boolean isShaded()
Description copied from interface: MatrixStore

Either the lower (left) or the upper (right) triangles are shaded.

Shading part of a MatrixStore causes that part to be ignored (as if it had zero valued elements) when doing matrix multiplication. It is possible to shade part of a PhysicalStore even though the shaded elements are not actually zero valued. Calling doubleValue(i, j), getNumber(i, j) or toScalar(i, j) will return the actual stored value.

Specified by:
isShaded in interface MatrixStore<ComplexNumber>
See Also:
MatrixStore.isLowerLeftShaded(), MatrixStore.isUpperRightShaded(), PhysicalStore.unshade()

isUpperRightShaded

public boolean isUpperRightShaded()
Description copied from interface: MatrixStore

The upper (right) triangle is shaded leaving a lower Hessenberg matrix.

Specified by:
isUpperRightShaded in interface MatrixStore<ComplexNumber>
See Also:
MatrixStore.isLowerLeftShaded(), MatrixStore.isShaded(), PhysicalStore.shadeUpperRight(), PhysicalStore.unshade()

isZero

public boolean isZero(int aRow,
                      int aCol)
Specified by:
isZero in interface PhysicalStore<ComplexNumber>

multiply

public void multiply(ComplexNumber aNmbr)
Specified by:
multiply in interface PhysicalStore<ComplexNumber>

multiplyBothSides

public ComplexNumber multiplyBothSides(MatrixStore<ComplexNumber> aStore)
Description copied from interface: MatrixStore
Calculates [aStore]T[this][aStore] as in a quadratic function [x]T[Q][x]. The input parameter is assumed to be a vector, but it does not matter if it's a row vector or a column vector. "this" is assumed to be a square matrix. Instead of returning a 1-by-1 matrix this method returns a scalar.

Specified by:
multiplyBothSides in interface MatrixStore<ComplexNumber>

multiplyElements

public void multiplyElements(PhysicalStore<ComplexNumber> aStore)
Specified by:
multiplyElements in interface PhysicalStore<ComplexNumber>

multiplyLeft

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

multiplyLeft

public void multiplyLeft(Rotation<ComplexNumber> aRotation)
Specified by:
multiplyLeft in interface PhysicalStore<ComplexNumber>

multiplyRight

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

multiplyRight

public void multiplyRight(Rotation<ComplexNumber> aRotation)
Specified by:
multiplyRight in interface PhysicalStore<ComplexNumber>

negateAll

public void negateAll()
Specified by:
negateAll in interface PhysicalStore<ComplexNumber>

rotateLeft

public void rotateLeft(int aLowerIndex,
                       int aHigherIndex,
                       ComplexNumber anAngle)
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:
rotateLeft in interface PhysicalStore<ComplexNumber>
See Also:
PhysicalStore.rotateRight(int, int, Number)

rotateRight

public void rotateRight(int aLowerIndex,
                        int aHigherIndex,
                        ComplexNumber anAngle)
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:
rotateRight in interface PhysicalStore<ComplexNumber>
See Also:
PhysicalStore.rotateLeft(int, int, Number)

set

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

set

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

shadeLowerLeft

public void shadeLowerLeft()
Description copied from interface: PhysicalStore

Shades the lower (left) triangle, leaving an upper Hessenberg matrix.

Specified by:
shadeLowerLeft in interface PhysicalStore<ComplexNumber>
See Also:
PhysicalStore.unshade()

shadeUpperRight

public void shadeUpperRight()
Description copied from interface: PhysicalStore

Shades the upper (right) triangle, leaving a lower Hessenberg matrix.

Specified by:
shadeUpperRight in interface PhysicalStore<ComplexNumber>
See Also:
PhysicalStore.unshade()

substituteBackwards

public void substituteBackwards(MatrixStore<ComplexNumber> aBody,
                                boolean assumeOne)

substituteForwards

public void substituteForwards(MatrixStore<ComplexNumber> aBody,
                               boolean assumeOne)

subtract

public void subtract(ComplexNumber aNmbr)
Specified by:
subtract in interface PhysicalStore<ComplexNumber>

subtract

public void subtract(PhysicalStore<ComplexNumber> aStore)
Specified by:
subtract in interface PhysicalStore<ComplexNumber>

toList

public List<ComplexNumber> toList()
Specified by:
toList in interface PhysicalStore<ComplexNumber>

toPhysicalStore

public PhysicalStore<ComplexNumber> toPhysicalStore()
Description copied from interface: MatrixStore
May (probably will) return the same instance with every call. PhysicalStore instances are mutable. If you plan to modify it you should make a copy first. Depending on what you do with the PhysicalStore you may have to unshade it.

Specified by:
toPhysicalStore in interface MatrixStore<ComplexNumber>
Returns:
A PhysicalStore representation of this MatrixStore.
See Also:
PhysicalStore.copy(), PhysicalStore.unshade()

toRawCopy

public double[][] toRawCopy()
Specified by:
toRawCopy in interface PhysicalStore<ComplexNumber>

toScalar

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

unshade

public void unshade()
Description copied from interface: PhysicalStore
Unshades both the lower (left) and upper (right) triangles.

Specified by:
unshade in interface PhysicalStore<ComplexNumber>
See Also:
PhysicalStore.shadeLowerLeft(), PhysicalStore.shadeUpperRight()

doubleValue

public final double doubleValue(int anInd)

equals

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

equals

public final boolean equals(org.ojalgo.array.ReferenceTypeArray<N> anArray)

exchangeSets

public final void exchangeSets(int aFirstA,
                               int aFirstB,
                               int aStep,
                               int aCount)

fillAll

public final void fillAll(N aNmbr)

fillOne

public final void fillOne(int anInd,
                          N aNmbr)

fillSet

public final void fillSet(int aFirst,
                          int aLimit,
                          int aStep,
                          N aNmbr)

fillSet

public final void fillSet(int[] someIndeces,
                          N aNmbr)

getNumber

public final N getNumber(int anInd)

hashCode

public final int hashCode()
Overrides:
hashCode in class Object

modifyAll

public final void modifyAll(BinaryFunction<N> aFunc,
                            N aNmbr)

modifyAll

public final void modifyAll(ParameterFunction<N> aFunc,
                            int aParam)

modifyAll

public final void modifyAll(UnaryFunction<N> aFunc)

modifyOne

public final void modifyOne(int anInd,
                            BinaryFunction<N> aFunc,
                            N aNmbr)

modifyOne

public final void modifyOne(int anInd,
                            ParameterFunction<N> aFunc,
                            int aParam)

modifyOne

public final void modifyOne(int anInd,
                            UnaryFunction<N> aFunc)

modifySet

public final void modifySet(int aFirst,
                            int aLimit,
                            int aStep,
                            BinaryFunction<N> aFunc,
                            N aNmbr)

modifySet

public final void modifySet(int aFirst,
                            int aLimit,
                            int aStep,
                            ParameterFunction<N> aFunc,
                            int aParam)

modifySet

public final void modifySet(int aFirst,
                            int aLimit,
                            int aStep,
                            UnaryFunction<N> aFunc)

modifySet

public final void modifySet(int[] someIndeces,
                            BinaryFunction<N> aFunc,
                            N aNmbr)

modifySet

public final void modifySet(int[] someIndeces,
                            ParameterFunction<N> aFunc,
                            int aParam)

modifySet

public final void modifySet(int[] someIndeces,
                            UnaryFunction<N> aFunc)

searchAscending

public final int searchAscending(N aNmbr)
See Also:
BasicArray.searchAscending(java.lang.Number)

sortAscending

public final void sortAscending()
See Also:
Arrays.sort(Object[]), searchAscending(Number)

visitAll

public final void visitAll(AggregatorFunction<N> aVisitor)

visitOne

public final void visitOne(int anInd,
                           AggregatorFunction<N> aVisitor)

visitSet

public final void visitSet(int aFirst,
                           int aLimit,
                           int aStep,
                           AggregatorFunction<N> aVisitor)

visitSet

public final void visitSet(int[] someIndeces,
                           AggregatorFunction<N> aVisitor)

size

public final int size()

toString

public final String toString()
Overrides:
toString in class Object

toUtility1Dim

public final Array1Dim<N> toUtility1Dim()

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.


toUtility2Dim

public final Array2Dim<N> toUtility2Dim()

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...


toUtilityAnyDim

public final ArrayAnyDim<N> toUtilityAnyDim()

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.