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


Java BigFunction类代码示例

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


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

示例1: getOffsetOver

import org.ojalgo.function.BigFunction; //导入依赖的package包/类
public static BigDecimal getOffsetOver(final CategoryHolding<?, ?> aHolding, final boolean reduced) {

            BigDecimal retVal = BigMath.ZERO;

            final Limit tmpLimit = aHolding.getLimit();
            final BigDecimal tmpTarget = tmpLimit.getTarget();
            final BigDecimal tmpPrecision = tmpLimit.getPrecision();
            final BigDecimal tmpUpper = BigFunction.ADD.invoke(tmpTarget, tmpPrecision);

            final BigDecimal tmpWeight = aHolding.getWeight();

            if (tmpWeight.compareTo(tmpUpper) == 1) {
                retVal = BigFunction.SUBTRACT.invoke(tmpWeight, tmpUpper);
            }

            if (reduced) {
                return BigFunction.MIN.invoke(retVal, aHolding.getFreeWeight());
            } else {
                return retVal;
            }
        }
 
开发者ID:optimatika,项目名称:ojAlgo-finance,代码行数:22,代码来源:CategoryHolding.java

示例2: getOffsetUnder

import org.ojalgo.function.BigFunction; //导入依赖的package包/类
public static BigDecimal getOffsetUnder(final CategoryHolding<?, ?> aHolding) {

            BigDecimal retVal = BigMath.ZERO;

            final Limit tmpLimit = aHolding.getLimit();
            final BigDecimal tmpTarget = tmpLimit.getTarget();
            final BigDecimal tmpPrecision = tmpLimit.getPrecision();
            final BigDecimal tmpLower = BigFunction.SUBTRACT.invoke(tmpTarget, tmpPrecision);

            final BigDecimal tmpWeight = aHolding.getWeight();

            if (tmpWeight.compareTo(tmpLower) == -1) {
                retVal = BigFunction.SUBTRACT.invoke(tmpLower, tmpWeight);
            }

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

示例3: getTransactionAmount

import org.ojalgo.function.BigFunction; //导入依赖的package包/类
public static BigDecimal getTransactionAmount(final Change aChange) {

            BigDecimal retVal = aChange.getAmount();

            final BigDecimal tmpSuggestedWeight = aChange.getSuggestedWeight();

            if ((retVal == null) && (tmpSuggestedWeight != null)) {
                final BigDecimal tmpAdjustedFutureAmount = aChange.getWorkSetPortfolio().getAdjustedFutureAmount();
                retVal = BigFunction.SUBTRACT.invoke(BigFunction.MULTIPLY.invoke(tmpAdjustedFutureAmount, tmpSuggestedWeight), Logic.getCurrentAmount(aChange));
            }

            if (retVal == null) {
                if (aChange.getQuantity() != null) {
                    retVal = BigFunction.MULTIPLY.invoke(aChange.getQuantity(), Logic.getTransactionPrice(aChange));
                } else if (aChange.getSellShare() != null) {
                    retVal = BigFunction.MULTIPLY.invoke(Logic.getTransactionQuantity(aChange), Logic.getTransactionPrice(aChange));
                } else {
                    retVal = BigMath.ZERO;
                }
            }

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

示例4: getTransactionQuantity

import org.ojalgo.function.BigFunction; //导入依赖的package包/类
public static BigDecimal getTransactionQuantity(final Change aChange) {

            BigDecimal retVal = aChange.getQuantity();

            if ((retVal == null) && (aChange.getSellShare() != null)) {
                retVal = BigFunction.MULTIPLY.invoke(Logic.getCurrentQuantity(aChange), aChange.getSellShare());
            }

            if (retVal == null) {
                if (aChange.getAmount() != null) {
                    retVal = BigFunction.DIVIDE.invoke(aChange.getAmount(), Logic.getTransactionPrice(aChange));
                } else if (aChange.getSuggestedWeight() != null) {
                    retVal = BigFunction.DIVIDE.invoke(Logic.getTransactionAmount(aChange), Logic.getTransactionPrice(aChange));
                } else {
                    retVal = BigMath.ZERO;
                }
            }

            return retVal;

        }
 
开发者ID:optimatika,项目名称:ojAlgo-finance,代码行数:22,代码来源:Change.java

示例5: makeRiskFreeReturn

import org.ojalgo.function.BigFunction; //导入依赖的package包/类
public static BigDecimal makeRiskFreeReturn(final FinancialMarket market) {

            BigDecimal retVal = BigMath.ZERO;

            if (market.isHistoricalRiskFreeReturn()) {
                final CalendarDateSeries<Double> tmpRiskFreeSeries = market.getRiskFreeSeries();
                final Double tmpLastValue = tmpRiskFreeSeries.lastValue();
                retVal = BigFunction.DIVIDE.invoke(new BigDecimal(tmpLastValue), BigMath.HUNDRED);
            }

            final BigDecimal tmpAdjustment = market.getRiskFreeReturnAdjustment();
            if (tmpAdjustment.signum() != 0) {
                retVal = retVal.add(tmpAdjustment);
            }

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

示例6: testViewsWithStandardDeviation

import org.ojalgo.function.BigFunction; //导入依赖的package包/类
public void testViewsWithStandardDeviation() {

        final MarketEquilibrium tmpME = this.makeMarketEquilibrium();
        final BasicMatrix tmpMarketWeights = BlackLittermanTest.getMarketWeights();

        final BlackLittermanModel tmpBLM = new BlackLittermanModel(tmpME, tmpMarketWeights);

        tmpBLM.setRiskAversion(BlackLittermanTest.getRiskAversionFactor());
        tmpBLM.setConfidence(BlackLittermanTest.getWeightOnViews());

        final BasicMatrix tmpViewPortfolios = BlackLittermanTest.getInvestorPortfoliosMatrix();
        final BasicMatrix tmpViewPortfolioReturns = BlackLittermanTest.getInvestorReturnsMatrix();
        final BasicMatrix tmpConfidenceMatrix = BlackLittermanTest.getInvestorConfidencesMatrix();

        for (int i = 0; i < tmpConfidenceMatrix.countRows(); i++) {
            final int row = i;
            final int row1 = i;
            final int col = i;
            tmpBLM.addViewWithStandardDeviation(BigDenseStore.FACTORY.copy(tmpViewPortfolios.selectRows(new int[] { i })).asList(),
                    TypeUtils.toBigDecimal(tmpViewPortfolioReturns.get(row, 0)),
                    BigFunction.SQRT.invoke(TypeUtils.toBigDecimal(tmpConfidenceMatrix.get(row1, col))));
        }

        this.testBLM(tmpBLM);
    }
 
开发者ID:optimatika,项目名称:ojAlgo-finance,代码行数:26,代码来源:BlackLittermanTest.java

示例7: copy

import org.ojalgo.function.BigFunction; //导入依赖的package包/类
public final Householder.Big copy(final Householder<BigDecimal> source) {

            first = source.first();

            final BigDecimal[] tmpVector = vector;
            BigDecimal tmpVal, tmpVal2 = BigMath.ZERO;
            final int tmpSize = (int) source.count();
            for (int i = source.first(); i < tmpSize; i++) {
                tmpVal = source.get(i);
                tmpVal2 = BigFunction.ADD.invoke(tmpVal2, BigFunction.MULTIPLY.invoke(tmpVal, tmpVal));
                tmpVector[i] = tmpVal;
            }

            beta = BigFunction.DIVIDE.invoke(BigMath.TWO, tmpVal2);

            return this;
        }
 
开发者ID:optimatika,项目名称:ojAlgo,代码行数:18,代码来源:Householder.java

示例8: invoke

import org.ojalgo.function.BigFunction; //导入依赖的package包/类
public static void invoke(final BigDecimal[] data, final int structure, final int rowA, final int rowB, final BigDecimal cos, final BigDecimal sin) {

        BigDecimal oldA;
        BigDecimal oldB;

        int indexA = rowA;
        int indexB = rowB;

        for (int j = 0, lim = data.length / structure; j < lim; j++) {

            oldA = data[indexA];
            oldB = data[indexB];

            data[indexA] = BigFunction.ADD.invoke(BigFunction.MULTIPLY.invoke(cos, oldA), BigFunction.MULTIPLY.invoke(sin, oldB));
            data[indexB] = BigFunction.SUBTRACT.invoke(BigFunction.MULTIPLY.invoke(cos, oldB), BigFunction.MULTIPLY.invoke(sin, oldA));

            indexA += structure;
            indexB += structure;
        }
    }
 
开发者ID:optimatika,项目名称:ojAlgo,代码行数:21,代码来源:RotateLeft.java

示例9: invoke

import org.ojalgo.function.BigFunction; //导入依赖的package包/类
public static void invoke(final BigDecimal[] data, final int first, final int limit, final int tmpColDim, final Householder.Big householder) {

        final BigDecimal[] tmpHouseholderVector = householder.vector;
        final int tmpFirstNonZero = householder.first;
        final BigDecimal tmpBeta = householder.beta;

        final int tmpRowDim = data.length / tmpColDim;

        BigDecimal tmpScale;
        int tmpIndex;
        for (int i = first; i < limit; i++) {
            tmpScale = BigMath.ZERO;
            tmpIndex = i + (tmpFirstNonZero * tmpRowDim);
            for (int j = tmpFirstNonZero; j < tmpColDim; j++) {
                tmpScale = BigFunction.ADD.invoke(tmpScale, BigFunction.MULTIPLY.invoke(tmpHouseholderVector[j], data[tmpIndex]));
                tmpIndex += tmpRowDim;
            }
            tmpScale = BigFunction.MULTIPLY.invoke(tmpScale, tmpBeta);
            tmpIndex = i + (tmpFirstNonZero * tmpRowDim);
            for (int j = tmpFirstNonZero; j < tmpColDim; j++) {
                data[tmpIndex] = BigFunction.SUBTRACT.invoke(data[tmpIndex], BigFunction.MULTIPLY.invoke(tmpScale, tmpHouseholderVector[j]));
                tmpIndex += tmpRowDim;
            }
        }
    }
 
开发者ID:optimatika,项目名称:ojAlgo,代码行数:26,代码来源:HouseholderRight.java

示例10: invoke

import org.ojalgo.function.BigFunction; //导入依赖的package包/类
public static void invoke(final BigDecimal[] data, final int structure, final int first, final int limit, final Householder.Big householder) {

        final BigDecimal[] tmpHouseholderVector = householder.vector;
        final int tmpFirstNonZero = householder.first;
        final BigDecimal tmpBeta = householder.beta;

        BigDecimal tmpScale;
        int tmpIndex;
        for (int j = first; j < limit; j++) {
            tmpScale = BigMath.ZERO;
            tmpIndex = tmpFirstNonZero + (j * structure);
            for (int i = tmpFirstNonZero; i < structure; i++) {
                tmpScale = BigFunction.ADD.invoke(tmpScale, BigFunction.MULTIPLY.invoke(tmpHouseholderVector[i], data[tmpIndex++]));
            }
            tmpScale = BigFunction.MULTIPLY.invoke(tmpScale, tmpBeta);
            tmpIndex = tmpFirstNonZero + (j * structure);
            for (int i = tmpFirstNonZero; i < structure; i++) {
                data[tmpIndex] = BigFunction.SUBTRACT.invoke(data[tmpIndex], BigFunction.MULTIPLY.invoke(tmpScale, tmpHouseholderVector[i]));
                tmpIndex++;
            }
        }
    }
 
开发者ID:optimatika,项目名称:ojAlgo,代码行数:23,代码来源:HouseholderLeft.java

示例11: invoke

import org.ojalgo.function.BigFunction; //导入依赖的package包/类
public static void invoke(final BigDecimal[] data, final int structure, final int colA, final int colB, final BigDecimal cos, final BigDecimal sin) {

        BigDecimal oldA;
        BigDecimal oldB;

        int indexA = colA * structure;
        int indexB = colB * structure;

        for (int i = 0; i < structure; i++) {

            oldA = data[indexA];
            oldB = data[indexB];

            data[indexA] = BigFunction.SUBTRACT.invoke(BigFunction.MULTIPLY.invoke(cos, oldA), BigFunction.MULTIPLY.invoke(sin, oldB));
            data[indexB] = BigFunction.ADD.invoke(BigFunction.MULTIPLY.invoke(cos, oldB), BigFunction.MULTIPLY.invoke(sin, oldA));

            indexA++;
            indexB++;
        }
    }
 
开发者ID:optimatika,项目名称:ojAlgo,代码行数:21,代码来源:RotateRight.java

示例12: aggregateOffsetOver

import org.ojalgo.function.BigFunction; //导入依赖的package包/类
public static BigDecimal aggregateOffsetOver(final List<? extends CategoryHolding<?, ?>> aListOfHoldings, final boolean reduced) {
    BigDecimal retVal = BigMath.ZERO;
    BigDecimal tmpOffset;
    for (final CategoryHolding<?, ?> tmpHolding : aListOfHoldings) {
        tmpOffset = tmpHolding.getOffsetOver(reduced);
        retVal = BigFunction.ADD.invoke(retVal, tmpOffset);
    }
    return retVal;
}
 
开发者ID:optimatika,项目名称:ojAlgo-finance,代码行数:10,代码来源:CategoryHolding.java

示例13: aggregateOffsetUnder

import org.ojalgo.function.BigFunction; //导入依赖的package包/类
public static BigDecimal aggregateOffsetUnder(final List<? extends CategoryHolding<?, ?>> aListOfHoldings) {
    BigDecimal retVal = BigMath.ZERO;
    BigDecimal tmpOffset;
    for (final CategoryHolding<?, ?> tmpHolding : aListOfHoldings) {
        tmpOffset = tmpHolding.getOffsetUnder();
        retVal = BigFunction.ADD.invoke(retVal, tmpOffset);
    }
    return retVal;
}
 
开发者ID:optimatika,项目名称:ojAlgo-finance,代码行数:10,代码来源:CategoryHolding.java

示例14: getImpliedAmount

import org.ojalgo.function.BigFunction; //导入依赖的package包/类
public static BigDecimal getImpliedAmount(final QuantityPriceAmountStructure aQuantityPriceAmount) {
    final BigDecimal tmpQuantity = aQuantityPriceAmount.getQuantity();
    final BigDecimal tmpPrice = aQuantityPriceAmount.getPrice();
    if ((tmpQuantity != null) && (tmpPrice != null)) {
        return BigFunction.MULTIPLY.invoke(tmpQuantity, tmpPrice);
    } else {
        return BigMath.ZERO;
    }
}
 
开发者ID:optimatika,项目名称:ojAlgo-finance,代码行数:10,代码来源:QuantityPriceAmountStructure.java

示例15: getImpliedPrice

import org.ojalgo.function.BigFunction; //导入依赖的package包/类
public static BigDecimal getImpliedPrice(final QuantityPriceAmountStructure aQuantityPriceAmount) {
    final BigDecimal tmpQuantity = aQuantityPriceAmount.getQuantity();
    final BigDecimal tmpAmount = aQuantityPriceAmount.getAmount();
    if ((tmpAmount != null) && (tmpQuantity != null) && (tmpQuantity.signum() != 0)) {
        return BigFunction.DIVIDE.invoke(tmpAmount, tmpQuantity);
    } else {
        return BigMath.ONE;
    }
}
 
开发者ID:optimatika,项目名称:ojAlgo-finance,代码行数:10,代码来源:QuantityPriceAmountStructure.java


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