use of cern.colt.function.tdouble.IntIntDoubleFunction in project clusterMaker2 by RBVI.
the class ColtOps method addElement.
/**
* add two matrices together
*
* @param addend the matrix to add to our matrix
*/
public void addElement(Matrix addend) {
DoubleMatrix2D data = getData();
data.forEachNonZero(new IntIntDoubleFunction() {
public double apply(int row, int column, double v) {
double addendValue = addend.doubleValue(row, column);
if (!Double.isNaN(addendValue))
return v + addendValue;
else
return v;
}
});
}
use of cern.colt.function.tdouble.IntIntDoubleFunction in project clusterMaker2 by RBVI.
the class ColtOps method powScalar.
/**
* raise all cells in the matrix by a power
*
* @param matrix our matrix
* @param value power to raise to each cell
*/
public void powScalar(double value) {
DoubleMatrix2D data = getData();
data.forEachNonZero(new IntIntDoubleFunction() {
public double apply(int row, int column, double v) {
return Math.pow(v, value);
}
});
}
use of cern.colt.function.tdouble.IntIntDoubleFunction in project clusterMaker2 by RBVI.
the class ColtOps method subtractScalar.
/**
* subtract a value from all cells in the matrix
*
* @param value to subtract from each cell
*/
public void subtractScalar(double value) {
DoubleMatrix2D data = getData();
data.forEachNonZero(new IntIntDoubleFunction() {
public double apply(int row, int column, double v) {
return v - value;
}
});
}
Aggregations