Package com.linkedin.dagli.math.mdarray
Class AbstractMDArray
java.lang.Object
com.linkedin.dagli.math.mdarray.AbstractMDArray
- All Implemented Interfaces:
MDArray,java.io.Serializable,java.lang.AutoCloseable
- Direct Known Subclasses:
VectorAsMDArray
public abstract class AbstractMDArray extends java.lang.Object implements MDArray
- See Also:
- Serialized Form
-
Field Summary
Fields Modifier and Type Field Description protected long[]_shape -
Constructor Summary
Constructors Constructor Description AbstractMDArray(long[] shape)Creates a new instance with the specified shape. -
Method Summary
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, waitMethods inherited from interface com.linkedin.dagli.math.mdarray.MDArray
asVector, close, getAsDouble, getAsDouble, getAsDoubleUnsafe, getAsLong, getAsLong, getAsLongUnsafe, subarrayAt, valueType
-
Field Details
-
_shape
protected final long[] _shape
-
-
Constructor Details
-
AbstractMDArray
public AbstractMDArray(long[] shape)Creates a new instance with the specified shape. Note that the instance keeps a reference to the provided shape array, which should not be modified subsequently.- Parameters:
shape- the shape of this instance
-
-
Method Details
-
toString
public java.lang.String toString()- Overrides:
toStringin classjava.lang.Object
-
shape
public final long[] shape()Description copied from interface:MDArrayGets the shape (dimensions) of thisMDArray, expressed as a long[]. The shape is fixed for any particularMDArrayinstance (i.e. calls to this method will always return the same value). As a special case, a "scalar" MDArray has 0 dimensions and thus this method will return a 0-length array. The caller must not modify the returned array.
-