mikera.vectorz.impl
Class ArrayIndexScalar
- java.lang.Object
-
- mikera.arrayz.impl.AbstractArray<java.lang.Object>
-
- mikera.vectorz.AScalar
-
- mikera.vectorz.impl.ArrayIndexScalar
-
- All Implemented Interfaces:
- java.io.Serializable, java.lang.Cloneable, java.lang.Comparable<INDArray>, java.lang.Iterable<java.lang.Object>, IDense, IDenseArray, IStridedArray, INDArray, IScalar
public class ArrayIndexScalar extends AScalar implements IStridedArray, IDenseArray
Scalar class wrapping a single element of a dense double[] array.- See Also:
- Serialized Form
-
-
Constructor Summary
Constructors Constructor and Description ArrayIndexScalar(double[] array, int index)
-
Method Summary
All Methods Static Methods Instance Methods Concrete Methods Modifier and Type Method and Description double[]asDoubleArray()Returns the underlying double array representing the densely packed elements of this array.ArraySubVectorasVector()Constructs a view of all elements in the array as a single vector in row-major order.Scalarclone()Returns a clone of the array data, as a new array which will be fully mutable and may be of a different class to the original.ArrayIndexScalarexactClone()Creates a deep clone of an array, using the same class implementation as the original arraydoubleget()Returns the double value of a scalar arraydouble[]getArray()Gets the underlying data array for this strided array Unsafe operation - may allow modification of otherwise immutable arraysintgetArrayOffset()Gets the data array offset for the first element of this strided arrayintgetStride(int dimension)Gets the stide for a specific dimension in this strided array.int[]getStrides()Gets the strides for each dimension of this strided array.ImmutableScalarimmutable()Returns an immutable version of this array.booleanisFullyMutable()If this method returns true, the INDArray is guaranteed to be fully mutable in all positions i.e.booleanisPackedArray()Checks if this array is fully packed in row major order.booleanisView()Return true if this array is considered as a view type.ArrayIndexScalarmutable()Coerces this INDArray to a fully mutable format.voidset(double value)Sets all elements of an array to a specific double valuevoidvalidate()Validates the internal data structure of the INDArray.static ArrayIndexScalarwrap(double[] array, int index)-
Methods inherited from class mikera.vectorz.AScalar
abs, add, add, addAt, addCopy, addCopy, addInnerProduct, addInnerProduct, addMultiple, addPower, addToArray, applyOp, applyOp, applyOp, applyOp, broadcast, broadcastLike, broadcastLike, broadcastLike, clamp, compareTo, dense, denseClone, dimensionality, divide, elementCount, elementIterator, elementMax, elementMaxAbs, elementMin, elementProduct, elementsEqual, elementSquaredSum, elementSum, epsilonEquals, equals, equals, equals, equalsArray, get, get, get, getElement, getElements, getElements, getLongShape, getShape, getShape, getSlices, getTranspose, getTransposeView, hashCode, hasUncountable, innerProduct, innerProduct, innerProduct, innerProduct, isBoolean, isElementConstrained, isMutable, isZero, iterator, multiply, multiply, multiplyCopy, negate, nonZeroCount, outerProduct, pow, reduce, reduce, reshape, set, setApplyOp, setElements, setElements, setElements, setSparse, slice, slice, sliceCount, sparse, sparseClone, square, sub, sub, subArray, toDoubleArray, toDoubleBuffer, toSliceArray, toString
-
Methods inherited from class mikera.arrayz.impl.AbstractArray
absCopy, absDiff, absDiffCopy, add, addApplyOp, addCopy, addInnerProduct, addInnerProduct, addMultipleSparse, addOuterProduct, addOuterProductSparse, addPower, addSparse, addSparse, applyOpCopy, asElementList, broadcastCloneLike, broadcastCopyLike, componentCount, copy, density, divide, divideCopy, divideCopy, elementAbsPowSum, elementPowSum, ensureMutable, epsilonEquals, equals, equalsArray, exp, fill, get, get, get, get, get, getComponent, getComponents, getElements, getElements, getShapeClone, getSlices, getSliceViews, getTransposeCopy, isDense, isSameShape, isSparse, join, join, log, multiplyCopy, negateCopy, reciprocal, reciprocalCopy, reduceSlices, reduceSlices, reorder, reorder, rotateView, scale, scaleAdd, scaleAdd, scaleCopy, set, set, set, set, set, setInnerProduct, setMultiple, setMultiple, setSparse, signum, signumCopy, sliceValue, sqrt, squareCopy, sub, subCopy, toStringFull, toVector, withComponents
-
Methods inherited from interface mikera.arrayz.INDArray
abs, absCopy, absDiff, absDiffCopy, add, add, addApplyOp, addAt, addCopy, addCopy, addInnerProduct, addInnerProduct, addMultiple, addMultipleSparse, addOuterProduct, addOuterProductSparse, addPower, addPower, addSparse, addSparse, addToArray, applyOp, applyOp, applyOp, applyOp, applyOpCopy, asElementList, broadcast, broadcastCloneLike, broadcastCopyLike, broadcastLike, broadcastLike, broadcastLike, clamp, componentCount, copy, dense, denseClone, dimensionality, divide, divide, divideCopy, divideCopy, elementAbsPowSum, elementCount, elementIterator, elementMax, elementMaxAbs, elementMin, elementPowSum, elementProduct, elementsEqual, elementSquaredSum, elementSum, ensureMutable, epsilonEquals, epsilonEquals, equals, equalsArray, equalsArray, exp, fill, get, get, get, get, get, get, get, get, getComponent, getComponents, getElement, getElements, getElements, getElements, getElements, getLongShape, getShape, getShape, getShapeClone, getSlices, getSlices, getSliceViews, getTranspose, getTransposeCopy, getTransposeView, hasUncountable, innerProduct, innerProduct, innerProduct, innerProduct, isBoolean, isDense, isElementConstrained, isMutable, isSameShape, isSparse, isZero, join, join, log, multiply, multiply, multiplyCopy, multiplyCopy, negate, negateCopy, nonZeroCount, outerProduct, pow, reciprocal, reciprocalCopy, reduce, reduce, 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, slice, slice, sliceCount, sliceValue, sparse, sparseClone, sqrt, square, squareCopy, sub, sub, subArray, subCopy, toDoubleArray, toDoubleBuffer, toSliceArray, toVector, withComponents
-
-
-
-
Method Detail
-
wrap
public static ArrayIndexScalar wrap(double[] array, int index)
-
get
public double get()
Description copied from interface:INDArrayReturns the double value of a scalar array
-
set
public void set(double value)
Description copied from interface:INDArraySets all elements of an array to a specific double value
-
isView
public boolean isView()
Description copied from interface:INDArrayReturn true if this array is considered as a view type. This indicates (but does not guarantee): a) Data is *likely* to be shared with other arrays, so mutation of one may affect others b) It is *unlikely* to be in the most efficient general purpose format isView is intended to be used as for heuristics. It should *not* be used where the outcome might affect correctness.
-
isFullyMutable
public boolean isFullyMutable()
Description copied from interface:INDArrayIf this method returns true, the INDArray is guaranteed to be fully mutable in all positions i.e. every position can store any valid double value- Specified by:
isFullyMutablein interfaceINDArray- Overrides:
isFullyMutablein classAScalar
-
clone
public Scalar clone()
Description copied from interface:INDArrayReturns a clone of the array data, as a new array which will be fully mutable and may be of a different class to the original. Clone should attempt to return the most efficient possible array type. Clone should preserve sparsity property where possible, but this is not guaranteed.
-
exactClone
public ArrayIndexScalar exactClone()
Description copied from interface:INDArrayCreates a deep clone of an array, using the same class implementation as the original array- Specified by:
exactClonein interfaceINDArray- Specified by:
exactClonein classAScalar- Returns:
- A clone of the original array
-
validate
public void validate()
Description copied from interface:INDArrayValidates the internal data structure of the INDArray. Throws an exception on failure. Failure indicates a serious bug and/or data corruption.
-
getArray
public double[] getArray()
Description copied from interface:IStridedArrayGets the underlying data array for this strided array Unsafe operation - may allow modification of otherwise immutable arrays- Specified by:
getArrayin interfaceIDenseArray- Specified by:
getArrayin interfaceIStridedArray
-
getArrayOffset
public int getArrayOffset()
Description copied from interface:IStridedArrayGets the data array offset for the first element of this strided array- Specified by:
getArrayOffsetin interfaceIDenseArray- Specified by:
getArrayOffsetin interfaceIStridedArray
-
getStrides
public int[] getStrides()
Description copied from interface:IStridedArrayGets the strides for each dimension of this strided array. The returned array should not be modified- Specified by:
getStridesin interfaceIStridedArray- Returns:
-
getStride
public int getStride(int dimension)
Description copied from interface:IStridedArrayGets the stide for a specific dimension in this strided array.- Specified by:
getStridein interfaceIStridedArray- Returns:
-
isPackedArray
public boolean isPackedArray()
Description copied from interface:IStridedArrayChecks if this array is fully packed in row major order.- Specified by:
isPackedArrayin interfaceIStridedArray- Returns:
-
asDoubleArray
public double[] asDoubleArray()
Description copied from interface:INDArrayReturns the underlying double array representing the densely packed elements of this array. Modifications to this double array will change the original array. Returns null if there is no such array.- Specified by:
asDoubleArrayin interfaceINDArray- Overrides:
asDoubleArrayin classAScalar
-
mutable
public ArrayIndexScalar mutable()
Description copied from interface:INDArrayCoerces this INDArray to a fully mutable format. May return the same INDArray if already fully mutable
-
asVector
public ArraySubVector asVector()
Description copied from interface:INDArrayConstructs a view of all elements in the array as a single vector in row-major order.
-
immutable
public ImmutableScalar immutable()
Description copied from interface:INDArrayReturns an immutable version of this array. May return the same array if already immutable. Guarantees a defensive copy if the array is mutable.
-
-
DMelt 3.0 © DataMelt by jWork.ORG