mikera.arrayz.impl
Class BaseShapedArray
- java.lang.Object
-
- mikera.arrayz.impl.AbstractArray<INDArray>
-
- mikera.arrayz.impl.BaseShapedArray
-
- All Implemented Interfaces:
- java.io.Serializable, java.lang.Cloneable, java.lang.Comparable<INDArray>, java.lang.Iterable<INDArray>, INDArray
- Direct Known Subclasses:
- Array, BaseNDArray, BroadcastScalarArray, JoinedArray, SliceArray, ZeroArray
public abstract class BaseShapedArray extends AbstractArray<INDArray>
Abstract base class for N-dimensional arrays that use a fixed int[] shape vector. Any dimensionality (including 0) is supported.- See Also:
- Serialized Form
-
-
Constructor Summary
Constructors Constructor and Description BaseShapedArray(int[] shape)
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method and Description intdimensionality()Returns the dimensionality of the array (i.e.longelementCount()Returns the total number of elements in this array.doublegetElement(long i)Gets a specific element of this array, indexed in row-major orderint[]getShape()Returns the shape of the array as an array of ints.intgetShape(int dim)Returns the dimension size for a specific dimension in the array's shapeint[]getShapeClone()Returns the shape of the array as an array of ints, guaranteed to be a new array i.e.booleanisZero()Returns true if the array is zero (all elements equal to zero)doublereduce(Op2 op)Reduces over all elements of the array in row-major order.doublereduce(Op2 op, double init)Reduces over all elements of the array in row-major order.intsliceCount()Returns the number of major slices in this array (i.e.-
Methods inherited from class mikera.arrayz.impl.AbstractArray
abs, absCopy, absDiff, absDiffCopy, add, add, add, addApplyOp, addAt, addCopy, addCopy, addCopy, addInnerProduct, addInnerProduct, addInnerProduct, addInnerProduct, addMultiple, addMultipleSparse, addOuterProduct, addOuterProductSparse, addPower, addPower, addSparse, addSparse, addToArray, applyOp, applyOp, applyOp, applyOp, applyOpCopy, asDoubleArray, asElementList, asVector, broadcast, broadcastCloneLike, broadcastCopyLike, broadcastLike, broadcastLike, broadcastLike, clamp, clone, compareTo, componentCount, copy, dense, denseClone, density, divide, divide, divideCopy, divideCopy, elementAbsPowSum, elementIterator, elementMax, elementMaxAbs, elementMin, elementPowSum, elementProduct, elementsEqual, elementSquaredSum, elementSum, ensureMutable, epsilonEquals, epsilonEquals, equals, equals, equals, equalsArray, equalsArray, exp, fill, get, get, get, get, get, get, get, get, getComponent, getComponents, getElements, getElements, getElements, getElements, getLongShape, getSlices, getSlices, getSliceViews, getTranspose, getTransposeCopy, getTransposeView, hashCode, hasUncountable, immutable, innerProduct, innerProduct, innerProduct, innerProduct, isBoolean, isDense, isElementConstrained, isFullyMutable, isMutable, isSameShape, isSparse, iterator, join, join, log, multiply, multiply, multiplyCopy, multiplyCopy, mutable, negate, negateCopy, nonZeroCount, outerProduct, pow, reciprocal, reciprocalCopy, reduceSlices, reduceSlices, reorder, reorder, reshape, rotateView, scale, scaleAdd, scaleAdd, scaleCopy, set, set, set, set, set, set, setApplyOp, setElements, setElements, setElements, setInnerProduct, setMultiple, setMultiple, setSparse, setSparse, signum, signumCopy, sliceValue, sparse, sparseClone, sqrt, square, squareCopy, sub, sub, sub, subArray, subCopy, toDoubleArray, toDoubleBuffer, toSliceArray, toString, toStringFull, toVector, validate, withComponents
-
-
-
-
Method Detail
-
dimensionality
public int dimensionality()
Description copied from interface:INDArrayReturns the dimensionality of the array (i.e. the number of dimensions in the array shape) e.g. 0 for a scalar, 1 for a vector, 2 for a matrix etc.
-
getShape
public int[] getShape()
Description copied from interface:INDArrayReturns the shape of the array as an array of ints. WARNING: May return the internal int[] array describing the shape. Modifying this may cause undefined behaviour. If you want to guarantee a new int[] array that can be safely modified, use getShapeClone() instead
-
getShapeClone
public int[] getShapeClone()
Description copied from interface:INDArrayReturns the shape of the array as an array of ints, guaranteed to be a new array i.e. will perform a defensive copy of any internal shape array if required.- Specified by:
getShapeClonein interfaceINDArray- Overrides:
getShapeClonein classAbstractArray<INDArray>
-
sliceCount
public int sliceCount()
Description copied from interface:INDArrayReturns the number of major slices in this array (i.e. the size of dimension 0)
-
reduce
public double reduce(Op2 op, double init)
Description copied from interface:INDArrayReduces over all elements of the array in row-major order. Applies the operator to the initial/previous result at each step. Returns the final result.- Specified by:
reducein interfaceINDArray- Overrides:
reducein classAbstractArray<INDArray>
-
reduce
public double reduce(Op2 op)
Description copied from interface:INDArrayReduces over all elements of the array in row-major order. Applies the operator to the previous result at each step. Returns the final result.- Specified by:
reducein interfaceINDArray- Overrides:
reducein classAbstractArray<INDArray>
-
isZero
public boolean isZero()
Description copied from interface:INDArrayReturns true if the array is zero (all elements equal to zero)- Specified by:
isZeroin interfaceINDArray- Overrides:
isZeroin classAbstractArray<INDArray>
-
getShape
public int getShape(int dim)
Description copied from interface:INDArrayReturns the dimension size for a specific dimension in the array's shape- Specified by:
getShapein interfaceINDArray- Overrides:
getShapein classAbstractArray<INDArray>
-
elementCount
public long elementCount()
Description copied from interface:INDArrayReturns the total number of elements in this array. Equivalent to the product of all dimension sizes.
-
getElement
public double getElement(long i)
Description copied from interface:INDArrayGets a specific element of this array, indexed in row-major order- Returns:
- The element value
-
-
DMelt 3.0 © DataMelt by jWork.ORG