本文整理匯總了Java中org.apache.commons.math3.linear.ArrayRealVector.setEntry方法的典型用法代碼示例。如果您正苦於以下問題:Java ArrayRealVector.setEntry方法的具體用法?Java ArrayRealVector.setEntry怎麽用?Java ArrayRealVector.setEntry使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在類org.apache.commons.math3.linear.ArrayRealVector
的用法示例。
在下文中一共展示了ArrayRealVector.setEntry方法的4個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的Java代碼示例。
示例1: nextWishart
import org.apache.commons.math3.linear.ArrayRealVector; //導入方法依賴的package包/類
public RealMatrix nextWishart(double df, Cholesky invscale) {
int d = invscale.getL().getColumnDimension();
Array2DRowRealMatrix A = new Array2DRowRealMatrix(d,d);
ArrayRealVector v = new ArrayRealVector(d);
for (int i=0; i<d; i++) {
v.setEntry(i, sqrt(nextChiSquared(df-i)));
for (int j=0; j<i; j++) {
v.setEntry(j, 0.0);
}
for (int j=i+1; j<d; j++) {
v.setEntry(j, nextGaussian());
}
A.setColumnVector(i, invscale.solveLT(v));
}
return A.multiply(A.transpose());
}
示例2: convertEnergyProfileFromServerToBroker
import org.apache.commons.math3.linear.ArrayRealVector; //導入方法依賴的package包/類
/**
* NOTE: subtle conversion that caused a bug - we use predictions
* starting next time-step, but forecastCapacities are assumed
* to be from current - so to return data to broker we need to
* offset the record by 1
*/
protected ArrayRealVector convertEnergyProfileFromServerToBroker(
CapacityProfile predictedEnergyProfile, int recordLength) throws Exception {
//log.info("scaleEnergyProfile()");
//log.info("predictedEnergyProfile" + Arrays.toString(predictedEnergyProfile.values.toArray()));
int profileLength = predictedEnergyProfile.NUM_TIMESLOTS;
// verify divides
boolean divides = (recordLength / profileLength * profileLength) == recordLength;
if (!divides) {
throw new Exception("How come profileLength doesn't divide recordLength");
}
//log.info("recordLength=" + recordLength);
ArrayRealVector result = new ArrayRealVector(recordLength);
for (int i = 0; i < recordLength; ++i) {
result.setEntry(i, predictedEnergyProfile.getCapacity( (i + 1) % profileLength ));
//log.info("appending " + predictedEnergyProfile.getCapacity( i % profileLength ) + " at " + i);
}
//log.info("result" + Arrays.toString(result.toArray()));
return result;
}
示例3: computeEnergyUnitCosts
import org.apache.commons.math3.linear.ArrayRealVector; //導入方法依賴的package包/類
private ArrayRealVector computeEnergyUnitCosts(
CostCurvesPredictor costCurvesPredictor,
ArrayRealVector predictedMyCustomersEnergy,
ArrayRealVector predictedCompetitorsEnergy,
int currentTimeslot) {
ArrayRealVector energyUnitCosts = new ArrayRealVector(predictedMyCustomersEnergy.getDimension());
for (int i = 0; i < energyUnitCosts.getDimension(); ++i) {
int futureTimeslot = currentTimeslot + i + 1; // +1 since energy record starts next timeslot
energyUnitCosts.setEntry(i, costCurvesPredictor.predictUnitCostKwh(currentTimeslot, futureTimeslot, predictedMyCustomersEnergy.getEntry(i), predictedCompetitorsEnergy.getEntry(i))
+ costCurvesPredictor.getFudgeFactorKwh(currentTimeslot));
}
//log.debug("energyUnitCosts =" + energyUnitCosts.toString());
return energyUnitCosts;
}
示例4: setUp
import org.apache.commons.math3.linear.ArrayRealVector; //導入方法依賴的package包/類
@Before
public void setUp () throws Exception {
broker = new Broker("mybroker");
shiftingPredictorNoShifts = new ShiftingPredictorNoShifts();
// initialize energy profiles
customer2estimatedEnergy = new HashMap<CustomerInfo, ArrayRealVector>();
cust1 = new CustomerInfo("centerville", 4);
energy1 = new ArrayRealVector(HORIZON);
for (int i = 0; i < HORIZON; ++i) {
energy1.setEntry(i, i%4);
}
customer2estimatedEnergy.put(cust1, energy1);
cust2 = new CustomerInfo("frosty", 6);
energy2 = new ArrayRealVector(HORIZON);
for (int i = 0; i < HORIZON; ++i) {
energy2.setEntry(i, i%2);
}
customer2estimatedEnergy.put(cust2, energy2);
// initialize subscriptions
predictedCustomerSubscriptions = new HashMap<TariffSpecification, HashMap<CustomerInfo,Double>>();
spec1 = new TariffSpecification(broker, PowerType.CONSUMPTION);
predictedCustomerSubscriptions.put(spec1, new HashMap<CustomerInfo, Double>());
predictedCustomerSubscriptions.get(spec1).put(cust1, 1.0);
predictedCustomerSubscriptions.get(spec1).put(cust2, 2.0);
spec2 = new TariffSpecification(broker, PowerType.CONSUMPTION);
predictedCustomerSubscriptions.put(spec2, new HashMap<CustomerInfo, Double>());
predictedCustomerSubscriptions.get(spec2).put(cust1, 3.0);
predictedCustomerSubscriptions.get(spec2).put(cust2, 4.0);
currentTimeslot = 370; // magic number
}