V
- the vector type@FunctionalInterface public interface ElementDistance<V>
V
.
The following example creates an ElementDistance
function for a
double[] array
:
final ElementDistance<double[]> dist = (u, v, i) -> u[i] - v[i];
Modifier and Type | Method and Description |
---|---|
double |
distance(V u,
V v,
int index)
Calculates the distance of two vector elements at the given
index . |
default <T> ElementDistance<T> |
map(Function<? super T,? extends V> mapper)
Return an element distance function for the mapped type
T . |
default ToDoubleBiFunction<V,V> |
ofIndex(int index)
Return a function which calculates the distance of two vector elements at
a given
index . |
double distance(V u, V v, int index)
index
.
E.g.
final ElementDistance<double[]> dist = (u, v, i) -> u[i] - v[i];
u
- the first vectorv
- the second vectorindex
- the vector indexdefault <T> ElementDistance<T> map(Function<? super T,? extends V> mapper)
T
.T
- the new distance typemapper
- the mapper functionT
default ToDoubleBiFunction<V,V> ofIndex(int index)
index
.index
- the vector index© 2007-2019 Franz Wilhelmstötter (2019-11-18 20:30)