public final class Vector extends AArrayVector
| Modifier and Type | Field and Description |
|---|---|
double[] |
data |
| Constructor and Description |
|---|
Vector(AVector source)
Copy constructor from an arbitrary vector
|
| Modifier and Type | Method and Description |
|---|---|
void |
abs()
Sets each component of the vector to its absolute value
|
void |
add(AArrayVector src,
int srcOffset) |
void |
add(AVector v)
Adds another vector to this one
|
void |
add(double constant)
Adds a double value to all elements in this array
|
void |
add(Vector v) |
void |
addAt(int i,
double v)
Adds a value to a specific element of the vector
This function does not perform bounds checking
|
void |
addMultiple(AArrayVector v,
double factor) |
void |
addMultiple(AVector v,
double factor)
Adds a scaled multiple of another vector to this one
|
void |
addMultiple(Index destToSource,
Vector source,
double factor)
Adds to this vector at taking values from source at the specified indexes which should map from this->source
|
void |
addMultiple(Vector source,
Index index,
double factor)
Adds source vector to this vector at the specified indexes which should map from source->this
|
void |
addProduct(AVector a,
AVector b) |
void |
addProduct(Vector a,
Vector b) |
void |
addProduct(Vector a,
Vector b,
double factor) |
void |
addWeighted(AArrayVector v,
double factor) |
void |
addWeighted(AVector v,
double factor)
Updates a weighted average of this vector with another vector
|
void |
applyOp(Op op)
Applies a unary operator to all elements of the array (in-place)
|
double[] |
asDoubleArray()
Returns the underlying double array representing the packed elements of this array
Returns nil if there is no such underlying array
|
void |
clamp(double min,
double max)
Clamps all values in the vector to a given range
|
Vector |
clone()
Clones the vector, creating a new mutable copy of all data.
|
static Vector |
create(AIndex a) |
static Vector |
create(AVector a) |
static Vector |
create(double[] data) |
static Vector |
createFromVector(AVector source,
int length)
Creates a new vector using the elements in the specified vector.
|
static Vector |
createLength(int length)
Create an empty (zero-filled) vector of a specified length
|
double |
distance(AVector v) |
double |
distance(Vector v) |
double |
distanceSquared(Vector v) |
double |
dotProduct(AVector v) |
double |
dotProduct(AVector v,
Index ix) |
double |
dotProduct(double[] data,
int offset)
Fast dot product with a double[] array.
|
double |
dotProduct(Vector v) |
double |
dotProduct(Vector v,
Index ix) |
double |
elementSum()
Returns the sum of all elements in a vector
|
Vector |
ensureMutable()
Ensures the array is a fully mutable, efficient representation that is not
a view.
|
Vector |
exactClone()
Returns an exact clone of this vector, i.e.
|
void |
fill(double value)
Fills the entire vector with a given value
|
double |
get(int i)
Returns the double value at the specified position in a 1D vector
|
double[] |
getArray() |
int |
getArrayOffset() |
void |
getElements(double[] dest,
int offset)
Gets all elements of the array, copying them into a double array
|
int |
hashCode()
Computes the hashcode of a vector.
|
Scalar |
innerProduct(AVector v) |
Scalar |
innerProduct(Vector v) |
boolean |
isPackedArray() |
boolean |
isView()
Returns true if this vector is of a view type that references other vectors / data.
|
int |
length() |
void |
logistic() |
void |
multiply(AVector v) |
void |
multiply(double factor)
Multiplies the vector by a constant factor
|
void |
multiply(Vector v) |
long |
nonZeroCount()
Returns the number of non-zero elements in the array.
|
static Vector |
of(double... values)
Create a vector with specific component values.
|
void |
scaleAdd(double factor,
double constant)
Scales this vector and adds a constant to every element
|
void |
set(AVector a)
Sets the vector to equal the value of another vector
|
void |
set(int i,
double value) |
void |
setRange(int offset,
double[] data,
int dataOffset,
int length)
Set a subrange of this vector from a double array
|
void |
signum()
Sets each component of the vector to its sign value (-1, 0 or 1)
|
void |
square()
Squares all elements of the vector
|
void |
sub(AArrayVector v) |
void |
sub(AArrayVector src,
int srcOffset) |
void |
sub(AVector v)
Subtracts a vector from this vector
|
void |
tanh() |
void |
toDoubleBuffer(DoubleBuffer dest)
Copies the elements of this INDArray to the specified double buffer
|
Vector |
toNormal()
Creates a new mutable vector representing the normalised value of this vector
|
double |
unsafeGet(int i) |
void |
unsafeSet(int i,
double value) |
static Vector |
wrap(double[] source)
Wraps a double array into a Vector, does *no defensive copy* so use with caution
|
add, add, add, add, add, addMultipleToArray, addProduct, addProduct, addProductToArray, addProductToArray, addToArray, copyTo, copyTo, copyTo, divide, divide, divideTo, equals, equalsArray, equalsArray, exp, fillRange, getStride, isZero, join, join, join, log, magnitude, magnitudeSquared, multiply, multiplyTo, pow, reciprocal, set, setElements, slice, sqrt, subVector, validatebroadcast, broadcastLike, broadcastLike, getStride, getStrides, iteratoradd, add, addMultiple, addMultiple, addMultiple, addMultiple, addMultiple, addToArray, angle, applyOp, asElementList, asVector, clampMax, clampMin, compareTo, copyTo, copyTo, copyTo, copyTo, crossProduct, dimensionality, distanceL1, distanceLinf, distanceSquared, divide, divide, elementCount, elementIterator, elementSquaredSum, epsilonEquals, epsilonEquals, epsilonEquals, epsilonEquals, equals, equals, get, get, get, getLongShape, getShape, getShape, getSlices, getTranspose, getTransposeCopy, getTransposeView, immutable, innerProduct, innerProduct, innerProduct, interpolate, interpolate, isElementConstrained, isFullyMutable, isMutable, isSameShape, isSameShape, isUnitLengthVector, maxAbsElement, multiply, mutable, negate, normalise, normaliseMaxAbsElement, outerProduct, outerProduct, projectToPlane, reshape, scale, scaleAdd, scaleToMagnitude, set, set, set, set, set, set, set, setElements, setValues, slice, sliceCount, sub, sub, subMultiple, toDoubleArray, toList, toString, toVector, zeroCountbroadcastCloneLike, get, getSliceViews, isBoolean, scale, set, set, toArrayfinalize, getClass, notify, notifyAll, wait, wait, waitgetShapeadd, applyOp, asElementList, asVector, broadcastCloneLike, copyTo, dimensionality, divide, divide, elementCount, elementIterator, elementSquaredSum, epsilonEquals, epsilonEquals, equals, get, get, get, getLongShape, getShape, getSlices, getSliceViews, getTranspose, getTransposeCopy, getTransposeView, innerProduct, isBoolean, isElementConstrained, isFullyMutable, isMutable, isSameShape, multiply, negate, outerProduct, reshape, scale, set, set, set, set, set, setElements, slice, sliceCount, sub, sub, toArray, toDoubleArray, toVectorpublic Vector(AVector source)
source - public static Vector wrap(double[] source)
source - public static Vector create(double[] data)
public static Vector of(double... values)
values - public static Vector createLength(int length)
length - public int length()
public double get(int i)
INDArraypublic double unsafeGet(int i)
unsafeGet in class AArrayVectorpublic void set(int i,
double value)
public void unsafeSet(int i,
double value)
unsafeSet in class AArrayVectorpublic void setRange(int offset,
double[] data,
int dataOffset,
int length)
AVectorsetRange in class AArrayVectorpublic void set(AVector a)
AVectorset in class AArrayVectorpublic double[] getArray()
getArray in interface IStridedArraygetArray in class AStridedVectorpublic void getElements(double[] dest,
int offset)
INDArraygetElements in interface INDArraygetElements in class AArrayVectorpublic int getArrayOffset()
getArrayOffset in interface IStridedArraygetArrayOffset in class AStridedVectorpublic void applyOp(Op op)
INDArrayapplyOp in interface INDArrayapplyOp in class AArrayVectorpublic void fill(double value)
AVectorfill in interface INDArrayfill in class AArrayVectorpublic void clamp(double min,
double max)
AVectorclamp in interface INDArrayclamp in class AArrayVectorpublic void square()
AVectorsquare in interface INDArraysquare in class AArrayVectorpublic double elementSum()
AVectorelementSum in interface INDArrayelementSum in class AArrayVectorpublic long nonZeroCount()
INDArraynonZeroCount in interface INDArraynonZeroCount in class AArrayVectorpublic void signum()
AArrayVectorsignum in interface INDArraysignum in class AArrayVectorpublic void abs()
AVectorabs in interface INDArrayabs in class AArrayVectorpublic void add(AArrayVector src, int srcOffset)
add in class AArrayVectorpublic void addMultiple(AArrayVector v, double factor)
addMultiple in class AArrayVectorpublic void add(AVector v)
AVectoradd in class AArrayVectorpublic void add(Vector v)
add in class AStridedVectorpublic void scaleAdd(double factor,
double constant)
AVectorscaleAdd in interface INDArrayscaleAdd in class AArrayVectorpublic void add(double constant)
INDArrayadd in interface INDArrayadd in class AArrayVectorpublic void addProduct(AVector a, AVector b)
addProduct in class AVectorpublic void addAt(int i,
double v)
AVectoraddAt in class AArrayVectorpublic void sub(AVector v)
AVectorpublic double dotProduct(AVector v, Index ix)
dotProduct in class AVectorpublic double dotProduct(double[] data,
int offset)
AVectordotProduct in class AArrayVectorpublic double dotProduct(AVector v)
dotProduct in class AArrayVectorpublic Scalar innerProduct(AVector v)
innerProduct in class AVectorpublic Scalar innerProduct(Vector v)
innerProduct in class AVectorpublic double dotProduct(Vector v)
dotProduct in class AVectorpublic double distanceSquared(Vector v)
public double distance(Vector v)
public void sub(AArrayVector v)
public void sub(AArrayVector src, int srcOffset)
public void addMultiple(AVector v, double factor)
AVectoraddMultiple in class AArrayVectorpublic void addWeighted(AVector v, double factor)
AVectoraddWeighted in class AVectorpublic void addWeighted(AArrayVector v, double factor)
public void addMultiple(Vector source, Index index, double factor)
AVectoraddMultiple in class AVectorpublic void addMultiple(Index destToSource, Vector source, double factor)
AVectoraddMultiple in class AVectorpublic void multiply(double factor)
AVectormultiply in interface INDArraymultiply in class AArrayVectorfactor - Factor by which to multiply each component of the vectorpublic void multiply(AVector v)
multiply in class AArrayVectorpublic void multiply(Vector v)
public boolean isView()
AVectorisView in interface INDArrayisView in class AArrayVectorpublic Vector clone()
AVectorclone in interface INDArrayclone in class AStridedVectorpublic int hashCode()
AVectorpublic Vector ensureMutable()
INDArrayensureMutable in interface INDArrayensureMutable in class AStridedVectorpublic Vector exactClone()
AVectorexactClone in interface INDArrayexactClone in class AVectorpublic boolean isPackedArray()
isPackedArray in interface IStridedArrayisPackedArray in class AArrayVectorpublic void toDoubleBuffer(DoubleBuffer dest)
INDArraytoDoubleBuffer in interface INDArraytoDoubleBuffer in class AArrayVectorpublic Vector toNormal()
AVectorpublic double[] asDoubleArray()
INDArrayasDoubleArray in interface INDArrayasDoubleArray in class AStridedVectorCopyright © 2013. All Rights Reserved.