mikera.vectorz
Class Scalar
- java.lang.Object
-
- mikera.arrayz.impl.AbstractArray<java.lang.Object>
-
- mikera.vectorz.AScalar
-
- mikera.vectorz.Scalar
-
-
Field Summary
Fields Modifier and Type Field and Description doublevalue
-
Constructor Summary
Constructors Constructor and Description Scalar(double value)
-
Method Summary
All Methods Static Methods Instance Methods Concrete Methods Modifier and Type Method and Description voidabs()Replaces all elements of this array with their absolute values, according to Math.abs(double)voidadd(double d)Adds a double value to all elements in this array.voidaddSparse(double c)Adds to the non-sparse elements of this arraystatic Scalarcreate(AScalar a)static Scalarcreate(double value)static INDArraycreate(java.lang.Number number)static ScalarcreateFromVector(AVector data)Creates a new Scalar using the elements in the specified vector.ScalarexactClone()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.booleanisView()Return true if this array is considered as a view type.booleanisZero()Returns true if the array is zero (all elements equal to zero)voidmultiply(double factor)Multiplies all elements of the array in place by a given double valueScalarmutable()Coerces this INDArray to a fully mutable format.voidnegate()Negates all elements in the array in placevoidscaleAdd(double factor, double constant)Scales all elements of the array by a given double value and adds a constant valuevoidset(double value)Sets all elements of an array to a specific double valuevoidsub(double d)Subtracts a double value from all elements in this array-
Methods inherited from class mikera.vectorz.AScalar
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, isFullyMutable, isMutable, iterator, multiply, multiplyCopy, nonZeroCount, outerProduct, pow, reduce, reduce, reshape, set, setApplyOp, setElements, setElements, setElements, setSparse, slice, slice, sliceCount, sparse, sparseClone, square, 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, 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, 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, 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, scaleCopy, set, set, set, set, set, setInnerProduct, setMultiple, setMultiple, setSparse, signum, signumCopy, sliceValue, sqrt, squareCopy, subCopy, toVector, withComponents
-
-
-
-
Method Detail
-
create
public static Scalar create(double value)
-
create
public static INDArray create(java.lang.Number number)
-
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
-
abs
public void abs()
Description copied from interface:INDArrayReplaces all elements of this array with their absolute values, according to Math.abs(double)
-
add
public void add(double d)
Description copied from interface:INDArrayAdds a double value to all elements in this array. Implementations may optimize the case of 0.0
-
sub
public void sub(double d)
Description copied from interface:INDArraySubtracts a double value from all elements in this array
-
multiply
public void multiply(double factor)
Description copied from interface:INDArrayMultiplies all elements of the array in place by a given double value
-
negate
public void negate()
Description copied from interface:INDArrayNegates all elements in the array in place
-
scaleAdd
public void scaleAdd(double factor, double constant)Description copied from interface:INDArrayScales all elements of the array by a given double value and adds a constant value- Specified by:
scaleAddin interfaceINDArray- Overrides:
scaleAddin classAbstractArray<java.lang.Object>
-
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.
-
isZero
public boolean isZero()
Description copied from interface:INDArrayReturns true if the array is zero (all elements equal to zero)
-
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
-
exactClone
public Scalar 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
-
createFromVector
public static Scalar createFromVector(AVector data)
Creates a new Scalar using the elements in the specified vector. Zero-pads the data as required to define the Scalar- Parameters:
data-rows-columns-- Returns:
-
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
-
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.
-
addSparse
public void addSparse(double c)
Description copied from interface:INDArrayAdds to the non-sparse elements of this array- Specified by:
addSparsein interfaceINDArray- Overrides:
addSparsein classAbstractArray<java.lang.Object>
-
-
DMelt 3.0 © DataMelt by jWork.ORG