use of gov.sandia.n2a.linear.MatrixDense in project n2a by frothga.
the class Matrix method LT.
public Matrix LT(Type that) throws EvaluationException {
int w = columns();
int h = rows();
if (that instanceof Scalar) {
double b = ((Scalar) that).value;
MatrixDense result = new MatrixDense(h, w);
for (int c = 0; c < w; c++) {
for (int r = 0; r < h; r++) {
result.set(r, c, (get(r, c) < b) ? 1 : 0);
}
}
return result;
}
if (that instanceof Matrix) {
Matrix B = (Matrix) that;
w = Math.min(w, B.columns());
h = Math.min(h, B.rows());
MatrixDense result = new MatrixDense(h, w);
for (int c = 0; c < w; c++) {
for (int r = 0; r < h; r++) {
result.set(r, c, (get(r, c) < B.get(r, c)) ? 1 : 0);
}
}
return result;
}
throw new EvaluationException("type mismatch");
}
Aggregations