mikera.vectorz.impl
Class SparseIndexedVector
- java.lang.Object
-
- mikera.arrayz.impl.AbstractArray<java.lang.Double>
-
- mikera.vectorz.AVector
-
- mikera.vectorz.impl.ASizedVector
-
- mikera.vectorz.impl.ASparseVector
-
- mikera.vectorz.impl.ASparseIndexedVector
-
- mikera.vectorz.impl.SparseIndexedVector
-
- All Implemented Interfaces:
- java.io.Serializable, java.lang.Cloneable, java.lang.Comparable<INDArray>, java.lang.Iterable<java.lang.Double>, INDArray, ISparse, ISparseVector, IVector
public class SparseIndexedVector extends ASparseIndexedVector
Indexed sparse vector. Efficient for mutable, mostly sparse vectors. Maintains a indexed array of elements which may be non-zero. These values *can* also be zero. WARNING: individual updates of non-indexed elements are O(n) in the number of non-sparse elements. You should not normally perform element-wise mutation on a SparseIndexedVector if performance is a concern Index must be distinct and sorted.- See Also:
- Serialized Form
-
-
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(ASparseVector v)voidadd(AVector v)Adds another vector to this onevoidadd(double[] src, int srcOffset)Adds to this vector from a given double array.voidaddAt(int i, double value)Adds a value to a specific element of the vector This function does not perform bounds checking, i.e.voidaddMultiple(ASparseVector v, double factor)voidaddMultiple(AVector v, double factor)Adds a scaled multiple of another vector to this vectorvoidaddMultiple(SparseIndexedVector v, double factor)Adds a scaled multiple of a sparse indexed vector to this vectorvoidaddMultipleSparse(ADenseArrayVector v, double factor)Adds a multiple of the source array to the non-sparse elements of this arrayvoidaddMultipleSparse(AVector v, double factor)Adds a multiple of a source vector to the non-sparse elements of this vector onlyvoidaddMultipleSparse(SparseIndexedVector v, double factor)voidaddSparse(double c)Adds to the non-sparse elements of this arrayvoidapplyOp(Op op)Applies a unary operator to all elements of the array (in-place)voidapplyOp(Op2 op, double d)Applies a binary operator to this array and a double value.SparseIndexedVectorclone()Clones the vector, creating a new mutable copy of all data.static SparseIndexedVectorcreate(ASparseVector source)static SparseIndexedVectorcreate(AVector source)Creates a SparseIndexedVector from the given vector, ignoring the zeros in the source.static SparseIndexedVectorcreate(double[] values)Creates a SparseIndexedVector from an array of double valuesstatic SparseIndexedVectorcreate(int length, Index index, AVector data)Creates a SparseIndexedVector using the given sorted Index to identify the indexes of non-zero values, and a dense vector to specify all the non-zero element valuesstatic SparseIndexedVectorcreate(int length, Index index, double[] data)Creates a SparseIndexedVector using the given sorted Index to identify the indexes of non-zero values, and a double[] array to specify all the non-zero element valuesstatic SparseIndexedVectorcreate(java.lang.Iterable<?> iterable)Creates a SparseIndexedVector from the specified Iterable objectstatic SparseIndexedVectorcreate(java.util.Iterator<?> iterator)Creates a SparseIndexedVector from the specified Iterator objectstatic SparseIndexedVectorcreate(java.lang.Object o)Creates a SparseIndexedVector from the source objectstatic SparseIndexedVectorcreate(java.lang.Object[] values)Creates a SparseIndexedVector from the source object arraystatic SparseIndexedVectorcreate(SparseHashedVector source)static AVectorcreateFromRow(AMatrix m, int row)Creates a SparseIndexedVector from a row of an existing matrixstatic SparseIndexedVectorcreateLength(int length)static AVectorcreateWithIndices(AVector v, int[] ixs)Creates a sparse indexed vector using the specified indexed values from the source vector All non-indexed vales will be zero.SparseIndexedVectorexactClone()Returns an exact clone of this vector, i.e.doubleget(int i)Returns the double value at the specified position in a 1D vectorAVectorimmutable()Creates an immutable copy of a vectorvoidincludeIndices(ASparseIndexedVector v)voidincludeIndices(AVector v)Include additional indices in the non-sparse index set of this vector.voidincludeIndices(Index ixs)Include additional indices in the non-sparse index set of this vector.AVectorinnerProduct(AMatrix m)Computes the inner product of this vector with a matrixAVectorinnerProduct(SparseColumnMatrix m)AVectorinnerProduct(SparseRowMatrix m)Overloaded implementation for SparseIndexedVector x SparseRowMatrix This is basically a weighted sum of rows!booleanisFullyMutable()Returns true if this vector is fully mutable, i.e.booleanisMutable()Returns true if this vector is mutable.doublemaxAbsElement()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(ASparseVector v)voidmultiply(AVector v)Multiplies this vector by another vector, elementwise.voidmultiply(double d)Multiplies the vector by a constant factorvoidmultiply(double[] array, int offset)Multiplies the elements in this vector by corresponding elements in the target arraySparseIndexedVectormultiplyCopy(double factor)Returns a copy of the array with all elements multiplied by a single constant valuevoidnegate()Negates all emlements of this vector in place.intnonSparseElementCount()Returns the number of non-sparse elements in the sparse vector.IndexnonSparseIndex()Returns an Index indicating which elements of this vector are defined as non-sparse.VectornonSparseValues()Returns the non-sparse elements as a compacted vector.voidpow(double exponent)Raises all elements of the array to a specified power in placedoublereduce(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.ASparseVectorroundToZero(double precision)Returns a vector after replacing all elements with absolute values less-than-or-equal to precision with zeros.voidset(ADenseArrayVector v)Sets the vector equal to the value of an ADenseArrayVectorvoidset(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[] array, int offset)Sets all elements in an array using the given double valuesvoidsetElements(int pos, double[] array, int offset, int length)Sets elements in an array using the given double values.voidsetSparse(AVector v)Sets the non-sparse elements of this vector to the corresponding elements of another vectorvoidsetSparse(double v)Sets the non-sparse elements of this array to the specified value May throw an exception if non-sparse elements are not mutableSparseIndexedVectorsparseClone()Clones the vector into a sparse mutable formatvoidsquare()Squares all elements of the array in placevoidsub(ASparseVector v)voidsub(AVector v)Subtracts a vector from this vectorSparseIndexedVectortoSparseIndexedVector()Coerces this vector to a SparseIndexedVector.VectortoVector()Coerces this vector to the standard dense Vector format.doubleunsafeGet(int i)Like get, but performs no bounds checking.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.static SparseIndexedVectorwrap(int length, Index index, double[] data)Creates a SparseIndexedVector with the specified index and data values.static SparseIndexedVectorwrap(int length, int[] indices, double[] data)Creates a SparseIndexedVector with the specified index and data values.-
Methods inherited from class mikera.vectorz.impl.ASparseIndexedVector
addMultipleToArray, addProductToArray, addProductToArray, addToArray, addToArray, addToArray, cloneIncludingIndices, copyTo, dotProduct, dotProduct, dotProduct, dotProduct, elementSquaredSum, elementSum, equals, equalsArray, getElements, includesIndex, isRangeZero, isZero, nonZeroCount, nonZeroIndices
-
Methods inherited from class mikera.vectorz.impl.ASparseVector
copyTo, copyTo, density, distanceL1, distanceLinf, distanceSquared, dotProduct, elementAbsPowSum, elementPowSum, elementProduct, equals, getSlices, hasUncountable, isSparse, isView, reduceSlices, sparse, toDoubleArray
-
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, add, add, add, addAt, addCopy, addCopy, addCopy, addInnerProduct, addInnerProduct, addInnerProduct, addInnerProduct, addMultiple, addMultiple, addMultiple, addMultiple, addMultiple, addMultiple, addMultipleCopy, addMultipleSparse, addMultipleToArray, addPower, addPower, addProduct, addProduct, addProduct, addProductCopy, addProductCopy, addSparse, addWeighted, angle, applyOp, applyOp, applyOp, applyOpCopy, asDoubleArray, asElementList, asVector, broadcast, broadcastLike, broadcastLike, broadcastLike, clamp, clampMax, clampMin, compareTo, compareTo, copy, copyTo, copyTo, crossProduct, crossProduct, dense, denseClone, dimensionality, distance, divide, divide, divide, divide, divideCopy, divideCopy, divideCopy, divideTo, dotProduct, elementIterator, elementMax, elementMaxAbs, elementMin, elementsEqual, epsilonEquals, epsilonEquals, epsilonEquals, equals, equals, fill, fillRange, get, get, get, get, get, getElement, getElements, getElements, getLongShape, getShape, getTranspose, getTransposeCopy, getTransposeView, hashCode, innerProduct, innerProduct, innerProduct, innerProduct, innerProduct, interpolate, isElementConstrained, isSameShape, isUnitLengthVector, isUnitLengthVector, iterator, join, join, join, log, logistic, magnitude, magnitudeSquared, maxElement, minElement, multiply, multiply, multiplyCopy, multiplyCopy, multiplyTo, mutable, negateCopy, nonZeroValues, normalise, normaliseCopy, normaliseMaxAbsElement, outerProduct, outerProduct, projectToPlane, reciprocal, reciprocalCopy, 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, setApplyOp, setApplyOp, setApplyOp, setElements, setInnerProduct, setInnerProduct, setInnerProduct, setMultiple, setMultiple, setMultiple, setMultiple, setSparse, shiftCopy, signum, slice, slice, sliceValue, softmax, softmaxCopy, sqrtCopy, squareCopy, sub, subArray, subAt, subCopy, subCopy, subMultiple, subVector, tanh, toDoubleBuffer, toList, toNormal, toSliceArray, toString, toStringFull, tryEfficientJoin
-
Methods inherited from class mikera.arrayz.impl.AbstractArray
add, addApplyOp, addCopy, addInnerProduct, addInnerProduct, addOuterProduct, addOuterProductSparse, addSparse, broadcastCloneLike, broadcastCopyLike, componentCount, ensureMutable, epsilonEquals, exp, get, get, getComponent, getComponents, getElements, getElements, getSlices, getSliceViews, isBoolean, isDense, scale, set, set, signumCopy, sqrt, sub, sub, withComponents
-
Methods inherited from interface mikera.vectorz.IVector
addCopy, divideCopy, epsilonEquals, isSameShape, length, multiplyCopy, normalise, normaliseCopy, rotateCopy, rotateView, shiftCopy, sqrtCopy, subCopy
-
Methods inherited from interface mikera.arrayz.INDArray
absCopy, absDiff, absDiffCopy, add, add, addApplyOp, addAt, addCopy, addCopy, addInnerProduct, addInnerProduct, addMultiple, addMultipleSparse, addOuterProduct, addOuterProductSparse, addPower, addPower, addSparse, applyOp, applyOp, applyOpCopy, asDoubleArray, asElementList, asVector, broadcast, broadcastCloneLike, broadcastCopyLike, broadcastLike, broadcastLike, broadcastLike, clamp, componentCount, copy, dense, denseClone, dimensionality, divide, divide, divideCopy, divideCopy, elementCount, elementIterator, elementMax, elementMaxAbs, elementMin, elementsEqual, ensureMutable, epsilonEquals, epsilonEquals, equals, equalsArray, exp, fill, get, get, get, get, get, get, get, get, getComponent, getComponents, getElement, getElements, getElements, getElements, getLongShape, getShape, getShape, getShapeClone, getSlices, getSliceViews, getTranspose, getTransposeCopy, getTransposeView, innerProduct, innerProduct, innerProduct, innerProduct, isBoolean, isDense, isElementConstrained, isSameShape, join, join, log, multiply, multiplyCopy, mutable, negateCopy, outerProduct, reciprocal, reciprocalCopy, reduceSlices, reorder, reorder, reshape, rotateView, scale, scaleAdd, scaleAdd, scaleCopy, set, set, set, set, set, set, setApplyOp, setElements, setInnerProduct, setMultiple, setMultiple, setSparse, signum, signumCopy, slice, slice, sliceCount, sliceValue, sqrt, squareCopy, sub, sub, subArray, subCopy, toDoubleBuffer, toSliceArray, withComponents
-
-
-
-
Method Detail
-
wrap
public static SparseIndexedVector wrap(int length, Index index, double[] data)
Creates a SparseIndexedVector with the specified index and data values. Performs no checking - Index must be distinct and sorted.
-
wrap
public static SparseIndexedVector wrap(int length, int[] indices, double[] data)
Creates a SparseIndexedVector with the specified index and data values. Performs no checking - Index must be distinct and sorted.
-
create
public static SparseIndexedVector create(int length, Index index, double[] data)
Creates a SparseIndexedVector using the given sorted Index to identify the indexes of non-zero values, and a double[] array to specify all the non-zero element values
-
createWithIndices
public static AVector createWithIndices(AVector v, int[] ixs)
Creates a sparse indexed vector using the specified indexed values from the source vector All non-indexed vales will be zero.- Parameters:
v-ixs-- Returns:
-
createLength
public static SparseIndexedVector createLength(int length)
-
create
public static SparseIndexedVector create(int length, Index index, AVector data)
Creates a SparseIndexedVector using the given sorted Index to identify the indexes of non-zero values, and a dense vector to specify all the non-zero element values
-
create
public static SparseIndexedVector create(java.lang.Object o)
Creates a SparseIndexedVector from the source object- Parameters:
o-- Returns:
-
create
public static SparseIndexedVector create(double[] values)
Creates a SparseIndexedVector from an array of double values- Parameters:
o-- Returns:
-
create
public static SparseIndexedVector create(java.lang.Object[] values)
Creates a SparseIndexedVector from the source object array- Parameters:
o-- Returns:
-
create
public static SparseIndexedVector create(AVector source)
Creates a SparseIndexedVector from the given vector, ignoring the zeros in the source.
-
create
public static SparseIndexedVector create(ASparseVector source)
-
create
public static SparseIndexedVector create(SparseHashedVector source)
-
create
public static SparseIndexedVector create(java.lang.Iterable<?> iterable)
Creates a SparseIndexedVector from the specified Iterable object- Parameters:
iterable- An Iterable containing java.lang.Number instances- Returns:
-
create
public static SparseIndexedVector create(java.util.Iterator<?> iterator)
Creates a SparseIndexedVector from the specified Iterator object- Parameters:
iterator- An Iterator over java.lang.Number instances- Returns:
-
createFromRow
public static AVector createFromRow(AMatrix m, int row)
Creates a SparseIndexedVector from a row of an existing matrix
-
nonSparseElementCount
public int nonSparseElementCount()
Description copied from class:ASparseVectorReturns the number of non-sparse elements in the sparse vector. This will be greater or equal to the number of non-zero elements- Specified by:
nonSparseElementCountin classASparseVector- Returns:
-
innerProduct
public AVector innerProduct(SparseRowMatrix m)
Overloaded implementation for SparseIndexedVector x SparseRowMatrix This is basically a weighted sum of rows!- Parameters:
m-- Returns:
-
innerProduct
public AVector innerProduct(SparseColumnMatrix m)
-
innerProduct
public AVector innerProduct(AMatrix m)
Description copied from class:AVectorComputes the inner product of this vector with a matrix- Overrides:
innerProductin classASparseIndexedVector- Returns:
- a vector representing the inner product
-
add
public void add(AVector v)
Description copied from class:AVectorAdds another vector to this one- Overrides:
addin classASparseVector
-
addMultiple
public void addMultiple(AVector v, double factor)
Description copied from class:AVectorAdds a scaled multiple of another vector to this vector- Overrides:
addMultiplein classASparseVector
-
addMultipleSparse
public void addMultipleSparse(AVector v, double factor)
Description copied from class:AVectorAdds a multiple of a source vector to the non-sparse elements of this vector only- Overrides:
addMultipleSparsein classAVector
-
addMultipleSparse
public void addMultipleSparse(ADenseArrayVector v, double factor)
Adds a multiple of the source array to the non-sparse elements of this array
-
addSparse
public void addSparse(double c)
Description copied from interface:INDArrayAdds to the non-sparse elements of this array
-
setSparse
public void setSparse(AVector v)
Description copied from class:AVectorSets the non-sparse elements of this vector to the corresponding elements of another vector
-
setSparse
public void setSparse(double v)
Description copied from interface:INDArraySets the non-sparse elements of this array to the specified value May throw an exception if non-sparse elements are not mutable
-
addMultipleSparse
public void addMultipleSparse(SparseIndexedVector v, double factor)
-
add
public void add(double[] src, int srcOffset)Description copied from class:AVectorAdds to this vector from a given double array.
-
add
public void add(ASparseVector v)
- Specified by:
addin classASparseVector
-
addMultiple
public void addMultiple(ASparseVector v, double factor)
-
addMultiple
public void addMultiple(SparseIndexedVector v, double factor)
Description copied from class:AVectorAdds a scaled multiple of a sparse indexed vector to this vector- Overrides:
addMultiplein classAVector
-
sub
public void sub(AVector v)
Description copied from class:AVectorSubtracts a vector from this vector
-
sub
public void sub(ASparseVector v)
-
multiply
public void multiply(double d)
Description copied from class:AVectorMultiplies the vector by a constant factor- Specified by:
multiplyin interfaceINDArray- Overrides:
multiplyin classASparseIndexedVector- Parameters:
d- Factor by which to multiply each component of the vector
-
pow
public void pow(double exponent)
Description copied from interface:INDArrayRaises all elements of the array to a specified power in place
-
square
public void square()
Description copied from interface:INDArraySquares all elements of the array in place
-
multiply
public void multiply(AVector v)
Description copied from class:AVectorMultiplies this vector by another vector, elementwise.
-
multiply
public void multiply(ASparseVector v)
-
multiplyCopy
public SparseIndexedVector multiplyCopy(double factor)
Description copied from interface:INDArrayReturns a copy of the array with all elements multiplied by a single constant value- Specified by:
multiplyCopyin interfaceINDArray- Overrides:
multiplyCopyin classAVector- Parameters:
factor- A scalar factor- Returns:
- A new array, with all element values scaled by the given factor
-
multiply
public void multiply(double[] array, int offset)Description copied from class:AVectorMultiplies the elements in this vector by corresponding elements in the target array
-
maxAbsElement
public double maxAbsElement()
Description copied from class:AVectorReturns the maximum absolute element value of a vector- Overrides:
maxAbsElementin classAVector- Returns:
-
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:
-
minElementIndex
public int minElementIndex()
Description copied from class:AVectorReturns the index of the minimum element of a vector- Overrides:
minElementIndexin classAVector
-
negate
public void negate()
Description copied from class:AVectorNegates all emlements of this vector in place.
-
applyOp
public void applyOp(Op op)
Description copied from interface:INDArrayApplies a unary operator to all elements of the array (in-place)
-
applyOp
public void applyOp(Op2 op, double d)
Description copied from interface:INDArrayApplies a binary operator to this array and a double value. Works as if the double value was broadcast to the shape of this array.
-
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 classASparseVector
-
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 classASparseVector
-
abs
public void abs()
Description copied from interface:INDArrayReplaces all elements of this array with their absolute values, according to Math.abs(double)
-
get
public double get(int i)
Description copied from interface:INDArrayReturns the double value at the specified position in a 1D vector
-
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
-
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.
-
setElements
public void setElements(double[] array, int offset)Description copied from interface:INDArraySets all elements in an array using the given double values- Specified by:
setElementsin interfaceINDArray- Overrides:
setElementsin classAVector- Parameters:
array- 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.
-
setElements
public void setElements(int pos, double[] array, 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- Overrides:
setElementsin classAVector- Parameters:
pos- Offset into this array, expressed in terms of number of elements in row major orderarray- 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.
-
set
public void set(AVector v)
Description copied from class:AVectorSets the vector to equal the value of another vector
-
set
public void set(ADenseArrayVector v)
Description copied from class:AVectorSets the vector equal to the value of an ADenseArrayVector
-
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
-
roundToZero
public ASparseVector roundToZero(double precision)
Description copied from class:ASparseVectorReturns a vector after replacing all elements with absolute values less-than-or-equal to precision with zeros. May return either this vector or a new vector. If this vector is return, it may have been mutated.- Overrides:
roundToZeroin classASparseVector- Returns:
-
nonSparseValues
public Vector nonSparseValues()
Description copied from interface:ISparseVectorReturns the non-sparse elements as a compacted vector. May or may not be a view.- Specified by:
nonSparseValuesin interfaceISparseVector- Specified by:
nonSparseValuesin classASparseVector- Returns:
-
nonSparseIndex
public Index nonSparseIndex()
Description copied from class:AVectorReturns an Index indicating which elements of this vector are defined as non-sparse. A sparse index must be zero. A non-sparse element may be zero, but is typically expected be non-zero.- Specified by:
nonSparseIndexin interfaceISparseVector- Specified by:
nonSparseIndexin classASparseVector- 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 classASparseVector
-
toVector
public Vector toVector()
Description copied from class:AVectorCoerces this vector to the standard dense Vector format. May return the same vector is this is already a dense Vector, otherwise returns a Vector containing a new clone of the vector elements.
-
toSparseIndexedVector
public SparseIndexedVector toSparseIndexedVector()
Description copied from interface:ISparseVectorCoerces this vector to a SparseIndexedVector. May return this vector if already a SparseIndexedVector- Specified by:
toSparseIndexedVectorin interfaceISparseVector- Overrides:
toSparseIndexedVectorin classASparseVector- Returns:
-
clone
public SparseIndexedVector clone()
Description copied from class:AVectorClones the vector, creating a new mutable copy of all data. The clone is: - not guaranteed to be of the same type. - guaranteed to be fully mutable - guaranteed not to contain a reference (i.e. is a full deep copy)
-
includeIndices
public void includeIndices(Index ixs)
Include additional indices in the non-sparse index set of this vector. Useful to improve performance if subsequent operations will access these indices.- Parameters:
ixs-
-
includeIndices
public void includeIndices(AVector v)
Include additional indices in the non-sparse index set of this vector. Useful to improve performance if subsequent operations will access these indices.- Parameters:
ixs-
-
includeIndices
public void includeIndices(ASparseIndexedVector v)
-
sparseClone
public SparseIndexedVector sparseClone()
Description copied from class:AVectorClones the vector into a sparse mutable format- Specified by:
sparseClonein interfaceINDArray- Overrides:
sparseClonein classAVector
-
exactClone
public SparseIndexedVector 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
-
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.
-
-
DMelt 3.0 © DataMelt by jWork.ORG