public class SparseIndexedVector extends ASparseIndexedVector
length| Modifier and Type | Method and Description |
|---|---|
void |
abs()
Replaces all elements of this array with their absolute values, according to Math.abs(double)
|
void |
add(ASparseVector v) |
void |
add(AVector v)
Adds another vector to this one
|
void |
add(double[] src,
int srcOffset)
Adds to this vector from a given double array.
|
void |
addAt(int i,
double value)
Adds a value to a specific element of the vector
This function does not perform bounds checking, i.e.
|
void |
addMultiple(ASparseVector v,
double factor) |
void |
addMultiple(AVector v,
double factor)
Adds a scaled multiple of another vector to this vector
|
void |
addMultiple(SparseIndexedVector v,
double factor)
Adds a scaled multiple of a sparse indexed vector to this vector
|
void |
applyOp(Op op)
Applies a unary operator to all elements of the array (in-place)
|
void |
applyOp(Op2 op,
double d)
Applies a binary operator to this array and a double value.
|
SparseIndexedVector |
clone()
Clones the vector, creating a new mutable copy of all data.
|
static SparseIndexedVector |
create(ASparseVector source) |
static SparseIndexedVector |
create(AVector source)
Creates a SparseIndexedVector from the given vector, ignoring the zeros
in the source.
|
static SparseIndexedVector |
create(double[] values)
Creates a SparseIndexedVector from an array of double values
|
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
|
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
|
static SparseIndexedVector |
create(Iterable<?> iterable)
Creates a SparseIndexedVector from the specified Iterable object
|
static SparseIndexedVector |
create(Iterator<?> iterator)
Creates a SparseIndexedVector from the specified Iterator object
|
static SparseIndexedVector |
create(Object o)
Creates a SparseIndexedVector from the source object
|
static SparseIndexedVector |
create(Object[] values)
Creates a SparseIndexedVector from the source object array
|
static SparseIndexedVector |
create(SparseHashedVector source) |
static AVector |
createFromRow(AMatrix m,
int row)
Creates a SparseIndexedVector from a row of an existing matrix
|
static SparseIndexedVector |
createLength(int length) |
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.
|
SparseIndexedVector |
exactClone()
Returns an exact clone of this vector, i.e.
|
double |
get(int i)
Returns the double value at the specified position in a 1D vector
|
AVector |
immutable()
Creates an immutable copy of a vector
|
void |
includeIndices(ASparseIndexedVector v) |
void |
includeIndices(AVector v)
Include additional indices in the non-sparse index set of this vector.
|
void |
includeIndices(Index ixs)
Include additional indices in the non-sparse index set of this vector.
|
protected void |
includeIndices(int[] ixs)
Include additional indices in the non-sparse index set of this vector.
|
AVector |
innerProduct(AMatrix m)
Computes the inner product of this vector with a matrix
|
AVector |
innerProduct(SparseColumnMatrix m) |
AVector |
innerProduct(SparseRowMatrix m) |
boolean |
isFullyMutable()
Returns true if this vector is fully mutable, i.e.
|
boolean |
isMutable()
Returns true if this vector is mutable.
|
double |
maxAbsElement()
Returns the maximum absolute element value of a vector
|
int |
maxAbsElementIndex()
Returns the index of the maximum absolute element of a vector
|
int |
maxElementIndex()
Returns the index of the maximum element of a vector
|
int |
minElementIndex()
Returns the index of the minimum element of a vector
|
void |
multiply(ADenseArrayVector v) |
void |
multiply(ASparseVector v) |
void |
multiply(AVector v) |
void |
multiply(double d)
Multiplies the vector by a constant factor
|
void |
multiply(double[] array,
int offset)
Multiplies the elements in this vector by corresponding elements in the target array
|
SparseIndexedVector |
multiplyCopy(double factor)
Returns a copy of the array with all elements multiplied by a single constant value
|
void |
negate()
Negates all emlements of this vector in place.
|
int |
nonSparseElementCount()
Returns the number of non-sparse elements in the sparse vector.
|
Index |
nonSparseIndex()
Returns an Index indicating which elements of this vector are defined as non-sparse.
|
Vector |
nonSparseValues()
Returns the non-sparse elements as a compacted vector
|
void |
pow(double exponent)
Raises all elements of the array to a specified power in place
|
double |
reduce(Op2 op)
Reduces over all elements of the array in row-major order.
|
double |
reduce(Op2 op,
double init)
Reduces over all elements of the array in row-major order.
|
ASparseVector |
roundToZero(double precision)
Returns a vector after replacing all elements with absolute values less-than-or-equal to precision with zeros.
|
void |
set(ADenseArrayVector v)
Sets the vector equal to the value of an ADenseArrayVector
|
void |
set(AVector v)
Sets the vector to equal the value of another vector
|
void |
set(int i,
double value)
Sets a value at a given position in a mutable 1D array
|
void |
setElements(double[] array,
int offset)
Sets all elements in an array using the given double values
|
void |
setElements(int pos,
double[] array,
int offset,
int length)
Sets elements in an array using the given double values.
|
SparseIndexedVector |
sparseClone()
Clones the vector into a sparse mutable format
|
void |
square()
Squares all elements of the array in place
|
void |
sub(ASparseVector v) |
void |
sub(AVector v)
Subtracts a vector from this vector
|
SparseIndexedVector |
toSparseIndexedVector()
Coerces this vector to a SparseIndexedVector.
|
Vector |
toVector()
Coerces this vector to the standard dense Vector format.
|
double |
unsafeGet(int i) |
void |
unsafeSet(int i,
double value) |
void |
validate()
Validates the internal data structure of the INDArray.
|
static SparseIndexedVector |
wrap(int length,
Index index,
double[] data)
Creates a SparseIndexedVector with the specified index and data values.
|
static SparseIndexedVector |
wrap(int length,
int[] indices,
double[] data)
Creates a SparseIndexedVector with the specified index and data values.
|
addMultipleToArray, addProductToArray, addProductToArray, addToArray, addToArray, addToArray, cloneIncludingIndices, copySparseValuesTo, copyTo, dotProduct, dotProduct, dotProduct, dotProduct, elementSquaredSum, elementSum, equals, equalsArray, getElements, includesIndex, isRangeZero, isZero, nonZeroCount, nonZeroIndicescopyTo, copyTo, distanceL1, distanceLinf, distanceSquared, dotProduct, elementAbsPowSum, elementPowSum, elementProduct, equals, getSlices, hasUncountable, isSparse, isView, reduceSlices, sparse, toDoubleArraycheckIndex, checkLength, checkRange, checkSameLength, checkSameLength, elementCount, equalsArray, get, getShape, getShapeClone, isSameShape, length, sliceCountabsCopy, add, add, add, add, add, add, add, addAt, addCopy, addCopy, addCopy, addInnerProduct, addInnerProduct, addInnerProduct, addMultiple, addMultiple, addMultiple, addMultiple, addMultiple, addMultiple, addMultipleCopy, addMultipleToArray, addPower, addPower, addPower, addProduct, addProduct, addProduct, addProductCopy, addProductCopy, addWeighted, angle, applyOp, applyOp, applyOp, applyOpCopy, asDoubleArray, asElementList, asVector, broadcast, broadcastLike, broadcastLike, broadcastLike, checkDimension, checkSameLength, clamp, clampMax, clampMin, compareTo, copy, copyTo, copyTo, crossProduct, crossProduct, dense, denseClone, dimensionality, distance, divide, divide, divide, divide, divideCopy, divideCopy, divideTo, dotProduct, elementIterator, elementMax, elementMin, elementsEqual, epsilonEquals, epsilonEquals, epsilonEquals, epsilonEquals, equals, equals, fill, fillRange, get, get, get, get, 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, multiplyCopy, multiplyCopy, multiplyTo, mutable, negateCopy, nonZeroValues, normalise, normaliseCopy, normaliseMaxAbsElement, outerProduct, outerProduct, projectToPlane, 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, setElements, setInnerProduct, setInnerProduct, setInnerProduct, setMultiple, setMultiple, setMultiple, setMultiple, shiftCopy, signum, slice, slice, sliceValue, softmax, softmaxCopy, sqrtCopy, squareCopy, sub, subArray, subAt, subCopy, subCopy, subMultiple, subVector, tanh, toDoubleBuffer, toList, toNormal, toSliceArray, toString, toStringFull, tryEfficientJoinadd, addInnerProduct, addInnerProduct, addOuterProduct, broadcastCloneLike, broadcastCopyLike, checkMutable, componentCount, density, ensureMutable, exp, get, get, get, getComponent, getComponents, getElements, getElements, getSlices, getSliceViews, isBoolean, isDense, reciprocal, reciprocalCopy, scale, set, set, signumCopy, sqrt, sub, sub, toArray, withComponentsfinalize, getClass, notify, notifyAll, wait, wait, waitaddCopy, divideCopy, epsilonEquals, isSameShape, length, multiplyCopy, normalise, normaliseCopy, rotateCopy, rotateView, shiftCopy, sqrtCopy, subCopyabsCopy, add, add, addAt, addCopy, addCopy, addInnerProduct, addMultiple, addOuterProduct, addPower, addPower, applyOp, applyOp, applyOpCopy, asDoubleArray, asElementList, asVector, broadcast, broadcastCloneLike, broadcastCopyLike, broadcastLike, broadcastLike, broadcastLike, checkMutable, clamp, componentCount, copy, dense, denseClone, dimensionality, divide, divide, divideCopy, elementCount, elementIterator, elementMax, elementMin, elementsEqual, ensureMutable, epsilonEquals, epsilonEquals, equals, equalsArray, exp, fill, get, get, get, get, get, get, get, get, getComponent, getComponents, 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, setElements, setInnerProduct, setMultiple, setMultiple, signum, signumCopy, slice, slice, sliceCount, sliceValue, sqrt, squareCopy, sub, sub, subArray, subCopy, toArray, toDoubleBuffer, toSliceArray, withComponentsforEach, spliteratorpublic static SparseIndexedVector wrap(int length, Index index, double[] data)
public static SparseIndexedVector wrap(int length, int[] indices, double[] data)
public static SparseIndexedVector create(int length, Index index, double[] data)
public static AVector createWithIndices(AVector v, int[] ixs)
v - ixs - public static SparseIndexedVector createLength(int length)
public static SparseIndexedVector create(int length, Index index, AVector data)
public static SparseIndexedVector create(Object o)
o - public static SparseIndexedVector create(double[] values)
o - public static SparseIndexedVector create(Object[] values)
o - public static SparseIndexedVector create(AVector source)
public static SparseIndexedVector create(ASparseVector source)
public static SparseIndexedVector create(SparseHashedVector source)
public static SparseIndexedVector create(Iterable<?> iterable)
iterable - An Iterable containing java.lang.Number instancespublic static SparseIndexedVector create(Iterator<?> iterator)
iterator - An Iterator over java.lang.Number instancespublic static AVector createFromRow(AMatrix m, int row)
public int nonSparseElementCount()
ASparseVectornonSparseElementCount in class ASparseVectorpublic AVector innerProduct(SparseRowMatrix m)
public AVector innerProduct(SparseColumnMatrix m)
public AVector innerProduct(AMatrix m)
AVectorinnerProduct in class ASparseIndexedVectorpublic void add(AVector v)
AVectoradd in class ASparseVectorpublic void addMultiple(AVector v, double factor)
AVectoraddMultiple in class ASparseVectorpublic void add(double[] src,
int srcOffset)
AVectorpublic void add(ASparseVector v)
add in class ASparseVectorpublic void addMultiple(ASparseVector v, double factor)
public void addMultiple(SparseIndexedVector v, double factor)
AVectoraddMultiple in class AVectorpublic void sub(AVector v)
AVectorpublic void sub(ASparseVector v)
public void multiply(double d)
AVectormultiply in interface INDArraymultiply in class ASparseIndexedVectord - Factor by which to multiply each component of the vectorpublic void pow(double exponent)
INDArraypublic void square()
INDArraypublic void multiply(ASparseVector v)
public void multiply(ADenseArrayVector v)
public SparseIndexedVector multiplyCopy(double factor)
INDArraymultiplyCopy in interface INDArraymultiplyCopy in class AVectorfactor - A scalar factorpublic void multiply(double[] array,
int offset)
AVectorpublic double maxAbsElement()
AVectormaxAbsElement in class AVectorpublic int maxElementIndex()
AVectormaxElementIndex in class AVectorpublic int maxAbsElementIndex()
AVectormaxAbsElementIndex in class AVectorpublic int minElementIndex()
AVectorminElementIndex in class AVectorpublic void negate()
AVectorpublic void applyOp(Op op)
INDArraypublic void applyOp(Op2 op, double d)
INDArraypublic double reduce(Op2 op, double init)
INDArrayreduce in interface INDArrayreduce in class ASparseVectorpublic double reduce(Op2 op)
INDArrayreduce in interface INDArrayreduce in class ASparseVectorpublic void abs()
INDArraypublic double get(int i)
INDArraypublic boolean isFullyMutable()
AVectorisFullyMutable in interface INDArrayisFullyMutable in class AVectorpublic boolean isMutable()
AVectorpublic void setElements(double[] array,
int offset)
INDArraysetElements in interface INDArraysetElements in class AVectorarray - 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.public void setElements(int pos,
double[] array,
int offset,
int length)
INDArraysetElements in interface INDArraysetElements in class AVectorpos - 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.public void set(AVector v)
AVectorpublic void set(ADenseArrayVector v)
AVectorpublic void set(int i,
double value)
INDArraypublic void addAt(int i,
double value)
AVectorpublic ASparseVector roundToZero(double precision)
ASparseVectorroundToZero in class ASparseVectorpublic Vector nonSparseValues()
ISparseVectornonSparseValues in interface ISparseVectornonSparseValues in class ASparseVectorpublic Index nonSparseIndex()
AVectornonSparseIndex in interface ISparseVectornonSparseIndex in class ASparseVectorpublic Vector toVector()
AVectorpublic SparseIndexedVector toSparseIndexedVector()
ISparseVectortoSparseIndexedVector in interface ISparseVectortoSparseIndexedVector in class ASparseVectorpublic SparseIndexedVector clone()
AVectorprotected void includeIndices(int[] ixs)
ixs - public void includeIndices(Index ixs)
ixs - public void includeIndices(AVector v)
ixs - public void includeIndices(ASparseIndexedVector v)
public SparseIndexedVector sparseClone()
AVectorsparseClone in interface INDArraysparseClone in class AVectorpublic SparseIndexedVector exactClone()
AVectorexactClone in interface INDArrayexactClone in class AVectorpublic void validate()
INDArrayCopyright © 2016. All rights reserved.