Class ImmutableDoubleArrayBackedTensor
- java.lang.Object
-
- org.tensorics.core.tensor.AbstractTensor<java.lang.Double>
-
- org.tensorics.core.tensor.specific.ImmutableDoubleArrayBackedTensor
-
public class ImmutableDoubleArrayBackedTensor extends AbstractTensor<java.lang.Double>
A specific implementation of a tensor, that contains double values. It is backed by a simple double array to minimize memory usage and improve performance.
-
-
Nested Class Summary
Nested Classes Modifier and Type Class Description static class
ImmutableDoubleArrayBackedTensor.Builder
A builder for tensor which only will contain doubles
-
Constructor Summary
Constructors Constructor Description ImmutableDoubleArrayBackedTensor(ImmutableDoubleArrayBackedTensor.Builder builder)
-
Method Summary
All Methods Static Methods Instance Methods Concrete Methods Modifier and Type Method Description static ImmutableDoubleArrayBackedTensor.Builder
builder(PositionIndexer indexer)
boolean
contains(Position position)
Returnstrue
if the tensoric object contains the given position,false
otherwise.Position
context()
Retrieves the context of the tensor, which is nothing else than a position.java.lang.Double
get(java.lang.Object... coordinates)
java.lang.Double
get(Position position)
Shape
shape()
Retrieves the shape of the tensor.-
Methods inherited from class org.tensorics.core.tensor.AbstractTensor
equals, hashCode
-
-
-
-
Constructor Detail
-
ImmutableDoubleArrayBackedTensor
public ImmutableDoubleArrayBackedTensor(ImmutableDoubleArrayBackedTensor.Builder builder)
-
-
Method Detail
-
get
public java.lang.Double get(Position position)
- Parameters:
position
- the position in the N-dimensional space where to find the value.- Returns:
- the value at the given position
-
get
public java.lang.Double get(java.lang.Object... coordinates)
- Parameters:
coordinates
- form N-dimensional space where to find the value.- Returns:
- a value at the given coordinates.
-
shape
public Shape shape()
Description copied from interface:Tensor
Retrieves the shape of the tensor. As shape we understand simply the structure of a tensor: Its dimensions and the available positions.Implementations have to take care that the returned value here is never
null
.- Returns:
- the shape of the tensor.
-
context
public Position context()
Description copied from interface:Tensor
Retrieves the context of the tensor, which is nothing else than a position. As context of the tensor we understand coordinates within a higher dimensional space than than the tensor has itself. This coordinates can e.g. transport information when e.g. a higher-dimensional tensor is split into smaller ones, so that it can potentially be reconstructed afterwards.Implementations have to guarantee that the returned value here is never
null
.- Returns:
- the context of the tensor.
-
contains
public boolean contains(Position position)
Description copied from interface:Tensoric
Returnstrue
if the tensoric object contains the given position,false
otherwise.- Parameters:
position
- the position to be checked- Returns:
true
if the position is contained in the tensoric object,false
otherwise.
-
builder
public static ImmutableDoubleArrayBackedTensor.Builder builder(PositionIndexer indexer)
-
-