public class ImmutableVector extends AStridedVector implements IDense
| Modifier and Type | Field and Description |
|---|---|
int |
offset |
datalength| Modifier and Type | Method and Description |
|---|---|
void |
addAt(int i,
double v)
Adds a value to a specific element of the vector
This function does not perform bounds checking, i.e.
|
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)
Adds this vector to a double[] array, starting at the specified offset.
|
void |
addToArray(int offset,
double[] array,
int arrayOffset,
int length)
Adds a subvector of this vector into a double array at the specified offset
|
void |
applyOp(Op op)
Applies a unary operator to all elements of the array (in-place)
|
Vector |
clone()
Clones the vector, creating a new mutable copy of all data.
|
void |
copyTo(int offset,
double[] dest,
int destOffset,
int length)
Copies a subset of this vector to a specified destination array offset
|
static ImmutableVector |
create(AVector v)
Create an ImmutableVector with a copy of the elements in the source vector
|
static ImmutableVector |
create(double[] data) |
void |
divideTo(double[] data,
int offset)
Divides the elements in the target array by corresponding elements in this vector
|
double |
dotProduct(AVector v)
Returns the dot product of this vector with another vector
The vectors must have the same length: if not the result is undefined
|
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 |
elementSquaredSum()
Returns the sum of squared elements in this array.
|
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
|
AVector |
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
|
int |
getArrayOffset()
Gets the offset into the underlying double[] data array for the first element of this vector
|
void |
getElements(double[] data,
int offset)
Gets all elements of the array, copying them into a double array at the specified offset
|
int |
getStride()
Gets the stride of this strided vector.
|
int |
hashCode()
Computes the hashcode of a vector.
|
AVector |
immutable()
Creates an immutable copy of a vector
|
protected int |
index(int i)
Computes an index into the underlying array for a given vector index
|
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 |
isView()
Returns true if this vector is of a view type that references other vectors / data.
|
boolean |
isZero()
Returns true if this vector is a zero vector (all components zero)
|
Iterator<Double> |
iterator() |
void |
multiplyTo(double[] data,
int offset)
Multiplies the elements in the target array by corresponding elements in this vector
|
static ImmutableVector |
of(double... data) |
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[] values,
int offset)
Sets all elements in an array using the given double values
|
void |
setElements(int pos,
double[] values,
int offset,
int length)
Sets elements in an array using the given double values.
|
ImmutableScalar |
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.
|
AVector |
sparse()
Coerces this INDArray to a sparse format, without changing its element values.
|
AVector |
subVector(int start,
int length)
Obtains a sub-vector view that refers to this vector.
|
double[] |
toDoubleArray()
Copies the elements of this array to a new double[] array.
|
void |
toDoubleBuffer(DoubleBuffer dest)
Copies the elements of this INDArray to the specified double buffer
|
double |
unsafeGet(int i) |
void |
unsafeSet(int i,
double value) |
void |
validate()
Validates the internal data structure of the INDArray.
|
static ImmutableVector |
wrap(double[] data)
Wraps the given double array as an ImmutableVector.
|
static ImmutableVector |
wrap(double[] data,
int offset,
int length) |
static ImmutableVector |
wrap(Vector source) |
add, addToArray, applyOpCopy, asDoubleArray, broadcast, broadcastLike, copyTo, elementMax, elementMin, elementProduct, elementSum, ensureMutable, getArray, getElements, getStride, getStrides, hasUncountable, isPackedArray, reduce, reduce, selectViewcheckIndex, checkLength, checkRange, checkSameLength, checkSameLength, elementCount, equalsArray, get, getShape, getShapeClone, isSameShape, length, sliceCountabs, absCopy, add, add, add, add, add, add, add, add, addAt, addCopy, addCopy, addCopy, addInnerProduct, addInnerProduct, addInnerProduct, addMultiple, addMultiple, addMultiple, addMultiple, addMultiple, addMultiple, addMultiple, addMultiple, addMultipleCopy, addMultipleToArray, addPower, addPower, addPower, addProduct, addProduct, addProduct, addProductCopy, addProductCopy, addProductToArray, addProductToArray, addWeighted, angle, applyOp, applyOp, applyOp, applyOp, asElementList, asVector, broadcastLike, broadcastLike, checkDimension, checkSameLength, clamp, clampMax, clampMin, compareTo, copy, copyTo, copyTo, copyTo, crossProduct, crossProduct, dense, denseClone, dimensionality, distance, distanceL1, distanceLinf, distanceSquared, divide, divide, divide, divide, divideCopy, divideCopy, dotProduct, dotProduct, elementAbsPowSum, elementIterator, elementPowSum, elementsEqual, epsilonEquals, epsilonEquals, epsilonEquals, epsilonEquals, equals, equals, fill, fillRange, get, get, get, get, getElements, getLongShape, getShape, getSlices, getTranspose, getTransposeCopy, getTransposeView, innerProduct, innerProduct, innerProduct, innerProduct, innerProduct, innerProduct, interpolate, isElementConstrained, isSameShape, isUnitLengthVector, isUnitLengthVector, join, join, join, log, logistic, magnitude, magnitudeSquared, maxAbsElement, maxAbsElementIndex, maxElement, maxElementIndex, minElement, minElementIndex, multiply, multiply, multiply, multiply, multiply, multiplyCopy, multiplyCopy, multiplyCopy, mutable, negate, negateCopy, nonSparseIndex, nonZeroCount, nonZeroIndices, nonZeroValues, normalise, normaliseCopy, normaliseMaxAbsElement, outerProduct, outerProduct, pow, projectToPlane, 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, setElements, setInnerProduct, setInnerProduct, setInnerProduct, setMultiple, setMultiple, setMultiple, setMultiple, shiftCopy, signum, slice, sliceValue, softmax, softmaxCopy, sparseClone, sqrtCopy, square, squareCopy, sub, sub, subArray, subAt, subCopy, subCopy, subMultiple, tanh, toList, toNormal, toSliceArray, toString, toStringFull, toVector, tryEfficientJoinadd, addInnerProduct, addInnerProduct, addOuterProduct, broadcastCloneLike, broadcastCopyLike, checkMutable, componentCount, density, exp, get, get, get, getComponent, getComponents, getElements, getElements, getSlices, getSliceViews, isBoolean, isDense, isSparse, reciprocal, reciprocalCopy, scale, set, set, signumCopy, sqrt, sub, sub, toArray, withComponentsfinalize, getClass, notify, notifyAll, wait, wait, waitabs, absCopy, add, add, addAt, addCopy, addCopy, addInnerProduct, addMultiple, addOuterProduct, addPower, addPower, applyOp, applyOp, applyOp, asElementList, asVector, broadcastCloneLike, broadcastCopyLike, broadcastLike, broadcastLike, checkMutable, clamp, componentCount, copy, dense, denseClone, dimensionality, divide, divide, divideCopy, elementAbsPowSum, elementCount, elementIterator, elementPowSum, elementsEqual, epsilonEquals, epsilonEquals, equals, equalsArray, exp, fill, get, get, get, get, get, get, get, get, getComponent, getComponents, getElements, getElements, getElements, getLongShape, getShape, getShape, getShapeClone, getSlices, getSlices, getSliceViews, getTranspose, getTransposeCopy, getTransposeView, innerProduct, innerProduct, innerProduct, innerProduct, isBoolean, isDense, isElementConstrained, isSameShape, isSparse, join, join, log, multiply, 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, setElements, setInnerProduct, setMultiple, setMultiple, signum, signumCopy, slice, sliceCount, sliceValue, sparseClone, sqrt, square, squareCopy, sub, sub, subArray, subCopy, toArray, toSliceArray, toVector, withComponentsforEach, spliteratorpublic static ImmutableVector of(double... data)
public static ImmutableVector create(double[] data)
public static ImmutableVector create(AVector v)
v - public static ImmutableVector wrap(double[] data)
data - public static ImmutableVector wrap(double[] data, int offset, int length)
public static ImmutableVector wrap(Vector source)
public boolean isMutable()
AVectorpublic boolean isFullyMutable()
AVectorisFullyMutable in interface INDArrayisFullyMutable in class AVectorpublic boolean isView()
AVectorpublic boolean isZero()
AVectorpublic boolean isRangeZero(int start,
int length)
AVectorisRangeZero in class AStridedVectorpublic final ImmutableScalar slice(int i)
INDArrayslice in interface INDArrayslice in class AArrayVectorpublic AVector subVector(int start, int length)
AVectorpublic void toDoubleBuffer(DoubleBuffer dest)
INDArraytoDoubleBuffer in interface INDArraytoDoubleBuffer in class AVectorpublic double[] toDoubleArray()
INDArraytoDoubleArray in interface INDArraytoDoubleArray in class AVectorpublic void getElements(double[] data,
int offset)
INDArraygetElements in interface INDArraygetElements in class AStridedVectorpublic void copyTo(int offset,
double[] dest,
int destOffset,
int length)
AVectorpublic void multiplyTo(double[] data,
int offset)
AVectormultiplyTo in class AVectoroffset - The offset into the target arraypublic void addToArray(double[] array,
int offset)
AVectoraddToArray in interface INDArrayaddToArray in class AVectorpublic void addToArray(int offset,
double[] array,
int arrayOffset,
int length)
AVectoraddToArray in class AStridedVectorpublic void addMultipleToArray(double factor,
int offset,
double[] array,
int arrayOffset,
int length)
AVectoraddMultipleToArray in class AStridedVectorpublic void divideTo(double[] data,
int offset)
AVectorpublic double dotProduct(double[] data,
int offset)
AVectordotProduct in class AStridedVectorpublic double dotProduct(double[] data,
int offset,
int stride)
AVectordotProduct in class AVectorpublic double dotProduct(AVector v)
AVectordotProduct in class AStridedVectorpublic double elementSquaredSum()
INDArrayelementSquaredSum in interface INDArrayelementSquaredSum in class AStridedVectorpublic double get(int i)
INDArraypublic void set(int i,
double value)
INDArraypublic void addAt(int i,
double v)
AVectoraddAt in class AStridedVectorpublic Iterator<Double> iterator()
iterator in interface Iterable<Double>iterator in class AStridedVectorpublic int hashCode()
AVectorpublic boolean equalsArray(double[] data,
int offset)
AVectorequalsArray in interface INDArrayequalsArray in class AStridedVectordata - Array of double element values to check for equalityoffset - Offset into the data arraypublic Vector clone()
AVectorpublic AVector sparse()
INDArraypublic AVector exactClone()
AVectorexactClone in interface INDArrayexactClone in class AVectorpublic AVector immutable()
AVectorpublic void validate()
INDArrayvalidate in interface INDArrayvalidate in class AStridedVectorprotected int index(int i)
AArrayVectorindex in class AArrayVectorpublic int getArrayOffset()
AStridedVectorgetArrayOffset in interface IStridedArraygetArrayOffset in class AStridedVectorpublic int getStride()
AStridedVectorgetStride in class AStridedVectorpublic void set(AVector v)
AVectorset in class AStridedVectorpublic void setElements(double[] values,
int offset)
INDArraysetElements in interface INDArraysetElements in class AStridedVectorvalues - 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[] values,
int offset,
int length)
INDArraysetElements in interface INDArraysetElements in class AStridedVectorpos - Offset into this array, expressed in terms of number of elements in row major ordervalues - 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.Copyright © 2016. All rights reserved.