Search in sources :

Example 36 with DivideAndConquer

use of org.ojalgo.concurrent.DivideAndConquer in project ojAlgo by optimatika.

the class PrimitiveDenseStore method transformRight.

public void transformRight(final Householder<Double> transformation, final int firstRow) {
    final Householder.Primitive tmpTransf = PrimitiveDenseStore.cast(transformation);
    final double[] tmpData = data;
    final int tmpRowDim = myRowDim;
    final int tmpColDim = myColDim;
    final double[] tmpWorker = this.getWorkerColumn();
    if ((tmpRowDim - firstRow) > HouseholderRight.THRESHOLD) {
        final DivideAndConquer tmpConquerer = new DivideAndConquer() {

            @Override
            public void conquer(final int first, final int limit) {
                HouseholderRight.invoke(tmpData, tmpRowDim, first, limit, tmpColDim, tmpTransf, tmpWorker);
            }
        };
        tmpConquerer.invoke(firstRow, tmpRowDim, HouseholderRight.THRESHOLD);
    } else {
        HouseholderRight.invoke(tmpData, tmpRowDim, firstRow, tmpRowDim, tmpColDim, tmpTransf, tmpWorker);
    }
}
Also used : DivideAndConquer(org.ojalgo.concurrent.DivideAndConquer) Householder(org.ojalgo.matrix.transformation.Householder)

Example 37 with DivideAndConquer

use of org.ojalgo.concurrent.DivideAndConquer in project ojAlgo by optimatika.

the class PrimitiveDenseStore method applyCholesky.

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

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

Example 38 with DivideAndConquer

use of org.ojalgo.concurrent.DivideAndConquer in project ojAlgo by optimatika.

the class GenericDenseStore method fillMatching.

@Override
public void fillMatching(final Access1D<?> values) {
    if (values instanceof ConjugatedStore) {
        final TransjugatedStore<?> conjugated = (ConjugatedStore<?>) values;
        if (myColDim > FillMatchingSingle.THRESHOLD) {
            final DivideAndConquer tmpConquerer = new DivideAndConquer() {

                @Override
                public void conquer(final int first, final int limit) {
                    FillMatchingSingle.conjugate(data, myRowDim, first, limit, conjugated.getOriginal(), myFactory.scalar());
                }
            };
            tmpConquerer.invoke(0, myColDim, FillMatchingSingle.THRESHOLD);
        } else {
            FillMatchingSingle.conjugate(data, myRowDim, 0, myColDim, conjugated.getOriginal(), myFactory.scalar());
        }
    } else if (values instanceof TransposedStore) {
        final TransjugatedStore<?> transposed = (TransposedStore<?>) values;
        if (myColDim > FillMatchingSingle.THRESHOLD) {
            final DivideAndConquer tmpConquerer = new DivideAndConquer() {

                @Override
                public void conquer(final int first, final int limit) {
                    FillMatchingSingle.transpose(data, myRowDim, first, limit, transposed.getOriginal(), myFactory.scalar());
                }
            };
            tmpConquerer.invoke(0, myColDim, FillMatchingSingle.THRESHOLD);
        } else {
            FillMatchingSingle.transpose(data, myRowDim, 0, myColDim, transposed.getOriginal(), myFactory.scalar());
        }
    } else {
        super.fillMatching(values);
    }
}
Also used : DivideAndConquer(org.ojalgo.concurrent.DivideAndConquer)

Example 39 with DivideAndConquer

use of org.ojalgo.concurrent.DivideAndConquer in project ojAlgo by optimatika.

the class GenericDenseStore method transformLeft.

public void transformLeft(final Householder<N> transformation, final int firstColumn) {
    final Householder.Generic<N> tmpTransf = this.cast(transformation);
    final N[] tmpData = data;
    final int tmpRowDim = myRowDim;
    final int tmpColDim = myColDim;
    if ((tmpColDim - firstColumn) > HouseholderLeft.THRESHOLD) {
        final DivideAndConquer tmpConquerer = new DivideAndConquer() {

            @Override
            public void conquer(final int aFirst, final int aLimit) {
                HouseholderLeft.invoke(tmpData, tmpRowDim, aFirst, aLimit, tmpTransf, myFactory.scalar());
            }
        };
        tmpConquerer.invoke(firstColumn, tmpColDim, HouseholderLeft.THRESHOLD);
    } else {
        HouseholderLeft.invoke(tmpData, tmpRowDim, firstColumn, tmpColDim, tmpTransf, myFactory.scalar());
    }
}
Also used : DivideAndConquer(org.ojalgo.concurrent.DivideAndConquer) Householder(org.ojalgo.matrix.transformation.Householder)

Example 40 with DivideAndConquer

use of org.ojalgo.concurrent.DivideAndConquer in project ojAlgo by optimatika.

the class GenericDenseStore method fillMatching.

@Override
public void fillMatching(final Access1D<N> left, final BinaryFunction<N> function, final Access1D<N> right) {
    final int matchingCount = (int) FunctionUtils.min(this.count(), left.count(), right.count());
    if (myColDim > FillMatchingDual.THRESHOLD) {
        final DivideAndConquer tmpConquerer = new DivideAndConquer() {

            @Override
            protected void conquer(final int first, final int limit) {
                ReferenceTypeArray.invoke(data, first, limit, 1, left, function, right);
            }
        };
        tmpConquerer.invoke(0, matchingCount, FillMatchingDual.THRESHOLD * FillMatchingDual.THRESHOLD);
    } else {
        ReferenceTypeArray.invoke(data, 0, matchingCount, 1, left, function, right);
    }
}
Also used : DivideAndConquer(org.ojalgo.concurrent.DivideAndConquer)

Aggregations

DivideAndConquer (org.ojalgo.concurrent.DivideAndConquer)46 Householder (org.ojalgo.matrix.transformation.Householder)8 BigDecimal (java.math.BigDecimal)7 ComplexNumber (org.ojalgo.scalar.ComplexNumber)7 BigArray (org.ojalgo.array.BigArray)3 ComplexArray (org.ojalgo.array.ComplexArray)3 Primitive64Array (org.ojalgo.array.Primitive64Array)3