mikera.vectorz.impl
Class ImmutableScalar
- java.lang.Object
-
- mikera.arrayz.impl.AbstractArray<java.lang.Object>
-
- mikera.vectorz.AScalar
-
- mikera.vectorz.impl.ImmutableScalar
-
- All Implemented Interfaces:
- java.io.Serializable, java.lang.Cloneable, java.lang.Comparable<INDArray>, java.lang.Iterable<java.lang.Object>, IDense, INDArray, IScalar
public final class ImmutableScalar extends AScalar
Immutable scalar class Conceptually equivalent to a wrapped Double value, but supports all the Vectorz interfaces and functionality as a scalar object.- See Also:
- Serialized Form
-
-
Field Summary
Fields Modifier and Type Field and Description static ImmutableScalarONEstatic ImmutableScalarZERO
-
Method Summary
All Methods Static Methods Instance Methods Concrete Methods Modifier and Type Method and Description static ImmutableScalarcreate(AScalar a)static ImmutableScalarcreate(double value)AScalarexactClone()Creates a deep clone of an array, using the same class implementation as the original arraydoubleget()Returns the double value of a scalar arrayvoidgetElements(double[] dest, int offset)Copies all elements of this array a double array at the specified offsetImmutableScalarimmutable()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.booleanisMutable()Returns true if the INDArray is mutable (at least partially)booleanisView()Return true if this array is considered as a view type.Scalarmutable()Coerces this INDArray to a fully mutable format.voidset(double value)Sets all elements of an array to a specific double valueAScalarsparse()Coerces this INDArray to a sparse format, without changing its element values.-
Methods inherited from class mikera.vectorz.AScalar
abs, add, add, addAt, addCopy, addCopy, addInnerProduct, addInnerProduct, addMultiple, addPower, addToArray, applyOp, applyOp, applyOp, applyOp, asDoubleArray, asVector, broadcast, broadcastLike, broadcastLike, broadcastLike, clamp, clone, compareTo, dense, denseClone, dimensionality, divide, elementCount, elementIterator, elementMax, elementMaxAbs, elementMin, elementProduct, elementsEqual, elementSquaredSum, elementSum, epsilonEquals, equals, equals, equals, equalsArray, get, get, get, getElement, getElements, getLongShape, getShape, getShape, getSlices, getTranspose, getTransposeView, hashCode, hasUncountable, innerProduct, innerProduct, innerProduct, innerProduct, isBoolean, isElementConstrained, isZero, iterator, multiply, multiply, multiplyCopy, negate, nonZeroCount, outerProduct, pow, reduce, reduce, reshape, set, setApplyOp, setElements, setElements, setElements, setSparse, slice, slice, sliceCount, sparseClone, square, sub, sub, subArray, toDoubleArray, toDoubleBuffer, toSliceArray, toString, validate
-
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
absCopy, absDiff, absDiffCopy, addApplyOp, addMultipleSparse, addOuterProduct, addOuterProductSparse, addPower, addSparse, addSparse, applyOpCopy, asElementList, broadcastCloneLike, broadcastCopyLike, componentCount, copy, divide, divideCopy, divideCopy, elementAbsPowSum, elementPowSum, ensureMutable, epsilonEquals, 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, subCopy, toVector, withComponents
-
-
-
-
Field Detail
-
ONE
public static final ImmutableScalar ONE
-
ZERO
public static final ImmutableScalar ZERO
-
-
Method Detail
-
create
public static ImmutableScalar create(double value)
-
create
public static ImmutableScalar create(AScalar a)
-
isMutable
public boolean isMutable()
Description copied from interface:INDArrayReturns true if the INDArray is mutable (at least partially)
-
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
-
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.
-
get
public double get()
Description copied from interface:INDArrayReturns the double value of a scalar array
-
getElements
public void getElements(double[] dest, int offset)Description copied from interface:INDArrayCopies all elements of this array a double array at the specified offset- Specified by:
getElementsin interfaceINDArray- Overrides:
getElementsin classAScalar
-
set
public void set(double value)
Description copied from interface:INDArraySets all elements of an array to a specific double value
-
exactClone
public AScalar 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
-
mutable
public Scalar mutable()
Description copied from interface:INDArrayCoerces this INDArray to a fully mutable format. May return the same INDArray if already fully mutable
-
sparse
public AScalar sparse()
Description copied from interface:INDArrayCoerces this INDArray to a sparse format, without changing its element values. May return the same INDArray if already sparse. May also mutate the internal structure of the original NDArray, or create a view over parts of the original INDArray. You should take a defensive copy of the original NDArray if any of this concerns you. The returned sparse array may not be fully mutable in all elements.
-
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