public final class Tensorics
extends java.lang.Object
TensoricSupport
(or one of its convenience implementations) or
use the using(ExtendedField)
method (only recommended for one-liners).
Additional utilities for supporting classes can be found in the corresponding utility classes. E.g.
Modifier and Type | Method and Description |
---|---|
static Position |
at(java.lang.Iterable<?> coordinates) |
static Position |
at(java.lang.Object... coordinates) |
static <T> TensorBuilder<T> |
builder(java.lang.Class<?>... dimensions) |
static <T> TensorBuilder<T> |
builder(java.lang.Iterable<java.lang.Class<?>> dimensions) |
static <V,TB extends Tensorbacked<V>> |
builderFor(java.lang.Class<TB> tensorbackedClass) |
static <T> TensorBuilder<T> |
builderFrom(Tensor<T> tensor) |
static <S,TB extends Tensorbacked<S>> |
complete(TB tensorbacked) |
static <S> OngoingCompletion<S> |
complete(Tensor<S> tensor) |
static <V,TB extends Tensorbacked<V>> |
construct(java.lang.Class<TB> tensorbackedClass) |
static <S> Tensor<QuantifiedValue<S>> |
convertToQuantified(Tensor<S> tensor,
Unit unit)
Deprecated.
use renamed method
quantityTensorOf(Tensor, Unit) |
static <T> Tensor<T> |
copyOf(Tensor<T> tensor) |
static <S> Tensor<S> |
createFrom(Shape shape,
java.util.function.Function<Position,S> function)
Deprecated.
|
static <S> Tensor<S> |
createFrom(Shape shape,
java.util.function.Supplier<S> supplier)
Deprecated.
|
static <TB extends Tensorbacked<?>> |
dimensionalityOf(TB tensorbacked) |
static java.util.Set<java.lang.Class<?>> |
dimensionsOf(Tensor<?> tensor) |
static java.util.Set<java.lang.Class<?>> |
dimensionsOf(Tensorbacked<?> tensorbacked) |
static <V> Tensor<V> |
empty(java.lang.Class<?>... dimensions) |
static <V,TB extends Tensorbacked<V>> |
empty(java.lang.Class<TB> tensorbackedClass) |
static <V> Tensor<V> |
empty(java.lang.Iterable<java.lang.Class<?>> dimensions) |
static <S> Tensor<com.google.common.base.Optional<S>> |
errorsOf(Tensor<QuantifiedValue<S>> tensor) |
static <S> Tensor<com.google.common.base.Optional<S>> |
errorsOf(Tensorbacked<QuantifiedValue<S>> tensorbacked) |
static <S> Tensor<S> |
errorsOfOr(Tensor<QuantifiedValue<S>> tensor,
S defaultValue) |
static <V,TB extends Tensorbacked<V>> |
filter(TB tensorbacked) |
static <S> OngoingTensorFiltering<S> |
filter(Tensor<S> tensor) |
static <S> OngoingFlattening<S> |
flatten(Tensor<S> tensor) |
static <S> OngoingFlattening<S> |
flatten(Tensorbacked<S> tensorbacked) |
static <S> void |
forEach(Tensor<S> tensor,
java.util.function.BiConsumer<Position,S> consumer) |
static <S> void |
forEach(Tensor<S> tensor,
java.util.function.Consumer<S> consumer) |
static <S> void |
forEach(Tensorbacked<S> tensorBacked,
java.util.function.BiConsumer<Position,S> consumer) |
static <S> void |
forEach(Tensorbacked<S> tensorBacked,
java.util.function.Consumer<S> consumer) |
static <V> OngoingTensorManipulation<V> |
from(Tensor<V> tensor) |
static <V> OngoingTensorManipulation<V> |
from(Tensorbacked<V> tensorbacked) |
static <T> Tensor<T> |
fromMap(java.lang.Iterable<java.lang.Class<?>> dimensions,
java.util.Map<Position,T> map) |
static <S,T> Tensor<T> |
map(Tensor<S> tensor,
java.util.function.BiFunction<Position,S,T> function) |
static <S,T> Tensor<T> |
map(Tensor<S> tensor,
java.util.function.Function<S,T> function) |
static <V> java.util.Map<Position,V> |
mapFrom(Tensor<V> tensor) |
static <E> Tensor<E> |
merge(java.lang.Iterable<Tensor<E>> tensors) |
static <E> Tensor<E> |
mergeContextIntoShape(Tensor<E> tensor) |
static java.util.Set<Position> |
positionsOf(Tensor<?> tensor) |
static java.util.Set<Position> |
positionsOf(Tensorbacked<?> tensorbacked) |
static <V> ImmutableQuantifiedValue<V> |
quantityOf(V value,
Unit unit) |
static <V> ImmutableQuantifiedValue<V> |
quantityOf(V value,
javax.measure.unit.Unit<?> unit)
Convenience method to create a quantity directly from a jscience base.
|
static <S> Tensor<QuantifiedValue<S>> |
quantityTensorOf(Tensor<S> tensor,
Unit unit) |
static <S> Tensor<QuantifiedValue<S>> |
quantityTensorOf(Tensor<S> tensor,
javax.measure.unit.Unit<?> unit) |
static <V> OngoingResamplingStart<V> |
resample(Tensor<V> tensor) |
static <S> Tensor<S> |
sameValues(Shape shape,
S value) |
static <T> ImmutableScalar<T> |
scalarOf(T value) |
static <V,TB extends Tensorbacked<V>> |
setContext(TB tensorbacked,
Position context) |
static <S> Tensor<S> |
setContext(Tensor<S> tensor,
Position context) |
static Shape |
shapeOf(Tensorbacked<?> tensorbacked) |
static <TB extends Tensorbacked<?>> |
shapesOf(java.lang.Iterable<TB> tensorbackeds) |
static <TB extends Tensorbacked<?>> |
sizeOf(TB tensorbacked) |
static <S> java.util.stream.Stream<java.util.Map.Entry<Position,S>> |
stream(Tensor<S> tensor) |
static <S> java.util.stream.Stream<java.util.Map.Entry<Position,S>> |
stream(Tensorbacked<S> tensorBacked) |
static <V,TB extends Tensorbacked<V>> |
stripContext(TB tensorbacked) |
static <S> Tensor<S> |
stripContext(Tensor<S> tensor) |
static <S> Tensor<S> |
tensor(Shape shape,
java.util.function.Function<Position,S> function) |
static <S> Tensor<S> |
tensor(Shape shape,
java.util.function.Supplier<S> supplier) |
static <S> java.lang.Iterable<Tensor<S>> |
tensorsOf(java.lang.Iterable<? extends Tensorbacked<S>> tensorbackeds) |
static <S,T> Tensor<T> |
transformEntries(Tensor<S> tensor,
java.util.function.Function<java.util.Map.Entry<Position,S>,T> function)
Deprecated.
use
map(Tensor, BiFunction) instead |
static <S> Unit |
unitOf(Tensor<QuantifiedValue<S>> tensor) |
static <S> Unit |
unitOf(Tensorbacked<QuantifiedValue<S>> tensorbacked) |
static <E> TensoricSupport<E> |
using(ExtendedField<E> field)
Creates an instance of a 'support' type class, which provides methods as starting points for the 'fluent' API for
tensor manipulation.
|
static <S> Tensor<java.lang.Boolean> |
validitiesOf(Tensor<QuantifiedValue<S>> tensor) |
static <S> Tensor<java.lang.Boolean> |
validitiesOf(Tensorbacked<QuantifiedValue<S>> tensorbacked) |
static <S> Tensor<S> |
valuesOf(Tensor<QuantifiedValue<S>> tensor) |
static <S> Tensor<S> |
valuesOf(Tensorbacked<QuantifiedValue<S>> tensorbacked) |
static Scalar<QuantifiedValue<java.lang.Double>> |
zeroDimensionalOf(double value,
Unit unit) |
static Scalar<QuantifiedValue<java.lang.Double>> |
zeroDimensionalOf(double value,
javax.measure.unit.Unit<?> unit) |
public static <E> TensoricSupport<E> using(ExtendedField<E> field)
E
- the types of values in the fieldfield
- the (mathematical construct) field which defines the operations for the tensor elements.public static <T> TensorBuilder<T> builder(java.lang.Iterable<java.lang.Class<?>> dimensions)
ImmutableTensor.builder(Iterable)
public static <T> TensorBuilder<T> builder(java.lang.Class<?>... dimensions)
ImmutableTensor.builder(Class...)
public static <T> Tensor<T> fromMap(java.lang.Iterable<java.lang.Class<?>> dimensions, java.util.Map<Position,T> map)
ImmutableTensor.fromMap(Iterable, Map)
public static <T> Tensor<T> copyOf(Tensor<T> tensor)
ImmutableTensor.copyOf(Tensor)
public static <T> TensorBuilder<T> builderFrom(Tensor<T> tensor)
ImmutableTensor.builderFrom(Tensor)
public static <T> ImmutableScalar<T> scalarOf(T value)
ImmutableScalar.of(Object)
public static <V> ImmutableQuantifiedValue<V> quantityOf(V value, Unit unit)
public static <V> ImmutableQuantifiedValue<V> quantityOf(V value, javax.measure.unit.Unit<?> unit)
value
- the of the quantityunit
- the base of the quantityquantityOf(Object, Unit)
public static <V,TB extends Tensorbacked<V>> TensorbackedBuilder<V,TB> builderFor(java.lang.Class<TB> tensorbackedClass)
Tensorbackeds.builderFor(Class)
public static <TB extends Tensorbacked<?>> int sizeOf(TB tensorbacked)
Tensorbackeds.sizeOf(Tensorbacked)
public static <TB extends Tensorbacked<?>> int dimensionalityOf(TB tensorbacked)
public static <V,TB extends Tensorbacked<V>> TB empty(java.lang.Class<TB> tensorbackedClass)
Tensorbackeds.empty(Class)
public static <V> Tensor<V> empty(java.lang.Iterable<java.lang.Class<?>> dimensions)
public static <V> Tensor<V> empty(java.lang.Class<?>... dimensions)
public static <S> Tensor<java.lang.Boolean> validitiesOf(Tensorbacked<QuantifiedValue<S>> tensorbacked)
Tensorbackeds.validitiesOf(Tensorbacked)
public static <S> Tensor<S> valuesOf(Tensorbacked<QuantifiedValue<S>> tensorbacked)
Tensorbackeds.valuesOf(Tensorbacked)
public static <S> Tensor<com.google.common.base.Optional<S>> errorsOf(Tensorbacked<QuantifiedValue<S>> tensorbacked)
Tensorbackeds.errorsOf(Tensorbacked)
public static java.util.Set<Position> positionsOf(Tensorbacked<?> tensorbacked)
Tensorbackeds.positionsOf(Tensorbacked)
@Deprecated public static <S> Tensor<QuantifiedValue<S>> convertToQuantified(Tensor<S> tensor, Unit unit)
quantityTensorOf(Tensor, Unit)
public static <S> Tensor<QuantifiedValue<S>> quantityTensorOf(Tensor<S> tensor, Unit unit)
public static <S> Tensor<QuantifiedValue<S>> quantityTensorOf(Tensor<S> tensor, javax.measure.unit.Unit<?> unit)
public static <S> Unit unitOf(Tensor<QuantifiedValue<S>> tensor)
QuantityTensors.unitOf(Tensor)
public static <S> Unit unitOf(Tensorbacked<QuantifiedValue<S>> tensorbacked)
Tensorbackeds.unitOf(Tensorbacked)
public static Shape shapeOf(Tensorbacked<?> tensorbacked)
Tensorbackeds.shapeOf(Tensorbacked)
public static java.util.Set<java.lang.Class<?>> dimensionsOf(Tensorbacked<?> tensorbacked)
public static <V> OngoingTensorManipulation<V> from(Tensor<V> tensor)
TensorStructurals.from(Tensor)
public static <V> OngoingTensorManipulation<V> from(Tensorbacked<V> tensorbacked)
public static java.util.Set<java.lang.Class<?>> dimensionsOf(Tensor<?> tensor)
public static <S> Tensor<java.lang.Boolean> validitiesOf(Tensor<QuantifiedValue<S>> tensor)
public static <S> Tensor<S> valuesOf(Tensor<QuantifiedValue<S>> tensor)
public static <S> Tensor<com.google.common.base.Optional<S>> errorsOf(Tensor<QuantifiedValue<S>> tensor)
public static <S> Tensor<S> errorsOfOr(Tensor<QuantifiedValue<S>> tensor, S defaultValue)
public static <S> OngoingFlattening<S> flatten(Tensor<S> tensor)
public static <S> OngoingFlattening<S> flatten(Tensorbacked<S> tensorbacked)
@Deprecated public static <S> Tensor<S> createFrom(Shape shape, java.util.function.Supplier<S> supplier)
tensor(Shape, Supplier)
@Deprecated public static <S> Tensor<S> createFrom(Shape shape, java.util.function.Function<Position,S> function)
tensor(Shape, Function)
public static <S> Tensor<S> tensor(Shape shape, java.util.function.Function<Position,S> function)
public static <S> OngoingCompletion<S> complete(Tensor<S> tensor)
@Deprecated public static <S,T> Tensor<T> transformEntries(Tensor<S> tensor, java.util.function.Function<java.util.Map.Entry<Position,S>,T> function)
map(Tensor, BiFunction)
insteadpublic static <S,T> Tensor<T> map(Tensor<S> tensor, java.util.function.BiFunction<Position,S,T> function)
public static <S> void forEach(Tensorbacked<S> tensorBacked, java.util.function.Consumer<S> consumer)
public static <S> void forEach(Tensorbacked<S> tensorBacked, java.util.function.BiConsumer<Position,S> consumer)
public static <S> void forEach(Tensor<S> tensor, java.util.function.Consumer<S> consumer)
public static <S> void forEach(Tensor<S> tensor, java.util.function.BiConsumer<Position,S> consumer)
public static final Scalar<QuantifiedValue<java.lang.Double>> zeroDimensionalOf(double value, javax.measure.unit.Unit<?> unit)
public static final Scalar<QuantifiedValue<java.lang.Double>> zeroDimensionalOf(double value, Unit unit)
public static <S> java.lang.Iterable<Tensor<S>> tensorsOf(java.lang.Iterable<? extends Tensorbacked<S>> tensorbackeds)
Tensorbackeds.tensorsOf(Iterable)
public static <V,TB extends Tensorbacked<V>> OngoingTensorbackedConstruction<V,TB> construct(java.lang.Class<TB> tensorbackedClass)
Tensorbackeds.construct(Class)
public static <V,TB extends Tensorbacked<V>> TB stripContext(TB tensorbacked)
Tensorbackeds.stripContext(Tensorbacked)
public static <S> Tensor<S> stripContext(Tensor<S> tensor)
TensorStructurals.stripContext(Tensor)
public static <S> OngoingTensorFiltering<S> filter(Tensor<S> tensor)
TensorStructurals.filter(Tensor)
public static <V,TB extends Tensorbacked<V>> OngoingTensorbackedFiltering<V,TB> filter(TB tensorbacked)
Tensorbackeds.filter(Tensorbacked)
public static <V,TB extends Tensorbacked<V>> TB setContext(TB tensorbacked, Position context)
public static <S> java.util.stream.Stream<java.util.Map.Entry<Position,S>> stream(Tensor<S> tensor)
TensorStreams.tensorEntryStream(Tensor)
public static <S> java.util.stream.Stream<java.util.Map.Entry<Position,S>> stream(Tensorbacked<S> tensorBacked)
TensorStreams.tensorEntryStream(Tensor)
public static <TB extends Tensorbacked<?>> java.lang.Iterable<Shape> shapesOf(java.lang.Iterable<TB> tensorbackeds)
Tensorbackeds.shapeOf(Tensorbacked)
public static <S,TB extends Tensorbacked<S>> OngoingTensorbackedCompletion<TB,S> complete(TB tensorbacked)
Tensorbackeds.complete(Tensorbacked)
public static <V> java.util.Map<Position,V> mapFrom(Tensor<V> tensor)
TensorInternals.mapFrom(Tensor)
public static Position at(java.lang.Iterable<?> coordinates)
Position.of(Iterable)
public static Position at(java.lang.Object... coordinates)
Position.of(Object...)
public static <V> OngoingResamplingStart<V> resample(Tensor<V> tensor)
TensorStructurals.resample(Tensor)