public final class SingleElementVector extends ASingleElementVector
indexlength| Constructor and Description |
|---|
SingleElementVector(int componentIndex,
int dimensions) |
SingleElementVector(int componentIndex,
int dimensions,
double value) |
| Modifier and Type | Method and Description |
|---|---|
void |
add(ASparseVector v) |
void |
addMultipleToArray(double factor,
int offset,
double[] array,
int arrayOffset,
int length)
Adds a multiple of a subvector of this vector into a double array at the specified offset
|
void |
addToArray(double[] array,
int offset,
int stride)
Adds this vector to a double[] array, using the specified offset and stride into the destination array
|
void |
addToArray(int offset,
double[] array,
int arrayOffset,
int length)
Adds a subvector of this vector into a double array at the specified offset
|
AVector |
applyOpCopy(Op op)
Applies a unary operator to all elements of the array (creating a new array)
|
static SingleElementVector |
create(double val,
int i,
int len) |
double |
density()
Computes the density ratio of this sparse array (proportion of non-zero elements)
|
double |
dotProduct(double[] data,
int offset)
Fast dot product with a double[] array.
|
double |
dotProduct(double[] data,
int offset,
int stride)
Fast dot product with a double[] array and a stride.
|
double |
elementAbsPowSum(double p)
Returns the sum of the absolute values of all the elements raised to a specified power
|
double |
elementMax()
Returns the maximum element value in this array.
|
double |
elementMin()
Returns the maximum element value in this array.
|
double |
elementPowSum(double p)
Returns the sum of all the elements raised to a specified power
|
double |
elementProduct()
Returns the product of all elements in the array.
|
double |
elementSquaredSum()
Returns the sum of squared elements in this array.
|
double |
elementSum()
Returns the sum of all elements in a vector
|
boolean |
equals(AVector v) |
boolean |
equalsArray(double[] data,
int offset)
Returns true if this vector exactly matches the elements in double[] array, starting
from the specified offset
|
SingleElementVector |
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
|
boolean |
hasUncountable()
Returns true if any element is this array is NaN or infinite
|
boolean |
includesIndex(int i)
Returns true iff the sparse vector contains the index i
|
AVector |
innerProduct(AMatrix a)
Computes the inner product of this vector with a matrix
|
boolean |
isElementConstrained()
Returns true if this array has some constraints on element values
|
boolean |
isFullyMutable()
Returns true if this vector is fully mutable, i.e.
|
boolean |
isMutable()
Returns true if this vector is mutable.
|
boolean |
isRangeZero(int start,
int length)
Returns true if a sub-vector range is completely zero.
|
boolean |
isZero()
Returns true if this vector is a zero vector (all components zero)
|
double |
magnitude()
Returns the magnitude (Euclidean length) of the vector
|
AVector |
multiplyCopy(double d)
Returns a copy of the array with all elements multiplied by a single constant value
|
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.
|
AVector |
nonSparseValues()
Returns the non-sparse elements as a compacted vector
|
int[] |
nonZeroIndices()
Return an int array specifying the positions in this vector which are non-zero
|
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.
|
void |
set(int i,
double value)
Sets a value at a given position in a mutable 1D array
|
AScalar |
slice(int i)
Returns the specified major slice of this array as a view (slice along dimension 0)
0 dimensional slice results are permitted, but attempting to slice a 0 dimensional array
will result in an error.
|
SparseIndexedVector |
sparseClone()
Clones the vector into a sparse mutable format
|
AVector |
subVector(int offset,
int length)
Obtains a sub-vector view that refers to this vector.
|
AVector |
tryEfficientJoin(AVector a)
Attempts to perform an efficient join with a second vector.
|
double |
unsafeGet(int i) |
protected double |
value() |
dotProduct, indexadd, addMultiple, clone, copyTo, copyTo, distanceL1, distanceLinf, distanceSquared, dotProduct, equals, getSlices, isSparse, isView, nonZeroCount, reduceSlices, roundToZero, sparse, toDoubleArray, toSparseIndexedVectorcheckIndex, checkLength, checkRange, checkSameLength, checkSameLength, elementCount, equalsArray, get, getShape, getShapeClone, isSameShape, length, sliceCountabs, absCopy, add, add, add, add, add, add, add, add, addAt, addAt, addCopy, addCopy, addCopy, addInnerProduct, addInnerProduct, addInnerProduct, addMultiple, addMultiple, addMultiple, addMultiple, addMultiple, addMultiple, addMultiple, addMultipleCopy, addMultipleToArray, addPower, addPower, addPower, addProduct, addProduct, addProduct, addProductCopy, addProductCopy, addProductToArray, addProductToArray, addToArray, addWeighted, angle, applyOp, applyOp, applyOp, applyOp, applyOp, asDoubleArray, asElementList, asVector, broadcast, broadcastLike, broadcastLike, broadcastLike, checkDimension, checkSameLength, clamp, clampMax, clampMin, compareTo, copy, copyTo, copyTo, copyTo, crossProduct, crossProduct, dense, denseClone, dimensionality, distance, divide, divide, divide, divide, divideCopy, divideCopy, divideTo, dotProduct, elementIterator, elementsEqual, epsilonEquals, epsilonEquals, epsilonEquals, epsilonEquals, equals, equals, fill, fillRange, get, get, get, get, getElements, getElements, getElements, getLongShape, getShape, getTranspose, getTransposeCopy, getTransposeView, hashCode, immutable, innerProduct, innerProduct, innerProduct, innerProduct, innerProduct, interpolate, isSameShape, isUnitLengthVector, isUnitLengthVector, iterator, join, join, join, log, logistic, magnitudeSquared, maxAbsElement, maxAbsElementIndex, maxElement, maxElementIndex, minElement, minElementIndex, multiply, multiply, multiply, multiply, multiply, multiplyCopy, multiplyCopy, multiplyTo, mutable, negate, negateCopy, nonZeroValues, normalise, normaliseCopy, normaliseMaxAbsElement, outerProduct, outerProduct, pow, 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, set, set, setElements, setElements, setElements, setInnerProduct, setInnerProduct, setInnerProduct, setMultiple, setMultiple, setMultiple, setMultiple, shiftCopy, signum, slice, sliceValue, softmax, softmaxCopy, sqrtCopy, square, squareCopy, sub, sub, subArray, subAt, subCopy, subCopy, subMultiple, tanh, toDoubleBuffer, toList, toNormal, toSliceArray, toString, toStringFull, toVector, unsafeSet, validateadd, addInnerProduct, addInnerProduct, addOuterProduct, broadcastCloneLike, broadcastCopyLike, checkMutable, componentCount, 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, subCopyabs, absCopy, add, add, addAt, addCopy, addCopy, addInnerProduct, addMultiple, addOuterProduct, addPower, addPower, addToArray, applyOp, applyOp, applyOp, applyOp, asDoubleArray, asElementList, asVector, broadcast, broadcastCloneLike, broadcastCopyLike, broadcastLike, broadcastLike, broadcastLike, checkMutable, clamp, componentCount, copy, dense, denseClone, dimensionality, divide, divide, divideCopy, elementCount, elementIterator, elementsEqual, ensureMutable, epsilonEquals, epsilonEquals, equals, equalsArray, exp, fill, get, get, get, get, get, get, get, get, getComponent, getComponents, getElements, getElements, getElements, getElements, getLongShape, getShape, getShape, getShapeClone, getSlices, getSliceViews, getTranspose, getTransposeCopy, getTransposeView, immutable, innerProduct, innerProduct, innerProduct, innerProduct, isBoolean, isDense, isSameShape, join, join, log, multiply, multiply, multiplyCopy, mutable, negate, negateCopy, outerProduct, pow, reciprocal, reciprocalCopy, reduceSlices, reorder, reorder, reshape, rotateView, scale, scaleAdd, scaleAdd, scaleCopy, set, set, set, set, set, set, setElements, setElements, setElements, setInnerProduct, setMultiple, setMultiple, signum, signumCopy, slice, sliceCount, sliceValue, sqrt, square, squareCopy, sub, sub, subArray, subCopy, toArray, toDoubleBuffer, toSliceArray, toVector, validate, withComponentsforEach, spliteratorpublic SingleElementVector(int componentIndex,
int dimensions)
public SingleElementVector(int componentIndex,
int dimensions,
double value)
public static SingleElementVector create(double val, int i, int len)
public boolean isZero()
AVectorisZero in interface INDArrayisZero in class ASparseVectorpublic boolean isRangeZero(int start,
int length)
AVectorisRangeZero in class AVectorpublic double magnitude()
AVectorpublic double elementSum()
AVectorelementSum in interface INDArrayelementSum in class ASparseVectorpublic double elementProduct()
INDArrayelementProduct in interface INDArrayelementProduct in class ASparseVectorpublic double elementMax()
INDArrayelementMax in interface INDArrayelementMax in class AVectorpublic double elementMin()
INDArrayelementMin in interface INDArrayelementMin in class AVectorpublic double elementSquaredSum()
INDArrayelementSquaredSum in interface INDArrayelementSquaredSum in class ASparseVectorpublic boolean isFullyMutable()
AVectorisFullyMutable in interface INDArrayisFullyMutable in class AVectorpublic boolean isMutable()
AVectorpublic boolean isElementConstrained()
INDArrayisElementConstrained in interface INDArrayisElementConstrained in class AVectorpublic double density()
ISparsedensity in interface ISparsedensity in class AbstractArray<Double>public double get(int i)
INDArraypublic void set(int i,
double value)
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 AVector applyOpCopy(Op op)
INDArrayapplyOpCopy in interface INDArrayapplyOpCopy in class AVectorpublic void addToArray(int offset,
double[] array,
int arrayOffset,
int length)
AVectoraddToArray in class AVectorpublic void addToArray(double[] array,
int offset,
int stride)
AVectoraddToArray in class AVectorpublic void addMultipleToArray(double factor,
int offset,
double[] array,
int arrayOffset,
int length)
AVectoraddMultipleToArray in class AVectorpublic final AScalar slice(int i)
INDArraypublic AVector subVector(int offset, int length)
AVectorpublic AVector tryEfficientJoin(AVector a)
AVectortryEfficientJoin in class AVectorpublic AVector multiplyCopy(double d)
INDArraymultiplyCopy in interface INDArraymultiplyCopy in class AVectord - A scalar factorpublic AVector innerProduct(AMatrix a)
AVectorinnerProduct in class ASparseVectorpublic SingleElementVector exactClone()
AVectorexactClone in interface INDArrayexactClone in class AVectorpublic SparseIndexedVector sparseClone()
AVectorsparseClone in interface INDArraysparseClone in class AVectorpublic boolean equalsArray(double[] data,
int offset)
AVectorequalsArray in interface INDArrayequalsArray in class ASizedVectordata - Array of double element values to check for equalityoffset - Offset into the data arraypublic boolean equals(AVector v)
equals in class ASingleElementVectorpublic int nonSparseElementCount()
ASparseVectornonSparseElementCount in class ASingleElementVectorpublic AVector nonSparseValues()
ISparseVectornonSparseValues in interface ISparseVectornonSparseValues in class ASingleElementVectorpublic Index nonSparseIndex()
AVectornonSparseIndex in interface ISparseVectornonSparseIndex in class ASingleElementVectorpublic int[] nonZeroIndices()
AVectornonZeroIndices in class ASingleElementVectorpublic boolean includesIndex(int i)
ASparseVectorincludesIndex in class ASparseVectorpublic void add(ASparseVector v)
add in class ASparseVectorpublic boolean hasUncountable()
AbstractArrayhasUncountable in interface INDArrayhasUncountable in class ASparseVectorpublic double elementPowSum(double p)
elementPowSum in interface INDArrayelementPowSum in class ASparseVectorpublic double elementAbsPowSum(double p)
elementAbsPowSum in interface INDArrayelementAbsPowSum in class ASparseVectorpublic double dotProduct(double[] data,
int offset)
AVectordotProduct in class ASingleElementVectorpublic double dotProduct(double[] data,
int offset,
int stride)
AVectordotProduct in class AVectorprotected double value()
value in class ASingleElementVectorCopyright © 2016. All rights reserved.