Example #1
0
  @Override
  public Vector transform(int i, VectorFunction function, Factory factory) {

    Vector result = copy(factory);
    result.set(i, function.evaluate(i, get(i)));

    return result;
  }
Example #2
0
  @Override
  public Vector transform(VectorFunction function, Factory factory) {

    Vector result = blank(factory);

    for (int i = 0; i < length; i++) {
      result.set(i, function.evaluate(i, get(i)));
    }

    return result;
  }
Example #3
0
  @Override
  public void update(int i, VectorFunction function) {

    for (int k = 0; k < cardinality; k++) {
      if (indices[k] == i) {

        double value = function.evaluate(i, values[k]);

        if (Math.abs(value) > Vectors.EPS) {
          values[k] = value;
          return;
        } else {
          remove(k);
          return;
        }
      }
    }

    insert(i, function.evaluate(i, function.evaluate(i, 0)));
  }
Example #4
0
 @Override
 public void update(int i, VectorFunction function) {
   set(i, function.evaluate(i, get(i)));
 }
Example #5
0
 @Override
 public void update(VectorFunction function) {
   for (int i = 0; i < length; i++) {
     set(i, function.evaluate(i, get(i)));
   }
 }