当前位置: 首页>>代码示例>>Java>>正文


Java AggregatorFunction类代码示例

本文整理汇总了Java中org.ojalgo.function.aggregator.AggregatorFunction的典型用法代码示例。如果您正苦于以下问题:Java AggregatorFunction类的具体用法?Java AggregatorFunction怎么用?Java AggregatorFunction使用的例子?那么, 这里精选的类代码示例或许可以为您提供帮助。


AggregatorFunction类属于org.ojalgo.function.aggregator包,在下文中一共展示了AggregatorFunction类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。

示例1: getRank

import org.ojalgo.function.aggregator.AggregatorFunction; //导入依赖的package包/类
public int getRank() {

        int retVal = 0;

        final DecompositionStore<N> tmpInPlace = this.getInPlace();

        final AggregatorFunction<N> tmpLargest = this.aggregator().largest();
        tmpInPlace.visitDiagonal(0L, 0L, tmpLargest);
        final double tmpLargestValue = tmpLargest.doubleValue();

        final int tmpMinDim = this.getMinDim();

        for (int ij = 0; ij < tmpMinDim; ij++) {
            if (!tmpInPlace.isSmall(ij, ij, tmpLargestValue)) {
                retVal++;
            }
        }

        return retVal;
    }
 
开发者ID:optimatika,项目名称:ojAlgo,代码行数:21,代码来源:LUDecomposition.java

示例2: getRank

import org.ojalgo.function.aggregator.AggregatorFunction; //导入依赖的package包/类
public int getRank() {

        int retVal = 0;

        final MatrixStore<Double> tmpR = this.getR();
        final int tmpMinDim = (int) Math.min(tmpR.countRows(), tmpR.countColumns());

        final AggregatorFunction<Double> tmpLargest = PrimitiveAggregator.LARGEST.get();
        tmpR.visitDiagonal(0L, 0L, tmpLargest);
        final double tmpLargestValue = tmpLargest.doubleValue();

        for (int ij = 0; ij < tmpMinDim; ij++) {
            if (!tmpR.isSmall(ij, ij, tmpLargestValue)) {
                retVal++;
            }
        }

        return retVal;
    }
 
开发者ID:optimatika,项目名称:ojAlgo,代码行数:20,代码来源:RawQR.java

示例3: getRank

import org.ojalgo.function.aggregator.AggregatorFunction; //导入依赖的package包/类
public int getRank() {

        int retVal = 0;

        final MatrixStore<Double> tmpU = this.getU();
        final int tmpMinDim = (int) Math.min(tmpU.countRows(), tmpU.countColumns());

        final AggregatorFunction<Double> tmpLargest = PrimitiveAggregator.LARGEST.get();
        tmpU.visitDiagonal(0L, 0L, tmpLargest);
        final double tmpLargestValue = tmpLargest.doubleValue();

        for (int ij = 0; ij < tmpMinDim; ij++) {
            if (!tmpU.isSmall(ij, ij, tmpLargestValue)) {
                retVal++;
            }
        }

        return retVal;
    }
 
开发者ID:optimatika,项目名称:ojAlgo,代码行数:20,代码来源:RawLU.java

示例4: toVolatilities

import org.ojalgo.function.aggregator.AggregatorFunction; //导入依赖的package包/类
/**
 * Will extract the standard deviations (volatilities) from the input covariance matrix. If "cleaning" is
 * enabled small variances will be replaced with a new minimal value.
 */
public static PrimitiveMatrix toVolatilities(final Access2D<?> covariances, final boolean clean) {

    final int tmpSize = (int) Math.min(covariances.countRows(), covariances.countColumns());

    final Builder<PrimitiveMatrix> retVal = PrimitiveMatrix.FACTORY.getBuilder(tmpSize);

    if (clean) {

        final AggregatorFunction<Double> tmpLargest = PrimitiveAggregator.LARGEST.get();
        MatrixStore.PRIMITIVE.makeWrapper(covariances).get().visitDiagonal(0, 0, tmpLargest);
        final double tmpLimit = tmpLargest.doubleValue() * tmpSize * PrimitiveFunction.SQRT.invoke(PrimitiveMath.MACHINE_EPSILON);

        for (int ij = 0; ij < tmpSize; ij++) {
            final double tmpVariance = covariances.doubleValue(ij, ij);
            if (tmpVariance < tmpLimit) {
                retVal.set(ij, PrimitiveFunction.SQRT.invoke(tmpLimit));
            } else {
                retVal.set(ij, PrimitiveFunction.SQRT.invoke(tmpVariance));
            }
        }

    } else {

        for (int ij = 0; ij < tmpSize; ij++) {
            retVal.set(ij, PrimitiveFunction.SQRT.invoke(covariances.doubleValue(ij, ij)));
        }
    }

    return retVal.get();
}
 
开发者ID:optimatika,项目名称:ojAlgo-finance,代码行数:35,代码来源:FinanceUtils.java

示例5: doTest

import org.ojalgo.function.aggregator.AggregatorFunction; //导入依赖的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

示例6: doTest

import org.ojalgo.function.aggregator.AggregatorFunction; //导入依赖的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

示例7: performIteration

import org.ojalgo.function.aggregator.AggregatorFunction; //导入依赖的package包/类
void performIteration(final IterationPoint pivot) {

        final double tmpPivotElement = myTableau.doubleValue(pivot.row, pivot.col);
        final int tmpColRHS = myTableau.countConstraints() + myTableau.countVariables();
        final double tmpPivotRHS = myTableau.doubleValue(pivot.row, tmpColRHS);

        myTableau.pivot(pivot);

        if (this.isDebug()) {
            this.log("Iteration Point <{},{}>\tPivot: {} => {}\tRHS: {} => {}.", pivot.row, pivot.col, tmpPivotElement,
                    myTableau.doubleValue(pivot.row, pivot.col), tmpPivotRHS, myTableau.doubleValue(pivot.row, tmpColRHS));
        }

        if (options.validate) {

            // Right-most column of the tableau
            final Array1D<Double> tmpRHS = myTableau.sliceConstraintsRHS();

            final AggregatorFunction<Double> tmpMinAggr = PrimitiveAggregator.getSet().minimum();
            tmpRHS.visitAll(tmpMinAggr);
            final double tmpMinVal = tmpMinAggr.doubleValue();

            if ((tmpMinVal < ZERO) && !options.feasibility.isZero(tmpMinVal)) {
                this.log("\nNegative RHS! {}", tmpMinVal);
                if (this.isDebug()) {
                    this.log("Entire RHS columns: {}\n", tmpRHS);
                }
            }

        }
    }
 
开发者ID:optimatika,项目名称:ojAlgo,代码行数:32,代码来源:SimplexSolver.java

示例8: getDeterminant

import org.ojalgo.function.aggregator.AggregatorFunction; //导入依赖的package包/类
public N getDeterminant() {

        final AggregatorFunction<N> tmpAggrFunc = this.aggregator().product();

        this.getInPlace().visitDiagonal(0, 0, tmpAggrFunc);

        if (myPivot.signum() == -1) {
            return tmpAggrFunc.toScalar().negate().get();
        } else {
            return tmpAggrFunc.get();
        }
    }
 
开发者ID:optimatika,项目名称:ojAlgo,代码行数:13,代码来源:LUDecomposition.java

示例9: norm

import org.ojalgo.function.aggregator.AggregatorFunction; //导入依赖的package包/类
public double norm() {
    final AggregatorFunction<N> tmpNorm2 = myArrayFactory.aggregator().norm2();
    myArray.visitAll(tmpNorm2);
    return tmpNorm2.doubleValue();
}
 
开发者ID:optimatika,项目名称:ojAlgo,代码行数:6,代码来源:AnyTensor.java

示例10: getAdjustmentExponent

import org.ojalgo.function.aggregator.AggregatorFunction; //导入依赖的package包/类
protected final int getAdjustmentExponent() {

        if (myAdjustmentExponent == Integer.MIN_VALUE) {

            final AggregatorSet<BigDecimal> tmpSet = BigAggregator.getSet();

            final AggregatorFunction<BigDecimal> tmpLargest = tmpSet.largest();
            final AggregatorFunction<BigDecimal> tmpSmallest = tmpSet.smallest();

            this.visitAllParameters(tmpLargest, tmpSmallest);

            myAdjustmentExponent = ModelEntity.getAdjustmentExponent(tmpLargest.doubleValue(), tmpSmallest.doubleValue());
        }

        return myAdjustmentExponent;
    }
 
开发者ID:optimatika,项目名称:ojAlgo,代码行数:17,代码来源:ModelEntity.java

示例11: visit

import org.ojalgo.function.aggregator.AggregatorFunction; //导入依赖的package包/类
public final void visit(final AggregatorFunction<Double> visitor) {
    myValues.visitAll(visitor);
}
 
开发者ID:optimatika,项目名称:ojAlgo,代码行数:4,代码来源:DataSeries.java

示例12: doTest

import org.ojalgo.function.aggregator.AggregatorFunction; //导入依赖的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.PRODUCT.getFunction(PrimitiveAggregator.getSet());

    array.visitAll(tmpVisitor);

    TestUtils.assertEquals(0.0, tmpVisitor.intValue());
}
 
开发者ID:optimatika,项目名称:ojAlgo-extensions,代码行数:14,代码来源:AggregatorProduct.java

示例13: getTrace

import org.ojalgo.function.aggregator.AggregatorFunction; //导入依赖的package包/类
public Scalar<N> getTrace() {

        final AggregatorFunction<N> tmpAggr = myStore.physical().aggregator().sum();

        myStore.visitDiagonal(0, 0, tmpAggr);

        return myStore.physical().scalar().convert(tmpAggr.get());
    }
 
开发者ID:optimatika,项目名称:ojAlgo,代码行数:9,代码来源:AbstractMatrix.java

示例14: getDeterminant

import org.ojalgo.function.aggregator.AggregatorFunction; //导入依赖的package包/类
public final N getDeterminant() {

        final AggregatorFunction<ComplexNumber> tmpVisitor = ComplexAggregator.getSet().product();

        this.getEigenvalues().visitAll(tmpVisitor);

        return this.scalar().cast(tmpVisitor.get());
    }
 
开发者ID:optimatika,项目名称:ojAlgo,代码行数:9,代码来源:HermitianEvD.java

示例15: getTrace

import org.ojalgo.function.aggregator.AggregatorFunction; //导入依赖的package包/类
public final ComplexNumber getTrace() {

        final AggregatorFunction<ComplexNumber> tmpVisitor = ComplexAggregator.getSet().sum();

        this.getEigenvalues().visitAll(tmpVisitor);

        return tmpVisitor.get();
    }
 
开发者ID:optimatika,项目名称:ojAlgo,代码行数:9,代码来源:HermitianEvD.java


注:本文中的org.ojalgo.function.aggregator.AggregatorFunction类示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。