本文整理汇总了Java中org.jblas.ranges.RangeUtils类的典型用法代码示例。如果您正苦于以下问题:Java RangeUtils类的具体用法?Java RangeUtils怎么用?Java RangeUtils使用的例子?那么, 这里精选的类代码示例或许可以为您提供帮助。
RangeUtils类属于org.jblas.ranges包,在下文中一共展示了RangeUtils类的5个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: fillOutputVector
import org.jblas.ranges.RangeUtils; //导入依赖的package包/类
@Override
protected void fillOutputVector(DoubleMatrix output, T context) {
DoubleMatrix cxt = this.extractor.extract(context);
if(cxt == null) {
cxt = this.extractor.extract(context);
}
output.put(RangeUtils.all(), RangeUtils.all(), cxt);
}
示例2: reduceByPCA
import org.jblas.ranges.RangeUtils; //导入依赖的package包/类
public static DoubleMatrix reduceByPCA(DoubleMatrix mat, int newDim) {
int rows = mat.rows;
int cols = mat.columns;
DoubleMatrix[] decomposition = Eigen.symmetricEigenvectors(mat.transpose().mmul(mat));
DoubleMatrix E = decomposition[0];
if(newDim <= rows) {
return mat.mmul(E).get(RangeUtils.interval(0, rows), RangeUtils.interval(cols-newDim, cols));
}
DoubleMatrix padded = new DoubleMatrix(rows, newDim);
padded.put(RangeUtils.interval(0, rows), RangeUtils.interval(0, cols), mat.mmul(E));
return padded;
}
示例3: calculateOver
import org.jblas.ranges.RangeUtils; //导入依赖的package包/类
protected void calculateOver() {
/*
* Rem := host_residual - vm_demand
*
*
* ---------------- <--- 1
* |Host reserved |
* |--------------| <--- (limit)
* | |
* | | <--- x (AvailableResource)
* | |
* | Rem > (1-x) |
* | |
* | OK |
* |--------------| <--- (1 - x)
* | Rem < (1-x) |
* |OverProv check|
* |______________| 0
* Non fitting
*/
DoubleMatrix test = this.assigned_cpu_matrix.columnSums();
DoubleMatrix temp = test.lt(this.available_cpu);
this.cpu_in_range = (float) RangeUtils.find(temp).length() / this.n_sample;
test = this.assigned_memory_matrix.columnSums();
temp = test.lt(this.available_memory);
this.memory_in_range = (float) RangeUtils.find(temp).length() / this.n_sample;
this.overall_in_range = (float) (cpu_in_range + memory_in_range) / 2;
}
示例4: calculateOutput
import org.jblas.ranges.RangeUtils; //导入依赖的package包/类
@Override
protected DoubleMatrix calculateOutput(DoubleMatrix inputVector,
DoubleMatrix outputVector) {
outputVector.put(RangeUtils.all(), RangeUtils.all(), inputVector);
return outputVector;
}
示例5: checkFittingCurrentBin
import org.jblas.ranges.RangeUtils; //导入依赖的package包/类
protected boolean checkFittingCurrentBin(HostMachinePlacement currentBin,
VirtualMachinePlacement currentItem) {
/*
* Filtro le vm. Ho due possibilità:
* 1. La vm assegnata all'host non provoca overprovisioning
* 2. La vm assegnata all'host provoca overprovisioning
* Nel caso uno la ritorno come se fitta, nel caso due devo controllare
* se il tempo totale in cui faccio overprovisioning è minore di quello
* che ho impostato come range
*/
int n_el = currentBin.getResidual_resource().columns;
int n_el_overprov_per_res = (int) Math.floor(currentBin.getMaxOverProvisioningTime() * n_el/2);
//Create host residual. Tante righe quante sono le macchine virtuali da allocare
DoubleMatrix host_residual_matrix = currentBin.getResidual_resource();
DoubleMatrix requestedResource_matrix = currentItem.getNormalizedResourceDemandWrtBin();
DoubleMatrix try_fit = host_residual_matrix.sub(requestedResource_matrix);
/*
* Rem := host_residual - vm_demand
*
*
* ---------------- <--- 1
* |Host reserved |
* |--------------| <--- (limit)
* | |
* | | <--- x (AvailableResource)
* | |
* | Rem > (1-x) |
* | |
* | OK |
* |--------------| <--- (1 - x)
* | Rem < (1-x) |
* |OverProv check|
* |______________| 0
* Non fitting
*/
if(RangeUtils.find(try_fit.gt(0)).length() < n_el){
//Per almeno un istante la vm non fitta
return false;
}else{
DoubleMatrix temp = try_fit.gt(currentBin.getInverse_normalized_resource_matrix());
int in_range = RangeUtils.find(temp).length();
if( in_range == n_el){
//è tutto dentro il limite, sono a posto
return true;
}else{
//qualcosa è fuori, devo controllare il tempo di overprovisioning
DoubleMatrix appo = temp.getRange(0, n_el/2);
int cpu_over = appo.length - RangeUtils.find(appo).length();
appo = temp.getRange(n_el/2,n_el);
int mem_over = appo.length - RangeUtils.find(appo).length();
if(cpu_over <= n_el_overprov_per_res && mem_over <= n_el_overprov_per_res)
return true;
else
return false;
}
}
}