當前位置: 首頁>>代碼示例>>Java>>正文


Java Aggregator類代碼示例

本文整理匯總了Java中org.ojalgo.function.aggregator.Aggregator的典型用法代碼示例。如果您正苦於以下問題:Java Aggregator類的具體用法?Java Aggregator怎麽用?Java Aggregator使用的例子?那麽, 這裏精選的類代碼示例或許可以為您提供幫助。


Aggregator類屬於org.ojalgo.function.aggregator包,在下文中一共展示了Aggregator類的15個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的Java代碼示例。

示例1: doTest

import org.ojalgo.function.aggregator.Aggregator; //導入依賴的package包/類
@Override
void doTest(final BasicArray<Double> array) {

    for (int i = 0; i < INDICES.length; i++) {
        array.set(INDICES[i], 1.0);
    }

    final AggregatorFunction<Double> tmpVisitor = Aggregator.SUM.getFunction(PrimitiveAggregator.getSet());

    array.visitAll(tmpVisitor);

    TestUtils.assertTrue(1 <= tmpVisitor.intValue());
    TestUtils.assertTrue(INDICES.length >= tmpVisitor.intValue());
}
 
開發者ID:optimatika,項目名稱:ojAlgo-extensions,代碼行數:15,代碼來源:AggregatorSum.java

示例2: doTest

import org.ojalgo.function.aggregator.Aggregator; //導入依賴的package包/類
@Override
void doTest(final BasicArray<Double> array) {

    for (int i = 0; i < INDICES.length; i++) {
        array.set(INDICES[i], 1.0);
    }

    final AggregatorFunction<Double> tmpVisitor = Aggregator.CARDINALITY.getFunction(PrimitiveAggregator.getSet());

    array.visitAll(tmpVisitor);

    TestUtils.assertTrue(1 <= tmpVisitor.intValue());
    TestUtils.assertTrue(INDICES.length >= tmpVisitor.intValue());
}
 
開發者ID:optimatika,項目名稱:ojAlgo-extensions,代碼行數:15,代碼來源:AggregatorCardinality.java

示例3: calculateInfinityNorm

import org.ojalgo.function.aggregator.Aggregator; //導入依賴的package包/類
/**
 * @return The inf-norm or maximum row sum
 */
public static double calculateInfinityNorm(final BasicMatrix matrix) {

    double retVal = PrimitiveMath.ZERO;

    final long tmpLimit = matrix.countRows();
    for (long i = 0L; i < tmpLimit; i++) {
        retVal = PrimitiveFunction.MAX.invoke(retVal, matrix.aggregateRow(i, Aggregator.NORM1).doubleValue());
    }

    return retVal;
}
 
開發者ID:optimatika,項目名稱:ojAlgo,代碼行數:15,代碼來源:BasicMatrix.java

示例4: calculateOneNorm

import org.ojalgo.function.aggregator.Aggregator; //導入依賴的package包/類
/**
 * @return The 1-norm or maximum column sum
 */
public static double calculateOneNorm(final BasicMatrix matrix) {

    double retVal = PrimitiveMath.ZERO;

    final long tmpLimit = matrix.countColumns();
    for (long j = 0L; j < tmpLimit; j++) {
        retVal = PrimitiveFunction.MAX.invoke(retVal, matrix.aggregateColumn(j, Aggregator.NORM1).doubleValue());
    }

    return retVal;
}
 
開發者ID:optimatika,項目名稱:ojAlgo,代碼行數:15,代碼來源:BasicMatrix.java

示例5: tune

import org.ojalgo.function.aggregator.Aggregator; //導入依賴的package包/類
@Override
@Benchmark
public Object tune() {
    for (final Aggregator tmpAggregator : Aggregator.values()) {
        target.aggregateAll(tmpAggregator);
    }
    return target;
}
 
開發者ID:optimatika,項目名稱:ojAlgo,代碼行數:9,代碼來源:ThresholdAggregateAll.java

示例6: markInteger

import org.ojalgo.function.aggregator.Aggregator; //導入依賴的package包/類
protected synchronized void markInteger(final NodeKey key, final ExpressionsBasedModel model, final Optimisation.Result result) {

        if (this.isProgress()) {
            this.log("New integer solution {}", result);
            this.log("\[email protected] node {}", key);
        }

        final Optimisation.Result tmpCurrentlyTheBest = myBestResultSoFar;

        if (tmpCurrentlyTheBest == null) {

            myBestResultSoFar = result;

        } else if (myMinimisation && (result.getValue() < tmpCurrentlyTheBest.getValue())) {

            myBestResultSoFar = result;

        } else if (!myMinimisation && (result.getValue() > tmpCurrentlyTheBest.getValue())) {

            myBestResultSoFar = result;

        } else {

            if (this.isDebug()) {
                this.log("Previously best {}", myBestResultSoFar);
            }
        }

        if (tmpCurrentlyTheBest != null) {

            final double objDiff = ABS.invoke((result.getValue() - tmpCurrentlyTheBest.getValue()) / tmpCurrentlyTheBest.getValue());

            for (int i = 0; i < myIntegerIndices.length; i++) {
                final double varDiff = ABS.invoke(result.doubleValue(myIntegerIndices[i]) - tmpCurrentlyTheBest.doubleValue(myIntegerIndices[i]));
                if (!options.feasibility.isZero(varDiff)) {
                    this.addIntegerSignificance(i, objDiff / varDiff);
                }
            }

        } else {

            final MatrixStore<Double> gradient = this.getGradient(Access1D.asPrimitive1D(result));
            final double largest = gradient.aggregateAll(Aggregator.LARGEST);

            if (largest > ZERO) {
                for (int i = 0; i < myIntegerIndices.length; i++) {
                    this.addIntegerSignificance(i, ABS.invoke(gradient.doubleValue(myIntegerIndices[i])) / largest);
                }
            }
        }

        myIntegerSolutionsCount.incrementAndGet();
    }
 
開發者ID:optimatika,項目名稱:ojAlgo,代碼行數:54,代碼來源:IntegerSolver.java

示例7: aggregateColumn

import org.ojalgo.function.aggregator.Aggregator; //導入依賴的package包/類
public N aggregateColumn(final long row, final long col, final Aggregator aggregator) {
    return myStore.aggregateColumn(row, col, aggregator);
}
 
開發者ID:optimatika,項目名稱:ojAlgo,代碼行數:4,代碼來源:AbstractMatrix.java

示例8: aggregateDiagonal

import org.ojalgo.function.aggregator.Aggregator; //導入依賴的package包/類
public N aggregateDiagonal(final long row, final long col, final Aggregator aggregator) {
    return myStore.aggregateDiagonal(row, col, aggregator);
}
 
開發者ID:optimatika,項目名稱:ojAlgo,代碼行數:4,代碼來源:AbstractMatrix.java

示例9: aggregateRange

import org.ojalgo.function.aggregator.Aggregator; //導入依賴的package包/類
public N aggregateRange(final long first, final long limit, final Aggregator aggregator) {
    return myStore.aggregateRange(first, limit, aggregator);
}
 
開發者ID:optimatika,項目名稱:ojAlgo,代碼行數:4,代碼來源:AbstractMatrix.java

示例10: aggregateRow

import org.ojalgo.function.aggregator.Aggregator; //導入依賴的package包/類
public N aggregateRow(final long row, final long col, final Aggregator aggregator) {
    return myStore.aggregateRow(row, col, aggregator);
}
 
開發者ID:optimatika,項目名稱:ojAlgo,代碼行數:4,代碼來源:AbstractMatrix.java

示例11: getVectorNorm

import org.ojalgo.function.aggregator.Aggregator; //導入依賴的package包/類
/**
 * Treats [this] as if it is one dimensional (a vector) and calculates the vector norm. The interface only
 * requires that implementations can handle arguments 0, 1, 2 and {@linkplain Integer#MAX_VALUE}.
 *
 * @deprecated v40 Use {@link #aggregateAll(org.ojalgo.function.aggregator.Aggregator)}
 */
@Deprecated
public Scalar<N> getVectorNorm(final int degree) {

    switch (degree) {

    case 0:

        return myStore.physical().scalar().convert(myStore.aggregateAll(Aggregator.CARDINALITY));

    case 1:

        return myStore.physical().scalar().convert(myStore.aggregateAll(Aggregator.NORM1));

    case 2:

        return myStore.physical().scalar().convert(myStore.aggregateAll(Aggregator.NORM2));

    default:

        return myStore.physical().scalar().convert(myStore.aggregateAll(Aggregator.LARGEST));
    }
}
 
開發者ID:optimatika,項目名稱:ojAlgo,代碼行數:29,代碼來源:AbstractMatrix.java

示例12: solve

import org.ojalgo.function.aggregator.Aggregator; //導入依賴的package包/類
@SuppressWarnings("unchecked")
public final MatrixStore<Double> solve(final Access2D<?> body, final Access2D<?> rhs, final PhysicalStore<Double> current) throws RecoverableCondition {

    MatrixStore<Double> tmpBody = null;
    if ((body instanceof MatrixStore<?>) && (body.get(0L) instanceof Double)) {
        tmpBody = (MatrixStore<Double>) body;
    } else {
        tmpBody = MatrixStore.PRIMITIVE.makeWrapper(body).get();
    }
    final MatrixStore<Double> tmpBodyDiagonal = PrimitiveDenseStore.FACTORY.columns(tmpBody.sliceDiagonal(0L, 0L));

    MatrixStore<Double> tmpRHS = null;
    if ((rhs instanceof MatrixStore<?>) && (rhs.get(0L) instanceof Double)) {
        tmpRHS = (MatrixStore<Double>) rhs;
    } else {
        tmpRHS = MatrixStore.PRIMITIVE.makeWrapper(rhs).get();
    }

    final PhysicalStore<Double> tmpIncrement = this.preallocate(body, rhs);

    double tmpNormErr = POSITIVE_INFINITY;
    final double tmpNormRHS = tmpRHS.aggregateAll(Aggregator.NORM2);

    int tmpIterations = 0;
    final int tmpLimit = this.getIterationsLimit();
    final NumberContext tmpCntxt = this.getAccuracyContext();
    final double tmpRelaxation = this.getRelaxationFactor();
    do {

        current.premultiply(tmpBody).operateOnMatching(tmpRHS, SUBTRACT).supplyTo(tmpIncrement);
        tmpNormErr = tmpIncrement.aggregateAll(Aggregator.NORM2);
        tmpIncrement.modifyMatching(DIVIDE, tmpBodyDiagonal);

        if (this.getAccuracyContext().isDifferent(ONE, tmpRelaxation)) {
            tmpIncrement.multiply(tmpRelaxation);
        }

        current.modifyMatching(ADD, tmpIncrement);

        tmpIterations++;

        if (this.isDebugPrinterSet()) {
            this.debug(tmpIterations, current);
        }

    } while ((tmpIterations < tmpLimit) && !tmpCntxt.isSmall(tmpNormRHS, tmpNormErr));

    return current;
}
 
開發者ID:optimatika,項目名稱:ojAlgo,代碼行數:50,代碼來源:JacobiSolver.java

示例13: norm

import org.ojalgo.function.aggregator.Aggregator; //導入依賴的package包/類
default double norm() {
    return this.aggregateAll(Aggregator.NORM2).doubleValue();
}
 
開發者ID:optimatika,項目名稱:ojAlgo,代碼行數:4,代碼來源:MatrixStore.java

示例14: aggregateAll

import org.ojalgo.function.aggregator.Aggregator; //導入依賴的package包/類
default N aggregateAll(final Aggregator aggregator) {
    return this.aggregateRange(0L, this.count(), aggregator);
}
 
開發者ID:optimatika,項目名稱:ojAlgo,代碼行數:4,代碼來源:Access1D.java

示例15: aggregateColumn

import org.ojalgo.function.aggregator.Aggregator; //導入依賴的package包/類
default N aggregateColumn(final long col, final Aggregator aggregator) {
    return this.aggregateColumn(0L, col, aggregator);
}
 
開發者ID:optimatika,項目名稱:ojAlgo,代碼行數:4,代碼來源:Access2D.java


注:本文中的org.ojalgo.function.aggregator.Aggregator類示例由純淨天空整理自Github/MSDocs等開源代碼及文檔管理平台,相關代碼片段篩選自各路編程大神貢獻的開源項目,源碼版權歸原作者所有,傳播和使用請參考對應項目的License;未經允許,請勿轉載。