List of usage examples for java.util.function DoubleFunction apply
R apply(double value);
From source file:org.briljantframework.array.AbstractArray.java
@Override public DoubleArray asDouble(ToDoubleFunction<? super T> to, DoubleFunction<T> from) { return new AsDoubleArray(getArrayFactory(), getOffset(), getShape(), getStride(), getMajorStrideIndex()) { @Override/* w ww. j a v a2 s. c o m*/ protected double getElement(int i) { return to.applyAsDouble(AbstractArray.this.getElement(i)); } @Override protected void setElement(int i, double value) { AbstractArray.this.setElement(i, from.apply(value)); } @Override protected int elementSize() { return AbstractArray.this.elementSize(); } }; }
From source file:org.briljantframework.array.AbstractComplexArray.java
@Override public ComplexArray assign(DoubleArray array, DoubleFunction<Complex> operator) { array = ShapeUtils.broadcastIfSensible(this, array); Check.argument(array.size() == size()); for (int i = 0; i < size(); i++) { set(i, operator.apply(array.get(i))); }//from w w w.jav a2 s . c om return this; }
From source file:org.briljantframework.array.AbstractDoubleArray.java
@Override public ComplexArray mapToComplex(DoubleFunction<Complex> function) { ComplexArray m = factory.newComplexArray(getShape()); for (int i = 0; i < size(); i++) { m.set(i, function.apply(get(i))); }/*from w w w. j a v a2 s.c om*/ return m; }
From source file:org.briljantframework.array.AbstractDoubleArray.java
@Override public <T> Array<T> mapToObj(DoubleFunction<? extends T> mapper) { Array<T> array = getArrayFactory().newArray(getShape()); for (int i = 0; i < size(); i++) { array.set(i, mapper.apply(get(i))); }/*from www .ja va2s . c o m*/ return array; }