mikera.vectorz.impl
Class ASizedVector
- java.lang.Object
-
- mikera.arrayz.impl.AbstractArray<java.lang.Double>
-
- mikera.vectorz.AVector
-
- mikera.vectorz.impl.ASizedVector
-
- All Implemented Interfaces:
- java.io.Serializable, java.lang.Cloneable, java.lang.Comparable<INDArray>, java.lang.Iterable<java.lang.Double>, INDArray, IVector
- Direct Known Subclasses:
- AArrayVector, ABooleanVector, AComputedVector, AJoinedVector, AMatrixViewVector, ASparseVector, AWrappedVector, BufferVector, IndexedArrayVector, IndexedSubVector, IndexVector, RepeatedElementVector, WrappedSubVector
public abstract class ASizedVector extends AVector
Abstract base class for vectors using a fixed final int size- See Also:
- Serialized Form
-
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method and Description intcheckIndex(int i)Utility function to check an index and throw an exception in not in bounds.intcheckLength(int length)Checks that a vector is the specified length, throws an exception if not.intcheckRange(int offset, int length)Utility function to check vector range and throw an exception if not valid.longelementCount()Returns the total number of elements in this array.booleanequalsArray(double[] data)Returns true if this vector exactly matches a double[] array.booleanequalsArray(double[] data, int offset)Returns true if this vector exactly matches the elements in double[] array, starting from the specified offsetdoubleget(long i)Returns the double value at the specified position in a 1D vectorint[]getShape()Returns the shape of the array as an array of ints.int[]getShapeClone()Returns the shape of the array as an array of ints, guaranteed to be a new array i.e.booleanisSameShape(AVector a)Returns true if this vector is exactly the same shape as another vector.intlength()Returns the length of a vector, in terms of the number of elements.intsliceCount()Returns the number of major slices in this array (i.e.doublevisitNonZero(IndexedElementVisitor elementVisitor)Visits all non-zero elements of this vector.-
Methods inherited from class mikera.vectorz.AVector
abs, absCopy, absDiff, absDiff, absDiff, absDiffCopy, add, add, add, add, add, add, add, add, add, addAt, addAt, addCopy, addCopy, addCopy, addInnerProduct, addInnerProduct, addInnerProduct, addInnerProduct, addMultiple, addMultiple, addMultiple, addMultiple, addMultiple, addMultiple, addMultiple, addMultiple, addMultipleCopy, addMultipleSparse, addMultipleSparse, addMultipleToArray, addMultipleToArray, addPower, addPower, addProduct, addProduct, addProduct, addProductCopy, addProductCopy, addProductToArray, addProductToArray, addSparse, addSparse, addToArray, addToArray, addToArray, addWeighted, angle, applyOp, applyOp, applyOp, applyOp, applyOp, applyOpCopy, asDoubleArray, asElementList, asVector, broadcast, broadcastLike, broadcastLike, broadcastLike, clamp, clampMax, clampMin, clone, compareTo, compareTo, copy, copyTo, copyTo, copyTo, copyTo, copyTo, crossProduct, crossProduct, dense, denseClone, dimensionality, distance, distanceL1, distanceLinf, distanceSquared, divide, divide, divide, divide, divideCopy, divideCopy, divideCopy, divideTo, dotProduct, dotProduct, dotProduct, dotProduct, dotProduct, elementAbsPowSum, elementIterator, elementMax, elementMaxAbs, elementMin, elementPowSum, elementProduct, elementsEqual, elementSquaredSum, elementSum, epsilonEquals, epsilonEquals, epsilonEquals, equals, equals, equals, exactClone, fill, fillRange, get, get, get, get, get, get, getElement, getElements, getElements, getElements, getLongShape, getShape, getSlices, getTranspose, getTransposeCopy, getTransposeView, hashCode, hasUncountable, immutable, innerProduct, innerProduct, innerProduct, innerProduct, innerProduct, innerProduct, interpolate, isElementConstrained, isFullyMutable, isMutable, isRangeZero, isSameShape, isUnitLengthVector, isUnitLengthVector, isView, isZero, iterator, join, join, join, log, logistic, magnitude, magnitudeSquared, maxAbsElement, maxAbsElementIndex, maxElement, maxElementIndex, minElement, minElementIndex, multiply, multiply, multiply, multiply, multiply, multiplyCopy, multiplyCopy, multiplyCopy, multiplyTo, mutable, negate, negateCopy, nonSparseIndex, nonZeroCount, nonZeroIndices, nonZeroValues, normalise, normaliseCopy, normaliseMaxAbsElement, outerProduct, outerProduct, pow, projectToPlane, reciprocal, reciprocalCopy, reduce, reduce, reduceSlices, reduceSlices, reorder, reorder, reshape, rotateCopy, rotateView, rotateView, scale, scaleAdd, scaleAdd, scaleAdd, scaleAdd, scaleCopy, scaleToMagnitude, select, selectClone, selectView, set, set, set, set, set, set, set, set, set, set, set, setApplyOp, setApplyOp, setApplyOp, setElements, setElements, setElements, setInnerProduct, setInnerProduct, setInnerProduct, setMultiple, setMultiple, setMultiple, setMultiple, setSparse, setSparse, setSparse, shiftCopy, signum, slice, slice, sliceValue, softmax, softmaxCopy, sparse, sparseClone, sqrtCopy, square, squareCopy, sub, sub, subArray, subAt, subCopy, subCopy, subMultiple, subVector, tanh, toDoubleArray, toDoubleBuffer, toList, toNormal, toSliceArray, toString, toStringFull, toVector, tryEfficientJoin, unsafeGet, unsafeSet, validate
-
Methods inherited from class mikera.arrayz.impl.AbstractArray
add, addApplyOp, addCopy, addInnerProduct, addInnerProduct, addOuterProduct, addOuterProductSparse, addSparse, broadcastCloneLike, broadcastCopyLike, componentCount, density, ensureMutable, epsilonEquals, exp, get, get, getComponent, getComponents, getElements, getElements, getSlices, getSliceViews, isBoolean, isDense, isSparse, scale, set, set, signumCopy, sqrt, sub, sub, withComponents
-
Methods inherited from interface mikera.arrayz.INDArray
addApplyOp, addInnerProduct, addOuterProduct, addOuterProductSparse, addSparse, broadcastCloneLike, broadcastCopyLike, componentCount, ensureMutable, epsilonEquals, exp, get, get, getComponent, getComponents, getElements, getElements, getSlices, getSliceViews, isBoolean, isDense, isSparse, scale, set, set, signumCopy, sqrt, sub, withComponents
-
-
-
-
Method Detail
-
length
public final int length()
Description copied from interface:IVectorReturns the length of a vector, in terms of the number of elements. For Euclidean length, use magnitude() instead
-
elementCount
public final long elementCount()
Description copied from interface:INDArrayReturns the total number of elements in this array. Equivalent to the product of all dimension sizes.- Specified by:
elementCountin interfaceINDArray- Overrides:
elementCountin classAVector
-
sliceCount
public final int sliceCount()
Description copied from interface:INDArrayReturns the number of major slices in this array (i.e. the size of dimension 0)- Specified by:
sliceCountin interfaceINDArray- Overrides:
sliceCountin classAVector
-
get
public final double get(long i)
Description copied from interface:INDArrayReturns the double value at the specified position in a 1D vector
-
getShape
public final int[] getShape()
Description copied from interface:INDArrayReturns the shape of the array as an array of ints. WARNING: May return the internal int[] array describing the shape. Modifying this may cause undefined behaviour. If you want to guarantee a new int[] array that can be safely modified, use getShapeClone() instead
-
isSameShape
public final boolean isSameShape(AVector a)
Description copied from interface:IVectorReturns true if this vector is exactly the same shape as another vector.- Specified by:
isSameShapein interfaceIVector- Overrides:
isSameShapein classAVector- Returns:
-
checkRange
public final int checkRange(int offset, int length)Description copied from class:AVectorUtility function to check vector range and throw an exception if not valid. Returns the length of this vector- Overrides:
checkRangein classAVector
-
checkIndex
public final int checkIndex(int i)
Description copied from class:AVectorUtility function to check an index and throw an exception in not in bounds. Returns the vector length- Overrides:
checkIndexin classAVector
-
checkLength
public final int checkLength(int length)
Description copied from class:AVectorChecks that a vector is the specified length, throws an exception if not.- Overrides:
checkLengthin classAVector- Returns:
- The length of the vector
-
getShapeClone
public final int[] getShapeClone()
Description copied from interface:INDArrayReturns the shape of the array as an array of ints, guaranteed to be a new array i.e. will perform a defensive copy of any internal shape array if required.- Specified by:
getShapeClonein interfaceINDArray- Overrides:
getShapeClonein classAVector
-
equalsArray
public final boolean equalsArray(double[] data)
Description copied from class:AVectorReturns true if this vector exactly matches a double[] array.- Specified by:
equalsArrayin interfaceINDArray- Overrides:
equalsArrayin classAVector- Parameters:
data- Array of double element values to check for equality- 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 classAVector- Parameters:
data- Array of double element values to check for equalityoffset- Offset into the data array- 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.- Specified by:
visitNonZeroin classAVector
-
-
DMelt 3.0 © DataMelt by jWork.ORG