mikera.vectorz.impl
Class ArraySubVector
- java.lang.Object
-
- mikera.arrayz.impl.AbstractArray<java.lang.Double>
-
- All Implemented Interfaces:
- java.io.Serializable, java.lang.Cloneable, java.lang.Comparable<INDArray>, java.lang.Iterable<java.lang.Double>, IDense, IDenseArray, IStridedArray, INDArray, IVector
public final class ArraySubVector extends ADenseArrayVector
Vector referring to a fixed offset into a double[] array- See Also:
- Serialized Form
-
-
Constructor Summary
Constructors Constructor and Description ArraySubVector(ADenseArrayVector source, int offset, int length)Constructs a vector directly referencing a sub-vector of an existing array-based Vector
-
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(AVector v)Adds another vector to this onevoidaddAt(int i, double v)Adds a value to a specific element of the vector This function does not perform bounds checking, i.e.voidaddMultiple(AVector v, double factor)Adds a scaled multiple of another vector to this vectorvoidapplyOp(Op op)Applies a unary operator to all elements of the array (in-place)ArraySubVectorexactClone()Returns an exact clone of this vector, i.e.voidfill(double value)Fills the entire vector with a given valuedoubleget(int i)Returns the double value at the specified position in a 1D vectorintgetArrayOffset()Gets the offset into the underlying double[] data array for the first element of this vectorinthashCode()Vector hashcode, designed to match hashcode of Java double arraybooleanisView()Returns true if this vector is of a view type that references other vectors / data.voidset(int i, double value)Sets a value at a given position in a mutable 1D arrayvoidsetElements(double[] src, int srcOffset)Sets all elements in an array using the given double valuesAVectorsubVector(int start, int length)Obtains a sub-vector view that refers to this vector.doubleunsafeGet(int i)Like get, but performs no bounds checking.voidunsafeSet(int i, double value)Like set, but performs no bounds checking.static ArraySubVectorwrap(double[] values)Wraps a double array as a dense ArraySubVectorstatic ArraySubVectorwrap(double[] data, int offset, int length)Wraps a segment of a double array as a dense ArraySubVector-
Methods inherited from class mikera.vectorz.impl.ADenseArrayVector
add, add, add, add, add, add, add, addMultiple, addMultiple, addMultipleToArray, addMultipleToArray, addProduct, addProduct, addProduct, addProductToArray, addProductToArray, addToArray, addToArray, applyOp, clamp, copyTo, copyTo, copyTo, copyTo, dense, divide, divide, divideTo, dotProduct, dotProduct, dotProduct, elementAbsPowSum, elementMax, elementMin, elementPowSum, elementProduct, elementsEqual, elementSquaredSum, elementSum, equals, equals, equalsArray, exp, fillRange, getElements, getStride, isPackedArray, isRangeZero, isZero, join, join, join, log, magnitude, maxAbsElement, maxAbsElementIndex, maxElementIndex, minElementIndex, multiply, multiply, multiply, multiplyTo, nonZeroCount, nonZeroIndices, pow, reciprocal, reduce, reduce, scaleAdd, scaleAdd, selectView, set, set, setElements, signum, slice, sqrt, square, squareCopy, toDoubleArray, toDoubleBuffer, tryEfficientJoin, validate, visitNonZero
-
Methods inherited from class mikera.vectorz.impl.AStridedVector
applyOpCopy, asDoubleArray, broadcast, broadcastLike, clone, ensureMutable, getArray, getElements, getStride, getStrides, hasUncountable, iterator
-
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
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, get, get, get, get, get, getElement, getElements, getLongShape, getShape, getSlices, getTranspose, getTransposeCopy, getTransposeView, 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
-
Methods inherited from interface mikera.arrayz.INDArray
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, 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
-
-
-
-
Constructor Detail
-
ArraySubVector
public ArraySubVector(ADenseArrayVector source, int offset, int length)
Constructs a vector directly referencing a sub-vector of an existing array-based Vector- Parameters:
source-offset-length-
-
-
Method Detail
-
wrap
public static ArraySubVector wrap(double[] values)
Wraps a double array as a dense ArraySubVector
-
wrap
public static ArraySubVector wrap(double[] data, int offset, int length)
Wraps a segment of a double array as a dense ArraySubVector- Parameters:
data-offset-length-- Returns:
-
get
public double get(int i)
Description copied from interface:INDArrayReturns the double value at the specified position in a 1D vector
-
set
public void set(int i, double value)Description copied from interface:INDArraySets a value at a given position in a mutable 1D array
-
fill
public void fill(double value)
Description copied from class:AVectorFills the entire vector with a given value- Specified by:
fillin interfaceINDArray- Overrides:
fillin classADenseArrayVector
-
unsafeGet
public 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- Specified by:
unsafeGetin classADenseArrayVector
-
unsafeSet
public 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- Specified by:
unsafeSetin classADenseArrayVector
-
add
public void add(AVector v)
Description copied from class:AVectorAdds another vector to this one- Overrides:
addin classADenseArrayVector
-
addMultiple
public void addMultiple(AVector v, double factor)
Description copied from class:AVectorAdds a scaled multiple of another vector to this vector- Overrides:
addMultiplein classADenseArrayVector
-
addAt
public void addAt(int i, double v)Description copied from class:AVectorAdds a value to a specific element of the vector This function does not perform bounds checking, i.e. is an unsafe operation- Specified by:
addAtin classAStridedVector
-
applyOp
public void applyOp(Op op)
Description copied from interface:INDArrayApplies a unary operator to all elements of the array (in-place)- Specified by:
applyOpin interfaceINDArray- Specified by:
applyOpin classAStridedVector
-
abs
public void abs()
Description copied from interface:INDArrayReplaces all elements of this array with their absolute values, according to Math.abs(double)
-
hashCode
public int hashCode()
Vector hashcode, designed to match hashcode of Java double array
-
getArrayOffset
public int getArrayOffset()
Description copied from class:AStridedVectorGets the offset into the underlying double[] data array for the first element of this vector- Specified by:
getArrayOffsetin interfaceIDenseArray- Specified by:
getArrayOffsetin interfaceIStridedArray- Specified by:
getArrayOffsetin 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.- Specified by:
isViewin interfaceINDArray- Overrides:
isViewin classADenseArrayVector
-
subVector
public AVector subVector(int start, 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- Overrides:
subVectorin classADenseArrayVector
-
setElements
public void setElements(double[] src, int srcOffset)Description copied from interface:INDArraySets all elements in an array using the given double values- Specified by:
setElementsin interfaceINDArray- Specified by:
setElementsin classAStridedVector- Parameters:
src- Element values in a double[] array. There must be at least as many element values as elements in this array.srcOffset- Position in the values array from which to start taking values.
-
exactClone
public ArraySubVector exactClone()
Description copied from class:AVectorReturns an exact clone of this vector, i.e. of the same type- Specified by:
exactClonein interfaceINDArray- Specified by:
exactClonein classAVector- Returns:
- A clone of the original array
-
-
DMelt 3.0 © DataMelt by jWork.ORG