@Override public double apply(double var) { return function.apply(c, var); } };
@Override public double apply(double var) { return function.apply(var, c); } };
@Override public double apply(double a, double b) { return function.apply(b, a); } };
/** * @return true iff f(0, 0) != 0 */ public boolean isDensifying() { return apply(0.0, 0.0) != 0.0; } }
@Override public Vector assign(Vector x, Vector y, DoubleDoubleFunction f) { Iterator<Vector.Element> xi = x.all().iterator(); Iterator<Vector.Element> yi = y.all().iterator(); while (xi.hasNext() && yi.hasNext()) { Element xe = xi.next(); x.setQuick(xe.index(), f.apply(xe.get(), yi.next().get())); } return x; } }
@Override public Vector assign(Vector x, Vector y, DoubleDoubleFunction f) { for (int i = 0; i < x.size(); ++i) { x.setQuick(i, f.apply(x.getQuick(i), y.getQuick(i))); } return x; } }
@Override public Vector assign(Vector x, Vector y, DoubleDoubleFunction f) { for (Element xe : x.nonZeroes()) { xe.set(f.apply(xe.get(), y.getQuick(xe.index()))); } return x; } }
@Test public void testIsLikeLeftMult() { if (!function.isLikeLeftMult()) { return; } for (int i = 0; i < NUM_POINTS; ++i) { double y = random.nextDouble(); assertEquals(functionName, 0, function.apply(0, y), 0); } }
@Test public void testIsLikeRightPlus() { if (!function.isLikeRightPlus()) { return; } for (int i = 0; i < NUM_POINTS; ++i) { double x = random.nextDouble(); assertEquals(functionName, x, function.apply(x, 0), 0); } }
@Test public void testIsLikeRightMult() { if (!function.isLikeRightMult()) { return; } for (int i = 0; i < NUM_POINTS; ++i) { double x = random.nextDouble(); assertEquals(functionName, 0, function.apply(x, 0), 0); } }
@Override public Vector assign(Vector x, Vector y, DoubleDoubleFunction f) { for (Element ye : y.nonZeroes()) { x.setQuick(ye.index(), f.apply(x.getQuick(ye.index()), ye.get())); } return x; } }
@Override public Vector assign(Vector x, Vector y, DoubleDoubleFunction f) { for (Element xe : x.all()) { x.setQuick(xe.index(), f.apply(xe.get(), y.getQuick(xe.index()))); } return x; } }
@Override public Vector assign(Vector x, Vector y, DoubleDoubleFunction f) { for (Element ye : y.all()) { x.setQuick(ye.index(), f.apply(x.getQuick(ye.index()), ye.get())); } return x; } }
@Override public Vector assign(Vector x, Vector y, DoubleDoubleFunction f) { OrderedIntDoubleMapping updates = new OrderedIntDoubleMapping(false); for (int i = 0; i < x.size(); ++i) { updates.set(i, f.apply(x.getQuick(i), y.getQuick(i))); } x.mergeUpdates(updates); return x; } }
@Test public void testIsDensifying() { if (!function.isDensifying()) { assertEquals(functionName, 0, function.apply(0, 0), 0); } } }
@Override public Vector assign(Vector x, Vector y, DoubleDoubleFunction f) { OrderedIntDoubleMapping updates = new OrderedIntDoubleMapping(false); for (Element ye : y.nonZeroes()) { updates.set(ye.index(), f.apply(x.getQuick(ye.index()), ye.get())); } x.mergeUpdates(updates); return x; } }
@Override public Vector assign(Vector x, Vector y, DoubleDoubleFunction f) { OrderedIntDoubleMapping updates = new OrderedIntDoubleMapping(false); for (Element xe : x.all()) { updates.set(xe.index(), f.apply(xe.get(), y.getQuick(xe.index()))); } x.mergeUpdates(updates); return x; } }
@Override public Vector assign(Vector x, Vector y, DoubleDoubleFunction f) { OrderedIntDoubleMapping updates = new OrderedIntDoubleMapping(false); for (Element ye : y.all()) { updates.set(ye.index(), f.apply(x.getQuick(ye.index()), ye.get())); } x.mergeUpdates(updates); return x; } }