Package org.tensorics.core.tensorbacked
Class TensorbackedInternals
- java.lang.Object
-
- org.tensorics.core.tensorbacked.TensorbackedInternals
-
public final class TensorbackedInternals extends java.lang.Object
This class gives an access to the methods forTensorbacked
object support.
-
-
Method Summary
All Methods Static Methods Concrete Methods Modifier and Type Method Description static <V,TB extends Tensorbacked<V>>
java.lang.Class<TB>classOf(TB tensorBacked)
static <V,T extends Tensorbacked<V>>
TcreateBackedByTensor(java.lang.Class<T> tensorBackedClass, Tensor<V> tensor)
Creates an instance of a class backed by a tensor.static <T extends Tensorbacked<?>>
java.util.List<java.lang.Class<?>>dimensionListFrom(java.lang.Class<T> tensorBackedClass)
static <T extends Tensorbacked<?>>
java.util.Set<java.lang.Class<?>>dimensionsOf(java.lang.Class<T> tensorBackedClass)
Retrieves the dimensions from the given class inheriting from tensor backed.static <TB extends Tensorbacked<E>,E>
Tensor<E>ensureExactTensorbackedDimensions(java.lang.Class<TB> tensorbackedClass, Tensor<E> tensor)
static <TB extends Tensorbacked<?>>
java.lang.Iterable<Shape>shapesOf(java.lang.Iterable<TB> tensorbackeds)
static <S> java.lang.Iterable<Tensor<S>>
tensorsOf(java.lang.Iterable<? extends Tensorbacked<S>> tensorbackeds)
static <V,T extends Tensorbacked<V>>
java.lang.Class<V>valueTypeFrom(java.lang.Class<T> tensorBackedClass)
Determines the type of the value of the given tensorbacked class.
-
-
-
Method Detail
-
dimensionsOf
public static <T extends Tensorbacked<?>> java.util.Set<java.lang.Class<?>> dimensionsOf(java.lang.Class<T> tensorBackedClass)
Retrieves the dimensions from the given class inheriting from tensor backed. This is done by inspecting theDimensions
annotation.- Parameters:
tensorBackedClass
- the class for which to determine the dimensions- Returns:
- the set of dimensions (classses of coordinates) which are required to create an instance of the given class.
-
dimensionListFrom
public static <T extends Tensorbacked<?>> java.util.List<java.lang.Class<?>> dimensionListFrom(java.lang.Class<T> tensorBackedClass)
-
createBackedByTensor
public static <V,T extends Tensorbacked<V>> T createBackedByTensor(java.lang.Class<T> tensorBackedClass, Tensor<V> tensor)
Creates an instance of a class backed by a tensor.- Parameters:
tensorBackedClass
- the type of the class for which to create an instance.tensor
- the tensor to back the instance- Returns:
- a new instance of the given class, backed by the given tensor
-
tensorsOf
public static <S> java.lang.Iterable<Tensor<S>> tensorsOf(java.lang.Iterable<? extends Tensorbacked<S>> tensorbackeds)
-
shapesOf
public static final <TB extends Tensorbacked<?>> java.lang.Iterable<Shape> shapesOf(java.lang.Iterable<TB> tensorbackeds)
-
classOf
public static final <V,TB extends Tensorbacked<V>> java.lang.Class<TB> classOf(TB tensorBacked)
-
ensureExactTensorbackedDimensions
public static <TB extends Tensorbacked<E>,E> Tensor<E> ensureExactTensorbackedDimensions(java.lang.Class<TB> tensorbackedClass, Tensor<E> tensor)
-
valueTypeFrom
public static <V,T extends Tensorbacked<V>> java.lang.Class<V> valueTypeFrom(java.lang.Class<T> tensorBackedClass)
Determines the type of the value of the given tensorbacked class.- Type Parameters:
T
- the type of the tensorbacked- Parameters:
tensorBackedClass
- the class from which to determine the value type- Returns:
- the type of the value
-
-