Search in sources :

Example 1 with ComplexArray

use of org.ojalgo.array.ComplexArray in project ojAlgo by optimatika.

the class ComplexDenseStore method applyCholesky.

public void applyCholesky(final int iterationPoint, final BasicArray<ComplexNumber> multipliers) {
    final ComplexNumber[] tmpData = data;
    final ComplexNumber[] tmpColumn = ((ComplexArray) multipliers).data;
    if ((myColDim - iterationPoint - 1) > ApplyCholesky.THRESHOLD) {
        final DivideAndConquer tmpConquerer = new DivideAndConquer() {

            @Override
            protected void conquer(final int aFirst, final int aLimit) {
                ApplyCholesky.invoke(tmpData, myRowDim, aFirst, aLimit, tmpColumn);
            }
        };
        tmpConquerer.invoke(iterationPoint + 1, myColDim, ApplyCholesky.THRESHOLD);
    } else {
        ApplyCholesky.invoke(tmpData, myRowDim, iterationPoint + 1, myColDim, tmpColumn);
    }
}
Also used : DivideAndConquer(org.ojalgo.concurrent.DivideAndConquer) ComplexArray(org.ojalgo.array.ComplexArray) ComplexNumber(org.ojalgo.scalar.ComplexNumber)

Example 2 with ComplexArray

use of org.ojalgo.array.ComplexArray in project ojAlgo by optimatika.

the class ComplexDenseStore method applyLDL.

public void applyLDL(final int iterationPoint, final BasicArray<ComplexNumber> multipliers) {
    final ComplexNumber[] tmpData = data;
    final ComplexNumber[] tmpColumn = ((ComplexArray) multipliers).data;
    if ((myColDim - iterationPoint - 1) > ApplyLDL.THRESHOLD) {
        final DivideAndConquer tmpConquerer = new DivideAndConquer() {

            @Override
            protected void conquer(final int first, final int limit) {
                ApplyLDL.invoke(tmpData, myRowDim, first, limit, tmpColumn, iterationPoint);
            }
        };
        tmpConquerer.invoke(iterationPoint + 1, myColDim, ApplyLDL.THRESHOLD);
    } else {
        ApplyLDL.invoke(tmpData, myRowDim, iterationPoint + 1, myColDim, tmpColumn, iterationPoint);
    }
}
Also used : DivideAndConquer(org.ojalgo.concurrent.DivideAndConquer) ComplexArray(org.ojalgo.array.ComplexArray) ComplexNumber(org.ojalgo.scalar.ComplexNumber)

Example 3 with ComplexArray

use of org.ojalgo.array.ComplexArray in project ojAlgo by optimatika.

the class ComplexDenseStore method applyLU.

public void applyLU(final int iterationPoint, final BasicArray<ComplexNumber> multipliers) {
    final ComplexNumber[] tmpData = data;
    final ComplexNumber[] tmpColumn = ((ComplexArray) multipliers).data;
    if ((myColDim - iterationPoint - 1) > ApplyLU.THRESHOLD) {
        final DivideAndConquer tmpConquerer = new DivideAndConquer() {

            @Override
            protected void conquer(final int aFirst, final int aLimit) {
                ApplyLU.invoke(tmpData, myRowDim, aFirst, aLimit, tmpColumn, iterationPoint);
            }
        };
        tmpConquerer.invoke(iterationPoint + 1, myColDim, ApplyLU.THRESHOLD);
    } else {
        ApplyLU.invoke(tmpData, myRowDim, iterationPoint + 1, myColDim, tmpColumn, iterationPoint);
    }
}
Also used : DivideAndConquer(org.ojalgo.concurrent.DivideAndConquer) ComplexArray(org.ojalgo.array.ComplexArray) ComplexNumber(org.ojalgo.scalar.ComplexNumber)

Example 4 with ComplexArray

use of org.ojalgo.array.ComplexArray in project ojAlgo by optimatika.

the class ComplexDenseStore method divideAndCopyColumn.

public void divideAndCopyColumn(final int row, final int column, final BasicArray<ComplexNumber> destination) {
    final ComplexNumber[] tmpData = data;
    final int tmpRowDim = myRowDim;
    final ComplexNumber[] tmpDestination = ((ComplexArray) destination).data;
    int tmpIndex = row + (column * tmpRowDim);
    final ComplexNumber tmpDenominator = tmpData[tmpIndex];
    for (int i = row + 1; i < tmpRowDim; i++) {
        tmpIndex++;
        tmpDestination[i] = tmpData[tmpIndex] = tmpData[tmpIndex].divide(tmpDenominator);
    }
}
Also used : ComplexArray(org.ojalgo.array.ComplexArray) ComplexNumber(org.ojalgo.scalar.ComplexNumber)

Example 5 with ComplexArray

use of org.ojalgo.array.ComplexArray in project ojAlgo by optimatika.

the class PrimitiveDenseStore method computeInPlaceSchur.

public Array1D<ComplexNumber> computeInPlaceSchur(final PhysicalStore<Double> transformationCollector, final boolean eigenvalue) {
    // final PrimitiveDenseStore tmpThisCopy = this.copy();
    // final PrimitiveDenseStore tmpCollCopy = (PrimitiveDenseStore)
    // aTransformationCollector.copy();
    // 
    // tmpThisCopy.computeInPlaceHessenberg(true);
    // Actual
    final double[] tmpData = data;
    final double[] tmpCollectorData = ((PrimitiveDenseStore) transformationCollector).data;
    final double[] tmpVctrWork = new double[this.getMinDim()];
    EvD1D.orthes(tmpData, tmpCollectorData, tmpVctrWork);
    // BasicLogger.logDebug("Schur Step", this);
    // BasicLogger.logDebug("Hessenberg", tmpThisCopy);
    final double[][] tmpDiags = EvD1D.hqr2(tmpData, tmpCollectorData, eigenvalue);
    final double[] aRawReal = tmpDiags[0];
    final double[] aRawImag = tmpDiags[1];
    final int tmpLength = Math.min(aRawReal.length, aRawImag.length);
    final ComplexArray retVal = ComplexArray.make(tmpLength);
    final ComplexNumber[] tmpRaw = retVal.data;
    for (int i = 0; i < tmpLength; i++) {
        tmpRaw[i] = ComplexNumber.of(aRawReal[i], aRawImag[i]);
    }
    return Array1D.COMPLEX.wrap(retVal);
}
Also used : ComplexArray(org.ojalgo.array.ComplexArray) ComplexNumber(org.ojalgo.scalar.ComplexNumber)

Aggregations

ComplexArray (org.ojalgo.array.ComplexArray)5 ComplexNumber (org.ojalgo.scalar.ComplexNumber)5 DivideAndConquer (org.ojalgo.concurrent.DivideAndConquer)3