mikera.vectorz.impl
Class ADenseArrayVector
- java.lang.Object
-
- mikera.arrayz.impl.AbstractArray<java.lang.Double>
-
- mikera.vectorz.AVector
-
- mikera.vectorz.impl.ASizedVector
-
- mikera.vectorz.impl.AArrayVector
-
- mikera.vectorz.impl.AStridedVector
-
- mikera.vectorz.impl.ADenseArrayVector
-
- All Implemented Interfaces:
- java.io.Serializable, java.lang.Cloneable, java.lang.Comparable<INDArray>, java.lang.Iterable<java.lang.Double>, IDense, IDenseArray, IStridedArray, INDArray, IVector
- Direct Known Subclasses:
- ArraySubVector, Vector
public abstract class ADenseArrayVector extends AStridedVector implements IDenseArray
Base class for mutable dense vectors backed by a double[] array with a fixed stride of 1 The double array can be directly accessed for performance purposes- See Also:
- Serialized Form
-
-
Method Summary
All Methods Instance Methods Abstract Methods Concrete Methods Modifier and Type Method and Description voidadd(ADenseArrayVector src, int srcOffset)voidadd(AVector src)Adds another vector to this onevoidadd(AVector src, int srcOffset)Adds part another vector to this one, starting at the specified offset in the source vectorvoidadd(double constant)Adds a double value to all elements in this array.voidadd(double[] data, int offset)Adds to this vector from a given double array.voidadd(int offset, ADenseArrayVector src)voidadd(int offset, ADenseArrayVector src, int srcOffset, int length)voidadd(int offset, AVector src, int srcOffset, int length)Adds a segment of another vector into this one, at the specified offsetvoidaddMultiple(ADenseArrayVector v, double factor)voidaddMultiple(AVector v, double factor)Adds a scaled multiple of another vector to this vectorvoidaddMultiple(int offset, AVector src, int srcOffset, int length, double factor)voidaddMultipleToArray(double factor, double[] array, int arrayOffset)Adds a multiple of this vector into a double array at the specified offsetvoidaddMultipleToArray(double factor, int offset, double[] array, int arrayOffset, int length)Adds a multiple of a subvector of this vector into a double array at the specified offsetvoidaddProduct(AVector a, AVector b)Adds the element-wise product of two vectors to this vector.voidaddProduct(AVector a, AVector b, double factor)Adds the element-wise product of two vectors and a constant factor to this vector.voidaddProduct(AVector a, int aOffset, AVector b, int bOffset, double factor)Adds the scaled elementwise product of two vectors to this vectorvoidaddProductToArray(double factor, int offset, ADenseArrayVector other, int otherOffset, double[] array, int arrayOffset, int length)Adds the scaled elementwise product of this vector and another vector to the destimation arrayvoidaddProductToArray(double factor, int offset, AVector other, int otherOffset, double[] array, int arrayOffset, int length)voidaddToArray(double[] dest, int destOffset, int destStride)Adds this vector to a double[] array, using the specified offset and stride into the destination arrayvoidaddToArray(int offset, double[] destData, int destOffset, int length)Adds a subvector of this vector into a double array at the specified offsetvoidapplyOp(Op2 op, AVector b)Applies a binary operator to this vector and a second vectorvoidclamp(double min, double max)Clamps all values in the vector to a given rangevoidcopyTo(int offset, ADenseArrayVector dest, int destOffset, int length)voidcopyTo(int start, AVector dest, int destOffset, int length)Copies a subset of this vector to a vector at the specified offsetvoidcopyTo(int offset, double[] dest, int destOffset, int length)Copies a subset of this vector to a specified destination array offsetvoidcopyTo(int offset, double[] dest, int destOffset, int length, int stride)Copies a subset of this vector to a specified destination array offset using the given stride.ADenseArrayVectordense()Coerces this INDArray to a dense format, without changing its element values.voiddivide(AVector v)voiddivide(double[] data, int offset)Divides the elements in this vector by corresponding elements in the target arrayvoiddivideTo(double[] data, int offset)Divides the elements in the target array by corresponding elements in this vectordoubledotProduct(AVector v)Returns the dot product of this vector with another vector The vectors must have the same length: if not the result is undefineddoubledotProduct(double[] data, int offset)Fast dot product with a double[] array.doubledotProduct(double[] src, int srcOffset, int stride)Fast dot product with a double[] array and a stride.doubleelementAbsPowSum(double exponent)Returns the sum of the absolute values of all the elements raised to a specified powerdoubleelementMax()Returns the maximum element value in this array.doubleelementMin()Returns the maximum element value in this array.doubleelementPowSum(double exponent)Returns the sum of all the elements raised to a specified powerdoubleelementProduct()Returns the product of all elements in the array.booleanelementsEqual(double value)Returns true if all elements are equal to a specific valuedoubleelementSquaredSum()Returns the sum of squared elements in this array.doubleelementSum()Returns the sum of all elements in a vectorbooleanequals(AVector v)Returns true if this array is exactly equal to a vector.booleanequals(INDArray v)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 this vector exactly matches the elements in double[] array, starting from the specified offsetvoidexp()Computes the function e^x (in-place) for all array elementsvoidfill(double value)Fills the entire vector with a given valuevoidfillRange(int offset, int length, double value)abstract doubleget(int i)Returns the double value at the specified position in a 1D vectorvoidgetElements(double[] data, int offset)Copies all elements of this array a double array at the specified offsetintgetStride()ADenseArrayVector has a fixed stride of 1, which enables efficient operations on arraysbooleanisPackedArray()Checks if this array is fully packed in row major order.booleanisRangeZero(int start, int length)Returns true if a sub-vector range is completely zero.booleanisView()Returns true if this vector is of a view type that references other vectors / data.booleanisZero()Returns true if this vector is a zero vector (all components zero)AVectorjoin(ADenseArrayVector v)AVectorjoin(AVector v)JoinedArrayVectorjoin(JoinedArrayVector v)voidlog()Computes the natural logarithm (in-place) for all array elementsdoublemagnitude()Returns the magnitude (Euclidean length) of the vectordoublemaxAbsElement()Returns the maximum absolute element value of a vectorintmaxAbsElementIndex()Returns the index of the maximum absolute element of a vectorintmaxElementIndex()Returns the index of the maximum element of a vectorintminElementIndex()Returns the index of the minimum element of a vectorvoidmultiply(AVector v)Multiplies this vector by another vector, elementwise.voidmultiply(double factor)Multiplies the vector by a constant factorvoidmultiply(double[] src, int srcOffset)Multiplies the elements in this vector by corresponding elements in the target arrayvoidmultiplyTo(double[] dest, int destOffset)Multiplies the elements in the target array by corresponding elements in this vectorlongnonZeroCount()Returns the number of non-zero elements in the array.int[]nonZeroIndices()Return an int array specifying the positions in this vector which are non-zerovoidpow(double exponent)Raises all elements of the array to a specified power in placevoidreciprocal()Computes the reciprocal of all elements in this vector.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.voidscaleAdd(double factor, AVector v, double vfactor, double constant)Scales all elements of the array by a given double value, adds a scaled second vector and adds a constant valuevoidscaleAdd(double factor, double constant)Scales this vector and adds a constant to every elementAVectorselectView(int... inds)Selects a subset of indices from a vector, returning a viewvoidset(AVector a)Sets the vector to equal the value of another vectorvoidset(AVector src, int srcOffset)Set the vector equal to an offset into another vectorabstract voidset(int i, double value)Sets a value at a given position in a mutable 1D arrayvoidsetElements(int pos, double[] values, int offset, int length)Sets elements in an array using the given double values.voidsignum()Calculates the signum of all elements of this mutable array Sets each component of the array to its sign value (-1, 0 or 1)ArrayIndexScalarslice(int position)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.voidsqrt()Computes the square root of all elements in the arrayvoidsquare()Squares all elements of the array in placeVectorsquareCopy()Squares all elements of the array, returning a new arrayAVectorsubVector(int offset, int length)Obtains a sub-vector view that refers to this vector.double[]toDoubleArray()Copies the elements of this array to a new double[] array.voidtoDoubleBuffer(java.nio.DoubleBuffer dest)Copies the elements of this INDArray to the specified double buffer.AVectortryEfficientJoin(AVector v)Attempts to perform an efficient join with a second vector.abstract doubleunsafeGet(int i)Like get, but performs no bounds checking.abstract voidunsafeSet(int i, double value)Like set, but performs no bounds checking.voidvalidate()Validates the internal data structure of the INDArray.doublevisitNonZero(IndexedElementVisitor elementVisitor)Visits all non-zero elements of this vector.-
Methods inherited from class mikera.vectorz.impl.AStridedVector
addAt, applyOp, applyOpCopy, asDoubleArray, broadcast, broadcastLike, clone, ensureMutable, getArray, getArrayOffset, getElements, getStride, getStrides, hasUncountable, iterator, setElements
-
Methods inherited from class mikera.vectorz.impl.ASizedVector
checkIndex, checkLength, checkRange, elementCount, equalsArray, get, getShape, getShapeClone, isSameShape, length, sliceCount
-
Methods inherited from class mikera.vectorz.AVector
abs, absCopy, absDiff, absDiff, absDiff, absDiffCopy, add, add, add, add, addAt, addCopy, addCopy, addCopy, addInnerProduct, addInnerProduct, addInnerProduct, addInnerProduct, addMultiple, addMultiple, addMultiple, addMultiple, addMultiple, addMultiple, addMultipleCopy, addMultipleSparse, addMultipleSparse, addPower, addPower, addProductCopy, addProductCopy, addSparse, addSparse, addToArray, addWeighted, angle, applyOp, applyOp, applyOp, asElementList, asVector, broadcastLike, broadcastLike, clampMax, clampMin, compareTo, compareTo, copy, copyTo, copyTo, crossProduct, crossProduct, denseClone, dimensionality, distance, distanceL1, distanceLinf, distanceSquared, divide, divide, divideCopy, divideCopy, divideCopy, dotProduct, dotProduct, elementIterator, elementMaxAbs, epsilonEquals, epsilonEquals, epsilonEquals, equals, exactClone, get, get, get, get, get, getElement, getElements, getLongShape, getShape, getSlices, getTranspose, getTransposeCopy, getTransposeView, hashCode, immutable, innerProduct, innerProduct, innerProduct, innerProduct, innerProduct, innerProduct, interpolate, isElementConstrained, isFullyMutable, isMutable, isSameShape, isUnitLengthVector, isUnitLengthVector, join, join, logistic, magnitudeSquared, maxElement, minElement, multiply, multiply, multiplyCopy, multiplyCopy, multiplyCopy, mutable, negate, negateCopy, nonSparseIndex, nonZeroValues, normalise, normaliseCopy, normaliseMaxAbsElement, outerProduct, outerProduct, projectToPlane, reciprocalCopy, reduceSlices, reduceSlices, reorder, reorder, reshape, rotateCopy, rotateView, rotateView, scale, scaleAdd, scaleAdd, scaleCopy, scaleToMagnitude, select, selectClone, set, set, set, set, set, set, set, set, setApplyOp, setApplyOp, setApplyOp, setElements, setInnerProduct, setInnerProduct, setInnerProduct, setMultiple, setMultiple, setMultiple, setMultiple, setSparse, setSparse, setSparse, shiftCopy, slice, sliceValue, softmax, softmaxCopy, sparse, sparseClone, sqrtCopy, sub, sub, subArray, subAt, subCopy, subCopy, subMultiple, tanh, toList, toNormal, toSliceArray, toString, toStringFull, toVector
-
Methods inherited from class mikera.arrayz.impl.AbstractArray
add, addApplyOp, addCopy, addInnerProduct, addInnerProduct, addOuterProduct, addOuterProductSparse, addSparse, broadcastCloneLike, broadcastCopyLike, componentCount, density, epsilonEquals, get, get, getComponent, getComponents, getElements, getElements, getSlices, getSliceViews, isBoolean, isDense, isSparse, scale, set, set, signumCopy, sub, sub, withComponents
-
Methods inherited from interface mikera.arrayz.impl.IDenseArray
getArray, getArrayOffset
-
Methods inherited from interface mikera.arrayz.INDArray
abs, absCopy, absDiff, absDiffCopy, add, addApplyOp, addAt, addCopy, addCopy, addInnerProduct, addInnerProduct, addMultiple, addMultipleSparse, addOuterProduct, addOuterProductSparse, addPower, addPower, addSparse, addSparse, addToArray, applyOp, applyOp, applyOp, asElementList, asVector, broadcastCloneLike, broadcastCopyLike, broadcastLike, broadcastLike, componentCount, copy, denseClone, dimensionality, divide, divide, divideCopy, divideCopy, elementCount, elementIterator, elementMaxAbs, epsilonEquals, epsilonEquals, equalsArray, exactClone, get, get, get, get, get, get, get, get, getComponent, getComponents, getElement, getElements, getElements, getElements, getLongShape, getShape, getShape, getShapeClone, getSlices, getSlices, getSliceViews, getTranspose, getTransposeCopy, getTransposeView, immutable, innerProduct, innerProduct, innerProduct, innerProduct, isBoolean, isDense, isElementConstrained, isFullyMutable, isMutable, isSameShape, isSparse, join, join, multiply, multiplyCopy, multiplyCopy, mutable, negate, negateCopy, outerProduct, reciprocalCopy, reduceSlices, reduceSlices, reorder, reorder, reshape, rotateView, scale, scaleAdd, scaleCopy, set, set, set, set, set, set, setApplyOp, setElements, setInnerProduct, setMultiple, setMultiple, setSparse, setSparse, signumCopy, slice, sliceCount, sliceValue, sparse, sparseClone, sub, sub, subArray, subCopy, toSliceArray, toVector, withComponents
-
-
-
-
Method Detail
-
getStride
public final int getStride()
ADenseArrayVector has a fixed stride of 1, which enables efficient operations on arrays- Specified by:
getStridein classAStridedVector- Returns:
-
subVector
public AVector subVector(int offset, int length)
Description copied from class:AVectorObtains a sub-vector view that refers to this vector. Changes to the sub-vector will be reflected in this vector
-
slice
public ArrayIndexScalar slice(int position)
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.- Specified by:
slicein interfaceINDArray- Overrides:
slicein classAArrayVector
-
selectView
public AVector selectView(int... inds)
Description copied from class:AVectorSelects a subset of indices from a vector, returning a view- Overrides:
selectViewin classAStridedVector- Returns:
- a view of the selected indices
-
isPackedArray
public boolean isPackedArray()
Description copied from interface:IStridedArrayChecks if this array is fully packed in row major order.- Specified by:
isPackedArrayin interfaceIStridedArray- Overrides:
isPackedArrayin classAStridedVector- Returns:
-
isView
public boolean isView()
Description copied from class:AVectorReturns true if this vector is of a view type that references other vectors / data.
-
isZero
public boolean isZero()
Description copied from class:AVectorReturns true if this vector is a zero vector (all components zero)
-
isRangeZero
public boolean isRangeZero(int start, int length)Description copied from class:AVectorReturns true if a sub-vector range is completely zero. Unsafe operation - does not perform bounds checking, results are undefined if sub-vector is out of range- Overrides:
isRangeZeroin classAStridedVector- Returns:
-
toDoubleBuffer
public void toDoubleBuffer(java.nio.DoubleBuffer dest)
Description copied from interface:INDArrayCopies the elements of this INDArray to the specified double buffer.- Specified by:
toDoubleBufferin interfaceINDArray- Overrides:
toDoubleBufferin classAVector
-
toDoubleArray
public double[] toDoubleArray()
Description copied from interface:INDArrayCopies the elements of this array to a new double[] array.- Specified by:
toDoubleArrayin interfaceINDArray- Overrides:
toDoubleArrayin classAVector
-
getElements
public void getElements(double[] data, 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 classAStridedVector
-
dense
public ADenseArrayVector dense()
Description copied from interface:INDArrayCoerces this INDArray to a dense format, without changing its element values. May return the same INDArray if already dense. 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 dense array may not be fully mutable in all elements.
-
fillRange
public void fillRange(int offset, int length, double value)
-
set
public void set(AVector a)
Description copied from class:AVectorSets the vector to equal the value of another vector- Specified by:
setin classAStridedVector
-
set
public void set(AVector src, int srcOffset)
Description copied from class:AVectorSet the vector equal to an offset into another vector
-
setElements
public void setElements(int pos, double[] values, int offset, int length)Description copied from interface:INDArraySets elements in an array using the given double values. The source array must contain at least the specified length in terms of number of elements- Specified by:
setElementsin interfaceINDArray- Specified by:
setElementsin classAStridedVector- Parameters:
pos- Offset into this array, expressed in terms of number of elements in row major ordervalues- Element values in a double[] array. There must be at least as many element values as elements in this array.offset- Position in the values array from which to start taking values.length- Number of elements to set.
-
get
public abstract double get(int i)
Description copied from interface:INDArrayReturns the double value at the specified position in a 1D vector
-
set
public abstract void set(int i, double value)Description copied from interface:INDArraySets a value at a given position in a mutable 1D array
-
unsafeGet
public abstract double unsafeGet(int i)
Description copied from class:AVectorLike get, but performs no bounds checking. Results are undefined if the index is out of range
-
unsafeSet
public abstract void unsafeSet(int i, double value)Description copied from class:AVectorLike set, but performs no bounds checking. Results are undefined if the index is out of range
-
add
public void add(AVector src)
Description copied from class:AVectorAdds another vector to this one
-
add
public void add(AVector src, int srcOffset)
Description copied from class:AVectorAdds part another vector to this one, starting at the specified offset in the source vector
-
add
public void add(int offset, AVector src, int srcOffset, int length)Description copied from class:AVectorAdds a segment of another vector into this one, at the specified offset- Overrides:
addin classAStridedVector
-
add
public void add(int offset, ADenseArrayVector src)
-
add
public void add(int offset, ADenseArrayVector src, int srcOffset, int length)
-
addMultiple
public void addMultiple(AVector v, double factor)
Description copied from class:AVectorAdds a scaled multiple of another vector to this vector- Overrides:
addMultiplein classAVector
-
scaleAdd
public void scaleAdd(double factor, double constant)Description copied from class:AVectorScales this vector and adds a constant to every element
-
add
public void add(double constant)
Description copied from interface:INDArrayAdds a double value to all elements in this array. Implementations may optimize the case of 0.0
-
addProduct
public void addProduct(AVector a, int aOffset, AVector b, int bOffset, double factor)
Description copied from class:AVectorAdds the scaled elementwise product of two vectors to this vector- Overrides:
addProductin classAVector
-
addToArray
public void addToArray(int offset, double[] destData, int destOffset, int length)Description copied from class:AVectorAdds a subvector of this vector into a double array at the specified offset- Overrides:
addToArrayin classAStridedVector
-
addToArray
public void addToArray(double[] dest, int destOffset, int destStride)Description copied from class:AVectorAdds this vector to a double[] array, using the specified offset and stride into the destination array- Overrides:
addToArrayin classAStridedVector
-
addProduct
public void addProduct(AVector a, AVector b)
Description copied from class:AVectorAdds the element-wise product of two vectors to this vector. Mutates this vector.- Overrides:
addProductin classAVector
-
addProduct
public void addProduct(AVector a, AVector b, double factor)
Description copied from class:AVectorAdds the element-wise product of two vectors and a constant factor to this vector. Mutates this vector.- Overrides:
addProductin classAVector
-
addMultipleToArray
public void addMultipleToArray(double factor, double[] array, int arrayOffset)Description copied from class:AVectorAdds a multiple of this vector into a double array at the specified offset- Overrides:
addMultipleToArrayin classAVector
-
addMultipleToArray
public void addMultipleToArray(double factor, int offset, double[] array, int arrayOffset, int length)Description copied from class:AVectorAdds a multiple of a subvector of this vector into a double array at the specified offset- Overrides:
addMultipleToArrayin classAStridedVector
-
addProductToArray
public void addProductToArray(double factor, int offset, AVector other, int otherOffset, double[] array, int arrayOffset, int length)- Overrides:
addProductToArrayin classAVector
-
addProductToArray
public void addProductToArray(double factor, int offset, ADenseArrayVector other, int otherOffset, double[] array, int arrayOffset, int length)Description copied from class:AVectorAdds the scaled elementwise product of this vector and another vector to the destimation array- Overrides:
addProductToArrayin classAVector
-
add
public void add(ADenseArrayVector src, int srcOffset)
-
add
public void add(double[] data, int offset)Description copied from class:AVectorAdds to this vector from a given double array.
-
dotProduct
public double dotProduct(double[] data, int offset)Description copied from class:AVectorFast dot product with a double[] array. Performs no bounds checking. Likely to be faster than most other dot product operations- Overrides:
dotProductin classAStridedVector
-
dotProduct
public double dotProduct(double[] src, int srcOffset, int stride)Description copied from class:AVectorFast dot product with a double[] array and a stride. Performs no bounds checking. Likely to be faster than other dot product operations- Overrides:
dotProductin classAVector
-
dotProduct
public double dotProduct(AVector v)
Description copied from class:AVectorReturns the dot product of this vector with another vector The vectors must have the same length: if not the result is undefined- Overrides:
dotProductin classAStridedVector- Returns:
-
log
public void log()
Description copied from interface:INDArrayComputes the natural logarithm (in-place) for all array elements
-
exp
public void exp()
Description copied from interface:INDArrayComputes the function e^x (in-place) for all array elements- Specified by:
expin interfaceINDArray- Overrides:
expin classAbstractArray<java.lang.Double>
-
applyOp
public void applyOp(Op2 op, AVector b)
Description copied from class:AVectorApplies a binary operator to this vector and a second vector
-
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 classAStridedVector
-
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 classAStridedVector
-
elementSum
public double elementSum()
Description copied from class:AVectorReturns the sum of all elements in a vector- Specified by:
elementSumin interfaceINDArray- Overrides:
elementSumin classAStridedVector
-
elementPowSum
public double elementPowSum(double exponent)
Description copied from class:AbstractArrayReturns the sum of all the elements raised to a specified power- Specified by:
elementPowSumin interfaceINDArray- Overrides:
elementPowSumin classAVector- Returns:
-
elementAbsPowSum
public double elementAbsPowSum(double exponent)
Description copied from class:AbstractArrayReturns the sum of the absolute values of all the elements raised to a specified power- Specified by:
elementAbsPowSumin interfaceINDArray- Overrides:
elementAbsPowSumin classAVector- Returns:
-
elementProduct
public double elementProduct()
Description copied from interface:INDArrayReturns the product of all elements in the array.- Specified by:
elementProductin interfaceINDArray- Overrides:
elementProductin classAStridedVector- Returns:
-
elementMax
public double elementMax()
Description copied from interface:INDArrayReturns the maximum element value in this array. Throws an error if there are no elements.- Specified by:
elementMaxin interfaceINDArray- Overrides:
elementMaxin classAStridedVector
-
elementMin
public double elementMin()
Description copied from interface:INDArrayReturns the maximum element value in this array. Throws an error if there are no elements.- Specified by:
elementMinin interfaceINDArray- Overrides:
elementMinin classAStridedVector
-
maxAbsElement
public double maxAbsElement()
Description copied from class:AVectorReturns the maximum absolute element value of a vector- Overrides:
maxAbsElementin classAArrayVector- Returns:
-
minElementIndex
public int minElementIndex()
Description copied from class:AVectorReturns the index of the minimum element of a vector- Overrides:
minElementIndexin classAVector
-
maxElementIndex
public int maxElementIndex()
Description copied from class:AVectorReturns the index of the maximum element of a vector- Overrides:
maxElementIndexin classAVector- Returns:
-
maxAbsElementIndex
public int maxAbsElementIndex()
Description copied from class:AVectorReturns the index of the maximum absolute element of a vector- Overrides:
maxAbsElementIndexin classAVector- 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 classAVector
-
nonZeroIndices
public int[] nonZeroIndices()
Description copied from class:AVectorReturn an int array specifying the positions in this vector which are non-zero- Overrides:
nonZeroIndicesin classAVector- Returns:
-
visitNonZero
public double visitNonZero(IndexedElementVisitor elementVisitor)
Description copied from class:AVectorVisits all non-zero elements of this vector. Visitor may return a non-zero value to terminate early, which will return the given value. Returns 0.0 otherwise.- Overrides:
visitNonZeroin classAStridedVector
-
square
public void square()
Description copied from interface:INDArraySquares all elements of the array in place
-
squareCopy
public Vector squareCopy()
Description copied from interface:INDArraySquares all elements of the array, returning a new array- Specified by:
squareCopyin interfaceINDArray- Overrides:
squareCopyin classAVector
-
sqrt
public void sqrt()
Description copied from interface:INDArrayComputes the square root of all elements in the array- Specified by:
sqrtin interfaceINDArray- Overrides:
sqrtin classAbstractArray<java.lang.Double>
-
signum
public void signum()
Description copied from interface:INDArrayCalculates the signum of all elements of this mutable array Sets each component of the array to its sign value (-1, 0 or 1)
-
multiply
public void multiply(AVector v)
Description copied from class:AVectorMultiplies this vector by another vector, elementwise.
-
multiply
public void multiply(double[] src, int srcOffset)Description copied from class:AVectorMultiplies the elements in this vector by corresponding elements in the target array
-
multiplyTo
public void multiplyTo(double[] dest, int destOffset)Description copied from class:AVectorMultiplies the elements in the target array by corresponding elements in this vector- Overrides:
multiplyToin classAVectordestOffset- The offset into the target array
-
divide
public void divide(double[] data, int offset)Description copied from class:AVectorDivides the elements in this vector by corresponding elements in the target array
-
divideTo
public void divideTo(double[] data, int offset)Description copied from class:AVectorDivides the elements in the target array by corresponding elements in this vector
-
copyTo
public void copyTo(int start, AVector dest, int destOffset, int length)Description copied from class:AVectorCopies a subset of this vector to a vector at the specified offset
-
copyTo
public void copyTo(int offset, ADenseArrayVector dest, int destOffset, int length)
-
copyTo
public void copyTo(int offset, double[] dest, int destOffset, int length, int stride)Description copied from class:AVectorCopies a subset of this vector to a specified destination array offset using the given stride. Unsafe operation: performs no bounds checking- Overrides:
copyToin classAStridedVector
-
copyTo
public void copyTo(int offset, double[] dest, int destOffset, int length)Description copied from class:AVectorCopies a subset of this vector to a specified destination array offset
-
addMultiple
public void addMultiple(ADenseArrayVector v, double factor)
-
addMultiple
public void addMultiple(int offset, AVector src, int srcOffset, int length, double factor)- Overrides:
addMultiplein classAVector
-
scaleAdd
public void scaleAdd(double factor, AVector v, double vfactor, double constant)Description copied from class:AVectorScales all elements of the array by a given double value, adds a scaled second vector and adds a constant value
-
elementSquaredSum
public double elementSquaredSum()
Description copied from interface:INDArrayReturns the sum of squared elements in this array.- Specified by:
elementSquaredSumin interfaceINDArray- Overrides:
elementSquaredSumin classAStridedVector
-
magnitude
public double magnitude()
Description copied from class:AVectorReturns the magnitude (Euclidean length) of the vector
-
fill
public void fill(double value)
Description copied from class:AVectorFills the entire vector with a given value
-
pow
public void pow(double exponent)
Description copied from interface:INDArrayRaises all elements of the array to a specified power in place
-
reciprocal
public void reciprocal()
Description copied from class:AVectorComputes the reciprocal of all elements in this vector. Mutates this vector- Specified by:
reciprocalin interfaceINDArray- Overrides:
reciprocalin classAVector
-
clamp
public void clamp(double min, double max)Description copied from class:AVectorClamps all values in the vector to a given range
-
multiply
public void multiply(double factor)
Description copied from class:AVectorMultiplies the vector by a constant factor
-
tryEfficientJoin
public AVector tryEfficientJoin(AVector v)
Description copied from class:AVectorAttempts to perform an efficient join with a second vector. An efficient join is guaranteed to be better than a simple JoinedVector(left,right) If possible, returns the joined vector. If not, returns null- Overrides:
tryEfficientJoinin classAVector
-
join
public AVector join(ADenseArrayVector v)
-
join
public JoinedArrayVector join(JoinedArrayVector v)
-
equals
public boolean equals(INDArray v)
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
-
equals
public boolean equals(AVector v)
Description copied from class:AbstractArrayReturns true if this array is exactly equal to a vector.- Overrides:
equalsin classAStridedVector- Returns:
-
equalsArray
public boolean equalsArray(double[] data, int offset)Description copied from class:AVectorReturns true if this vector exactly matches the elements in double[] array, starting from the specified offset- Specified by:
equalsArrayin interfaceINDArray- Overrides:
equalsArrayin classAStridedVector- Parameters:
data- Array of double element values to check for equalityoffset- Offset into the data array- Returns:
-
elementsEqual
public boolean elementsEqual(double value)
Description copied from interface:INDArrayReturns true if all elements are equal to a specific value- Specified by:
elementsEqualin interfaceINDArray- Overrides:
elementsEqualin classAVector
-
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.- Specified by:
validatein interfaceINDArray- Overrides:
validatein classAStridedVector
-
-
DMelt 3.0 © DataMelt by jWork.ORG