public final class Vector extends ArrayVector
| 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(ArrayVector src,
int srcOffset) |
void |
add(AVector v)
Adds another vector to this one
|
void |
add(double constant) |
void |
addAt(int i,
double v) |
void |
addMultiple(ArrayVector 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(ArrayVector 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)
|
void |
clamp(double min,
double max)
Clamps all values in the vector to a given range
|
Vector |
clone()
Clones the vector, creating a new copy of all data.
|
static Vector |
create(AVector a) |
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(Vector v) |
double |
dotProduct(Vector v,
Index ix) |
double |
elementSum()
Returns the sum of all elements in a vector
|
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
|
boolean |
isPackedArray() |
boolean |
isView()
Returns true if this vector is of a view type that references other vectors / data.
|
int |
length() |
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 all elements of the array by a given double value and adds a constant vale
|
void |
set(AVector a)
Sets the vector to equal the value of another vector
|
void |
set(int i,
double value) |
void |
set(int offset,
double[] data,
int dataOffset,
int length)
Set part 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(ArrayVector v) |
void |
sub(ArrayVector src,
int srcOffset) |
void |
sub(AVector v)
Subtracts a vector from this vector
|
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, copyTo, divide, divide, divideTo, exp, fillRange, join, join, join, log, magnitude, magnitudeSquared, multiply, multiplyTo, pow, reciprocal, set, setElements, slice, sqrt, subVector, toDoubleBuffer, validateadd, add, addMultiple, addMultiple, addMultiple, addMultiple, addMultiple, addToArray, angle, applyOp, asElementList, asVector, broadcast, clampMax, clampMin, compareTo, copyTo, copyTo, copyTo, countZeros, crossProduct, dimensionality, distanceL1, distanceLinf, distanceSquared, divide, elementCount, elementSquaredSum, epsilonEquals, epsilonEquals, equals, equals, equals, equalsArray, get, getLongShape, getShape, getShape, getSlices, getTranspose, getTransposeView, hashCode, innerProduct, innerProduct, innerProduct, interpolate, interpolate, isElementConstrained, isFullyMutable, isMutable, isUnitLengthVector, isZeroVector, iterator, maxAbsElement, multiply, negate, normalise, normaliseMaxAbsElement, outerProduct, outerProduct, projectToPlane, reshape, scale, scaleAdd, scaleToMagnitude, set, set, set, set, set, set, setElements, setValues, slice, sliceCount, sub, sub, subMultiple, toArray, toList, toString, toVectorepsilonEquals, epsilonEquals, get, get, getSliceViews, scale, set, setfinalize, getClass, notify, notifyAll, wait, wait, waitepsilonEquals, epsilonEquals, get, get, getSliceViews, scale, set, setpublic Vector(AVector source)
source - public static Vector wrap(double[] source)
source - public static Vector of(double... values)
values - public static Vector createLength(int length)
length - public int length()
public double get(int i)
INDArraypublic void set(int i,
double value)
public void set(int offset,
double[] data,
int dataOffset,
int length)
AVectorset in class ArrayVectorpublic void set(AVector a)
AVectorset in class ArrayVectorpublic double[] getArray()
getArray in class ArrayVectorpublic void getElements(double[] dest,
int offset)
INDArraygetElements in interface INDArraygetElements in class ArrayVectorpublic int getArrayOffset()
getArrayOffset in class ArrayVectorpublic void applyOp(Op op)
INDArrayapplyOp in interface INDArrayapplyOp in class ArrayVectorpublic void fill(double value)
AVectorfill in interface INDArrayfill in class ArrayVectorpublic void clamp(double min,
double max)
AVectorclamp in interface INDArrayclamp in class ArrayVectorpublic void square()
AVectorsquare in interface INDArraysquare in class ArrayVectorpublic double elementSum()
AVectorelementSum in interface INDArrayelementSum in class ArrayVectorpublic long nonZeroCount()
INDArraynonZeroCount in interface INDArraynonZeroCount in class ArrayVectorpublic void signum()
ArrayVectorsignum in interface INDArraysignum in class ArrayVectorpublic void abs()
AVectorabs in interface INDArrayabs in class ArrayVectorpublic void add(ArrayVector src, int srcOffset)
add in class ArrayVectorpublic void addMultiple(ArrayVector v, double factor)
addMultiple in class ArrayVectorpublic void add(AVector v)
AVectoradd in class ArrayVectorpublic void scaleAdd(double factor,
double constant)
INDArrayscaleAdd in interface INDArrayscaleAdd in class ArrayVectorpublic void add(double constant)
add in interface INDArrayadd in class ArrayVectorpublic void addProduct(AVector a, AVector b)
addProduct in class AVectorpublic void addAt(int i,
double v)
addAt in class ArrayVectorpublic void sub(AVector v)
AVectorpublic double dotProduct(AVector v, Index ix)
dotProduct in class AVectorpublic double dotProduct(AVector v)
dotProduct in class AVectorpublic double dotProduct(Vector v)
public double distanceSquared(Vector v)
public double distance(Vector v)
public void sub(ArrayVector v)
public void sub(ArrayVector src, int srcOffset)
public void addMultiple(AVector v, double factor)
AVectoraddMultiple in class ArrayVectorpublic void addWeighted(AVector v, double factor)
AVectoraddWeighted in class AVectorpublic void addWeighted(ArrayVector 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 ArrayVectorfactor - Factor by which to multiply each component of the vectorpublic void multiply(AVector v)
multiply in class ArrayVectorpublic void multiply(Vector v)
public boolean isView()
AVectorisView in interface INDArrayisView in class ArrayVectorpublic Vector clone()
AVectorpublic Vector exactClone()
AVectorexactClone in interface INDArrayexactClone in class AVectorpublic boolean isPackedArray()
isPackedArray in class ArrayVectorCopyright © 2013. All Rights Reserved.