mikera.vectorz.impl
Class StridedVector
- 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>, IStridedArray, INDArray, IVector
public final class StridedVector extends BaseStridedVector
Mutable strided vector class- See Also:
- Serialized Form
-
-
Method Summary
All Methods Static Methods Instance Methods Concrete Methods Modifier and Type Method and Description voidadd(AVector v)Adds another vector to this onevoidadd(double[] data, int offset)Adds to this vector from a given double array.voidadd(int offset, AVector a, int srcOffset, int length)Adds a segment of another vector into this one, at the specified offsetvoidaddAt(int i, double value)Adds a value to a specific element of the vector This function does not perform bounds checking, i.e.voidapplyOp(Op op)Applies a unary operator to all elements of the array (in-place)voidclamp(double min, double max)Clamps all values in the vector to a given rangeStridedVectorexactClone()Returns an exact clone of this vector, i.e.voidfill(double value)Fills the entire vector with a given valuebooleanisFullyMutable()Returns true if this vector is fully mutable, i.e.booleanisMutable()Returns true if this vector is mutable.booleanisView()Returns true if this vector is of a view type that references other vectors / data.voidmultiply(double factor)Multiplies the vector by a constant factorvoidset(AVector v)Sets the vector to equal the value of another vectorvoidset(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 valuesvoidsetElements(int pos, double[] src, int srcOffset, int length)Sets elements in an array using the given double values.AVectorsubVector(int start, int length)Obtains a sub-vector view that refers to this vector.voidunsafeSet(int i, double value)Like set, but performs no bounds checking.static StridedVectorwrap(double[] data, int offset, int length, int stride)Wraps a StridedVector around a strided range of a double[] array.-
Methods inherited from class mikera.vectorz.impl.BaseStridedVector
dotProduct, dotProduct, dotProduct, get, getArrayOffset, getStride, unsafeGet
-
Methods inherited from class mikera.vectorz.impl.AStridedVector
addMultipleToArray, addToArray, addToArray, applyOpCopy, asDoubleArray, broadcast, broadcastLike, clone, copyTo, elementMax, elementMin, elementProduct, elementSquaredSum, elementSum, ensureMutable, equals, equalsArray, getArray, getElements, getElements, getStride, getStrides, hasUncountable, isPackedArray, isRangeZero, iterator, reduce, reduce, selectView, validate, visitNonZero
-
Methods inherited from class mikera.vectorz.impl.AArrayVector
maxAbsElement, slice
-
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, add, add, addAt, addCopy, addCopy, addCopy, addInnerProduct, addInnerProduct, addInnerProduct, addInnerProduct, addMultiple, addMultiple, addMultiple, addMultiple, addMultiple, addMultiple, addMultiple, addMultiple, addMultipleCopy, addMultipleSparse, addMultipleSparse, addMultipleToArray, addPower, addPower, addProduct, addProduct, addProduct, addProductCopy, addProductCopy, addProductToArray, addProductToArray, addSparse, addSparse, addToArray, addWeighted, angle, applyOp, applyOp, applyOp, applyOp, asElementList, asVector, broadcastLike, broadcastLike, clampMax, clampMin, compareTo, compareTo, copy, copyTo, copyTo, copyTo, copyTo, crossProduct, crossProduct, dense, denseClone, dimensionality, distance, distanceL1, distanceLinf, distanceSquared, divide, divide, divide, divide, divideCopy, divideCopy, divideCopy, divideTo, dotProduct, dotProduct, elementAbsPowSum, elementIterator, elementMaxAbs, elementPowSum, elementsEqual, epsilonEquals, epsilonEquals, epsilonEquals, equals, equals, fillRange, get, get, get, get, get, getElement, getElements, getLongShape, getShape, getSlices, getTranspose, getTransposeCopy, getTransposeView, hashCode, immutable, innerProduct, innerProduct, innerProduct, innerProduct, innerProduct, innerProduct, interpolate, isElementConstrained, isSameShape, isUnitLengthVector, isUnitLengthVector, isZero, join, join, join, log, logistic, magnitude, magnitudeSquared, maxAbsElementIndex, maxElement, maxElementIndex, minElement, minElementIndex, multiply, multiply, multiply, multiply, multiplyCopy, multiplyCopy, multiplyCopy, multiplyTo, mutable, negate, negateCopy, nonSparseIndex, nonZeroCount, nonZeroIndices, nonZeroValues, normalise, normaliseCopy, normaliseMaxAbsElement, outerProduct, outerProduct, pow, projectToPlane, reciprocal, reciprocalCopy, reduceSlices, reduceSlices, reorder, reorder, reshape, rotateCopy, rotateView, rotateView, scale, scaleAdd, scaleAdd, scaleAdd, scaleAdd, scaleCopy, scaleToMagnitude, select, selectClone, set, set, set, set, set, set, set, set, set, setApplyOp, setApplyOp, setApplyOp, setElements, setInnerProduct, setInnerProduct, setInnerProduct, setMultiple, setMultiple, setMultiple, setMultiple, setSparse, setSparse, setSparse, shiftCopy, signum, slice, sliceValue, softmax, softmaxCopy, sparse, sparseClone, sqrtCopy, square, squareCopy, sub, sub, subArray, subAt, subCopy, subCopy, subMultiple, tanh, toDoubleArray, toDoubleBuffer, toList, toNormal, toSliceArray, toString, toStringFull, toVector, tryEfficientJoin
-
Methods inherited from class mikera.arrayz.impl.AbstractArray
add, addApplyOp, addCopy, addInnerProduct, addInnerProduct, addOuterProduct, addOuterProductSparse, addSparse, broadcastCloneLike, broadcastCopyLike, componentCount, density, 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
abs, absCopy, absDiff, absDiffCopy, add, 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, dense, denseClone, dimensionality, divide, divide, divideCopy, divideCopy, elementAbsPowSum, elementCount, elementIterator, elementMaxAbs, elementPowSum, elementsEqual, epsilonEquals, epsilonEquals, equals, equalsArray, exp, 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, isSameShape, isSparse, isZero, join, join, log, multiply, multiplyCopy, multiplyCopy, mutable, negate, negateCopy, nonZeroCount, outerProduct, pow, reciprocal, reciprocalCopy, reduceSlices, reduceSlices, reorder, reorder, reshape, rotateView, scale, scaleAdd, scaleAdd, scaleCopy, set, set, set, set, set, set, setApplyOp, setElements, setInnerProduct, setMultiple, setMultiple, setSparse, setSparse, signum, signumCopy, slice, slice, sliceCount, sliceValue, sparse, sparseClone, sqrt, square, squareCopy, sub, sub, subArray, subCopy, toDoubleArray, toDoubleBuffer, toSliceArray, toVector, withComponents
-
-
-
-
Method Detail
-
wrap
public static StridedVector wrap(double[] data, int offset, int length, int stride)
Wraps a StridedVector around a strided range of a double[] array. Performs no bounds checking.- Parameters:
data-offset-length-stride-- Returns:
-
set
public void set(int i, double value)Description copied from interface:INDArraySets a value at a given position in a mutable 1D array
-
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
-
addAt
public void addAt(int i, double value)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
-
add
public void add(double[] data, int offset)Description copied from class:AVectorAdds to this vector from a given double array.
-
add
public void add(AVector v)
Description copied from class:AVectorAdds another vector to this one
-
add
public void add(int offset, AVector a, int srcOffset, int length)Description copied from class:AVectorAdds a segment of another vector into this one, at the specified offset- Overrides:
addin 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
-
set
public void set(AVector v)
Description copied from class:AVectorSets the vector to equal the value of another vector- Specified by:
setin classAStridedVector
-
clamp
public void clamp(double min, double max)Description copied from class:AVectorClamps all values in the vector to a given range
-
fill
public void fill(double value)
Description copied from class:AVectorFills the entire vector with a given value
-
multiply
public void multiply(double factor)
Description copied from class:AVectorMultiplies the vector by a constant factor
-
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.
-
setElements
public void setElements(int pos, double[] src, int srcOffset, 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 ordersrc- 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.length- Number of elements to set.
-
isView
public boolean isView()
Description copied from class:AVectorReturns true if this vector is of a view type that references other vectors / data.
-
isFullyMutable
public boolean isFullyMutable()
Description copied from class:AVectorReturns true if this vector is fully mutable, i.e. can contain any unconstrained double values- Specified by:
isFullyMutablein interfaceINDArray- Overrides:
isFullyMutablein classAVector
-
isMutable
public boolean isMutable()
Description copied from class:AVectorReturns true if this vector is mutable.
-
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
-
exactClone
public StridedVector 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