mikera.arrayz.impl
Class ZeroArray
- java.lang.Object
-
- mikera.arrayz.impl.AbstractArray<INDArray>
-
- mikera.arrayz.impl.BaseShapedArray
-
- mikera.arrayz.impl.ZeroArray
-
- All Implemented Interfaces:
- java.io.Serializable, java.lang.Cloneable, java.lang.Comparable<INDArray>, java.lang.Iterable<INDArray>, INDArray, ISparse
public final class ZeroArray extends BaseShapedArray implements ISparse
Class representing an immutable array filled entirely with zeros.- See Also:
- Serialized Form
-
-
Method Summary
All Methods Static Methods Instance Methods Concrete Methods Modifier and Type Method and Description INDArrayaddCopy(INDArray a)Creates a new array equal to the sum of this array with another array.voidaddToArray(double[] data, int offset)Adds all the elements of this array to a double array at the specified offset, in row-major orderAVectorasVector()Constructs a view of all elements in the array as a single vector in row-major order.INDArrayclone()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.static ZeroArraycreate(int... shape)Returns a zero array with specified shape.doubleelementAbsPowSum(double p)Returns the sum of the absolute values of all the elements raised to a specified powerdoubleelementPowSum(double p)Returns the sum of all the elements raised to a specified powerbooleanequals(INDArray a)Checks if two arrays are equal exactly in terms of both value and shape Element equality checks are consistent with compareTobooleanequalsArray(double[] data, int offset)Returns true if the elements in this array exactly match the elements in the given array, in row-major orderZeroArrayexactClone()Creates a deep clone of an array, using the same class implementation as the original arraydoubleget()Returns the double value of a scalar arraydoubleget(int... indexes)Returns the double value at the specified index position in an arraydoubleget(int x)Returns the double value at the specified position in a 1D vectordoubleget(int x, int y)Returns the double value at the specified position in a 2D matrixjava.util.List<INDArray>getSlices()Returns a list of all major slices of this array.ZeroArraygetTranspose()Returns the transpose of this array.booleanhasUncountable()Returns true if any element is this array is NaN or infinitebooleanisMutable()Returns true if the INDArray is mutable (at least partially)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)longnonZeroCount()Returns the number of non-zero elements in the array.voidset(int[] indexes, double value)Sets the element at the given indexed position in a mutable arrayINDArrayslice(int majorSlice)Returns the specified major slice of this array as a view (slice along dimension 0) 0 dimensional slice results are permitted, but attempting to slice a 0 dimensional array will result in an error.INDArrayslice(int dimension, int index)Returns a slice view of this array along the specified dimensionINDArraysparseClone()Creates a fully mutable clone of this array.static ZeroArraywrap(int... shape)-
Methods inherited from class mikera.arrayz.impl.BaseShapedArray
dimensionality, elementCount, getElement, getShape, getShape, getShapeClone, reduce, reduce, sliceCount
-
Methods inherited from class mikera.arrayz.impl.AbstractArray
abs, absCopy, absDiff, absDiffCopy, add, add, add, addApplyOp, addAt, addCopy, addCopy, addInnerProduct, addInnerProduct, addInnerProduct, addInnerProduct, addMultiple, addMultipleSparse, addOuterProduct, addOuterProductSparse, addPower, addPower, addSparse, addSparse, applyOp, applyOp, applyOp, applyOp, applyOpCopy, asDoubleArray, asElementList, broadcast, broadcastCloneLike, broadcastCopyLike, broadcastLike, broadcastLike, broadcastLike, clamp, compareTo, componentCount, copy, dense, denseClone, density, divide, divide, divideCopy, divideCopy, elementIterator, elementMax, elementMaxAbs, elementMin, elementProduct, elementsEqual, elementSquaredSum, elementSum, ensureMutable, epsilonEquals, epsilonEquals, equals, equals, equalsArray, exp, fill, get, get, get, get, get, getComponent, getComponents, getElements, getElements, getElements, getElements, getLongShape, getSlices, getSliceViews, getTransposeCopy, getTransposeView, hashCode, immutable, innerProduct, innerProduct, innerProduct, innerProduct, isBoolean, isDense, isElementConstrained, isFullyMutable, isSameShape, isSparse, iterator, join, join, log, multiply, multiply, multiplyCopy, multiplyCopy, mutable, negate, negateCopy, 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, sqrt, square, squareCopy, sub, sub, sub, subArray, subCopy, toDoubleArray, toDoubleBuffer, toSliceArray, toString, toStringFull, toVector, validate, withComponents
-
-
-
-
Method Detail
-
wrap
public static ZeroArray wrap(int... shape)
-
create
public static ZeroArray create(int... shape)
Returns a zero array with specified shape. Takes a defensive clone of the shape array.- Parameters:
shape-- Returns:
-
nonZeroCount
public long nonZeroCount()
Description copied from interface:INDArrayReturns the number of non-zero elements in the array.- Specified by:
nonZeroCountin interfaceINDArray- Overrides:
nonZeroCountin classAbstractArray<INDArray>
-
get
public double get(int... indexes)
Description copied from interface:INDArrayReturns the double value at the specified index position in an array
-
get
public double get()
Description copied from interface:INDArrayReturns the double value of a scalar array- Specified by:
getin interfaceINDArray- Specified by:
getin classAbstractArray<INDArray>
-
get
public double get(int x)
Description copied from interface:INDArrayReturns the double value at the specified position in a 1D vector- Specified by:
getin interfaceINDArray- Specified by:
getin classAbstractArray<INDArray>
-
get
public double get(int x, int y)Description copied from interface:INDArrayReturns the double value at the specified position in a 2D matrix- Specified by:
getin interfaceINDArray- Specified by:
getin classAbstractArray<INDArray>
-
set
public void set(int[] indexes, double value)Description copied from interface:INDArraySets the element at the given indexed position in a mutable array
-
slice
public INDArray slice(int majorSlice)
Description copied from interface:INDArrayReturns the specified major slice of this array as a view (slice along dimension 0) 0 dimensional slice results are permitted, but attempting to slice a 0 dimensional array will result in an error.
-
slice
public INDArray slice(int dimension, int index)
Description copied from interface:INDArrayReturns a slice view of this array along the specified dimension
-
getSlices
public java.util.List<INDArray> getSlices()
Description copied from interface:INDArrayReturns a list of all major slices of this array. Returns a list of Double values if a 1-dimensional array is sliced, otherwise a list of INDArray instances- Specified by:
getSlicesin interfaceINDArray- Overrides:
getSlicesin classAbstractArray<INDArray>
-
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.
-
isMutable
public boolean isMutable()
Description copied from interface:INDArrayReturns true if the INDArray is mutable (at least partially)- Specified by:
isMutablein interfaceINDArray- Overrides:
isMutablein 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 classBaseShapedArray
-
getTranspose
public ZeroArray getTranspose()
Description copied from interface:INDArrayReturns the transpose of this array. A transpose of an array is equivalent to reversing the order of dimensions. May or may not return a view depending on the array type.- Specified by:
getTransposein interfaceINDArray- Overrides:
getTransposein classAbstractArray<INDArray>
-
addToArray
public void addToArray(double[] data, int offset)Description copied from interface:INDArrayAdds all the elements of this array to a double array at the specified offset, in row-major order- Specified by:
addToArrayin interfaceINDArray- Overrides:
addToArrayin classAbstractArray<INDArray>
-
addCopy
public INDArray addCopy(INDArray a)
Description copied from interface:INDArrayCreates a new array equal to the sum of this array with another array.- Specified by:
addCopyin interfaceINDArray- Overrides:
addCopyin classAbstractArray<INDArray>- Returns:
-
equalsArray
public boolean equalsArray(double[] data, int offset)Description copied from interface:INDArrayReturns true if the elements in this array exactly match the elements in the given array, in row-major order- Specified by:
equalsArrayin interfaceINDArray- Overrides:
equalsArrayin classAbstractArray<INDArray>- Parameters:
data- Array of double element values to check for equalityoffset- Offset into the data array- Returns:
-
equals
public boolean equals(INDArray a)
Description copied from interface:INDArrayChecks if two arrays are equal exactly in terms of both value and shape Element equality checks are consistent with compareTo- Specified by:
equalsin interfaceINDArray- Overrides:
equalsin classAbstractArray<INDArray>
-
asVector
public AVector asVector()
Description copied from interface:INDArrayConstructs a view of all elements in the array as a single vector in row-major order.- Specified by:
asVectorin interfaceINDArray- Overrides:
asVectorin classAbstractArray<INDArray>
-
clone
public INDArray 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.- Specified by:
clonein interfaceINDArray- Overrides:
clonein classAbstractArray<INDArray>
-
sparseClone
public INDArray sparseClone()
Description copied from interface:INDArrayCreates a fully mutable clone of this array. Will use a sparse format if possible.- Specified by:
sparseClonein interfaceINDArray- Overrides:
sparseClonein classAbstractArray<INDArray>
-
exactClone
public ZeroArray 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- Returns:
- A clone of the original array
-
hasUncountable
public boolean hasUncountable()
Description copied from class:AbstractArrayReturns true if any element is this array is NaN or infinite- Specified by:
hasUncountablein interfaceINDArray- Overrides:
hasUncountablein classAbstractArray<INDArray>- Returns:
- True if any element is this array is NaN or infinite, false otherwise
-
elementPowSum
public double elementPowSum(double p)
Returns the sum of all the elements raised to a specified power- Specified by:
elementPowSumin interfaceINDArray- Overrides:
elementPowSumin classAbstractArray<INDArray>- Returns:
-
elementAbsPowSum
public double elementAbsPowSum(double p)
Returns the sum of the absolute values of all the elements raised to a specified power- Specified by:
elementAbsPowSumin interfaceINDArray- Overrides:
elementAbsPowSumin classAbstractArray<INDArray>- Returns:
-
-
DMelt 3.0 © DataMelt by jWork.ORG