Package org.tensorics.core.tensor.lang
Class TensorStructurals
- java.lang.Object
-
- org.tensorics.core.tensor.lang.TensorStructurals
-
public final class TensorStructurals extends java.lang.Object
Structural manipulations of tensors (which do not require any knowledge about the mathematical behaviour of the elements).
-
-
Method Summary
All Methods Static Methods Concrete Methods Modifier and Type Method Description static <S> OngoingCompletion<S>
complete(Tensor<S> tensor)
static <V> Tensor<V>
completeWith(Tensor<V> tensor, Tensor<V> second)
static <S> void
consumeScalars(Tensor<S> tensor, java.util.function.BiConsumer<Position,S> consumer)
static <S> void
consumeScalars(Tensor<S> tensor, java.util.function.Consumer<S> consumer)
static <V> OngoingTensorFiltering<V>
filter(Tensor<V> tensor)
static <S> OngoingFlattening<S>
flatten(Tensor<S> tensor)
static <V> OngoingTensorManipulation<V>
from(Tensor<V> tensor)
static <E> Tensor<E>
merge(java.lang.Iterable<Tensor<E>> tensors)
Merges the given set of the Tensors based on information in their context and dimensions.static <V> Tensor<V>
mergeContextIntoShape(Tensor<V> tensor)
static <V> OngoingResamplingStart<V>
resample(Tensor<V> tensor)
Starting point for a fluent clause to describe resampling in one or more dimensions.static <V> Tensor<V>
setContext(Tensor<V> tensor, Position context)
static <S> Tensor<S>
stripContext(Tensor<S> tensor)
static <S,T>
Tensor<T>transformEntries(Tensor<S> tensor, java.util.function.Function<java.util.Map.Entry<Position,S>,T> function)
static <S,T>
Tensor<T>transformScalars(Tensor<S> tensor, java.util.function.BiFunction<Position,S,T> function)
static <S,T>
Tensor<T>transformScalars(Tensor<S> tensor, java.util.function.Function<S,T> function)
-
-
-
Method Detail
-
from
public static <V> OngoingTensorManipulation<V> from(Tensor<V> tensor)
-
merge
public static <E> Tensor<E> merge(java.lang.Iterable<Tensor<E>> tensors)
Merges the given set of the Tensors based on information in their context and dimensions. This operation is only possible, if the following preconditions are fulfilled:- The contexts of all the tensors have THE SAME dimensions AND
- The dimensions of all the tensors are THE SAME (first found tensor dimension is taken as an reference)
- Parameters:
tensors
- to be merged.- Returns:
- a merged tensor.
- Throws:
java.lang.IllegalArgumentException
- if zero or one tensor is put to be merged OR if tensors dimensionality and their context positions dimensionality is not equal OR tensor context is empty.
-
flatten
public static <S> OngoingFlattening<S> flatten(Tensor<S> tensor)
-
complete
public static <S> OngoingCompletion<S> complete(Tensor<S> tensor)
-
transformEntries
public static <S,T> Tensor<T> transformEntries(Tensor<S> tensor, java.util.function.Function<java.util.Map.Entry<Position,S>,T> function)
-
transformScalars
public static <S,T> Tensor<T> transformScalars(Tensor<S> tensor, java.util.function.Function<S,T> function)
-
transformScalars
public static <S,T> Tensor<T> transformScalars(Tensor<S> tensor, java.util.function.BiFunction<Position,S,T> function)
-
consumeScalars
public static <S> void consumeScalars(Tensor<S> tensor, java.util.function.Consumer<S> consumer)
-
consumeScalars
public static <S> void consumeScalars(Tensor<S> tensor, java.util.function.BiConsumer<Position,S> consumer)
-
filter
public static <V> OngoingTensorFiltering<V> filter(Tensor<V> tensor)
-
resample
public static <V> OngoingResamplingStart<V> resample(Tensor<V> tensor)
Starting point for a fluent clause to describe resampling in one or more dimensions. This resampling only provides options which do not require the knowledge of a field. For example:Tensoric<V> resampled = resample(aTensor) .repeat(Integer.class) .then().repeat(String.class) .toTensoric();
For options which require a field, (e.g. linear interpolation), see the version in
TensorSupport.resample(Tensor)
.- Parameters:
tensor
- the tensor to be resampled- Returns:
- an object to define further the strategy for resampling.
-
-