use of org.hipparchus.linear.OpenMapRealVector in project symja_android_library by axkr.
the class SparseArrayExpr method toRealVector.
/**
* {@inheritDoc}
*/
@Override
public RealVector toRealVector() {
if (fDimension.length == 1 && fDimension[0] > 0) {
try {
OpenMapRealVector result = new OpenMapRealVector(fDimension[0]);
if (!fDefaultValue.isZero()) {
double d = fDefaultValue.evalDouble();
for (int i = 0; i < fDimension[0]; i++) {
result.setEntry(i, d);
}
}
for (TrieNode<int[], IExpr> entry : fData.nodeSet()) {
int[] key = entry.getKey();
IExpr value = entry.getValue();
result.setEntry(key[0] - 1, value.evalDouble());
}
return result;
} catch (ArgumentTypeException rex) {
}
}
return null;
}
Aggregations