Search in sources :

Example 21 with DivideAndConquer

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

the class GenericDenseStore method substituteBackwards.

public void substituteBackwards(final Access2D<N> body, final boolean unitDiagonal, final boolean conjugated, final boolean hermitian) {
    final int tmpRowDim = myRowDim;
    final int tmpColDim = myColDim;
    if (tmpColDim > SubstituteBackwards.THRESHOLD) {
        final DivideAndConquer tmpConquerer = new DivideAndConquer() {

            @Override
            public void conquer(final int aFirst, final int aLimit) {
                SubstituteBackwards.invoke(GenericDenseStore.this.data, tmpRowDim, aFirst, aLimit, body, unitDiagonal, conjugated, hermitian, myFactory.scalar());
            }
        };
        tmpConquerer.invoke(0, tmpColDim, SubstituteBackwards.THRESHOLD);
    } else {
        SubstituteBackwards.invoke(data, tmpRowDim, 0, tmpColDim, body, unitDiagonal, conjugated, hermitian, myFactory.scalar());
    }
}
Also used : DivideAndConquer(org.ojalgo.concurrent.DivideAndConquer)

Example 22 with DivideAndConquer

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

the class GenericDenseStore method aggregateAll.

public N aggregateAll(final Aggregator aggregator) {
    final int tmpRowDim = myRowDim;
    final int tmpColDim = myColDim;
    final AggregatorFunction<N> tmpMainAggr = aggregator.getFunction(myFactory.aggregator());
    if (tmpColDim > AggregateAll.THRESHOLD) {
        final DivideAndConquer tmpConquerer = new DivideAndConquer() {

            @Override
            public void conquer(final int aFirst, final int aLimit) {
                final AggregatorFunction<N> tmpPartAggr = aggregator.getFunction(myFactory.aggregator());
                GenericDenseStore.this.visit(tmpRowDim * aFirst, tmpRowDim * aLimit, 1, tmpPartAggr);
                synchronized (tmpMainAggr) {
                    tmpMainAggr.merge(tmpPartAggr.get());
                }
            }
        };
        tmpConquerer.invoke(0, tmpColDim, AggregateAll.THRESHOLD);
    } else {
        GenericDenseStore.this.visit(0, this.size(), 1, tmpMainAggr);
    }
    return tmpMainAggr.get();
}
Also used : DivideAndConquer(org.ojalgo.concurrent.DivideAndConquer)

Example 23 with DivideAndConquer

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

the class GenericDenseStore method applyCholesky.

public void applyCholesky(final int iterationPoint, final BasicArray<N> multipliers) {
    final N[] tmpData = data;
    final N[] tmpColumn = ((ScalarArray<N>) 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)

Example 24 with DivideAndConquer

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

the class GenericDenseStore method substituteForwards.

public void substituteForwards(final Access2D<N> body, final boolean unitDiagonal, final boolean conjugated, final boolean identity) {
    final int tmpRowDim = myRowDim;
    final int tmpColDim = myColDim;
    if (tmpColDim > SubstituteForwards.THRESHOLD) {
        final DivideAndConquer tmpConquerer = new DivideAndConquer() {

            @Override
            public void conquer(final int aFirst, final int aLimit) {
                SubstituteForwards.invoke(GenericDenseStore.this.data, tmpRowDim, aFirst, aLimit, body, unitDiagonal, conjugated, identity, myFactory.scalar());
            }
        };
        tmpConquerer.invoke(0, tmpColDim, SubstituteForwards.THRESHOLD);
    } else {
        SubstituteForwards.invoke(data, tmpRowDim, 0, tmpColDim, body, unitDiagonal, conjugated, identity, myFactory.scalar());
    }
}
Also used : DivideAndConquer(org.ojalgo.concurrent.DivideAndConquer)

Example 25 with DivideAndConquer

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

the class BigDenseStore method aggregateAll.

public BigDecimal aggregateAll(final Aggregator aggregator) {
    final int tmpRowDim = myRowDim;
    final int tmpColDim = myColDim;
    final AggregatorFunction<BigDecimal> tmpMainAggr = aggregator.getFunction(BigAggregator.getSet());
    if (tmpColDim > AggregateAll.THRESHOLD) {
        final DivideAndConquer tmpConquerer = new DivideAndConquer() {

            @Override
            public void conquer(final int aFirst, final int aLimit) {
                final AggregatorFunction<BigDecimal> tmpPartAggr = aggregator.getFunction(BigAggregator.getSet());
                BigDenseStore.this.visit(tmpRowDim * aFirst, tmpRowDim * aLimit, 1, tmpPartAggr);
                synchronized (tmpMainAggr) {
                    tmpMainAggr.merge(tmpPartAggr.get());
                }
            }
        };
        tmpConquerer.invoke(0, tmpColDim, AggregateAll.THRESHOLD);
    } else {
        BigDenseStore.this.visit(0, this.size(), 1, tmpMainAggr);
    }
    return tmpMainAggr.get();
}
Also used : DivideAndConquer(org.ojalgo.concurrent.DivideAndConquer) BigDecimal(java.math.BigDecimal)

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