public final class Vector2 extends APrimitiveVector
| Modifier and Type | Method and Description |
|---|---|
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(double dx,
double dy) |
void |
add(Vector2 v) |
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(Vector2 v,
double factor) |
void |
addProduct(Vector2 a,
Vector2 b) |
void |
addProduct(Vector2 a,
Vector2 b,
double factor) |
void |
applyOp(Op op)
Applies a unary operator to all elements of the array (in-place)
|
Vector2 |
clone()
Clones the vector, creating a new mutable copy of all data.
|
Vector2 |
complexConjugate() |
void |
complexMultiply(Vector2 a)
Complex multiplication by another Vector2, treating an (x,y) vector as the complex value x+iy
|
Vector2 |
complexNegation() |
Vector2 |
complexReciprocal() |
static Vector2 |
create(AVector v) |
double |
dotProduct(AVector a)
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(Vector2 a) |
double |
elementMax()
Returns the maximum element value in this array.
|
double |
elementMin()
Returns the maximum element value in this array.
|
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 |
equals(Vector2 v) |
boolean |
equalsArray(double[] data,
int offset)
Returns true if this vector exactly matches the elements in double[] array, starting
from the specified offset
|
Vector2 |
exactClone()
Returns an exact clone of this vector, i.e.
|
void |
fill(double v)
Fills the entire vector with a given value
|
double |
get(int i)
Returns the double value at the specified position in a 1D vector
|
void |
getElements(double[] data,
int offset)
Gets all elements of the array, copying them into a double array at the specified offset
|
double |
getX() |
double |
getY() |
boolean |
isZero()
Returns true if this vector is a zero vector (all components zero)
|
int |
length()
Returns the length of a vector, in terms of the number of elements.
|
double |
magnitude()
Returns the magnitude (Euclidean length) of the vector
|
void |
multiply(double factor)
Multiplies the vector by a constant factor
|
void |
negate()
Negates all emlements of this vector in place.
|
static Vector2 |
of(double... values) |
static Vector2 |
of(double x,
double y) |
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 |
rotateInPlace(int angle)
Rotates a 2D vector around the origin by a given angle
|
void |
scaleAdd(double factor,
AVector constant) |
void |
scaleAdd(double factor,
double constant)
Scales this vector and adds a constant to every element
|
void |
scaleAdd(double factor,
Vector2 constant) |
void |
set(int i,
double value)
Sets a value at a given position in a mutable 1D array
|
void |
setValues(double x,
double y) |
void |
sub(Vector2 v) |
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
|
Vector2 |
toNormal()
Creates a new mutable vector representing the normalised value of this vector
Returns null if the vector cannot be normalised (i.e.
|
double |
unsafeGet(int i) |
void |
unsafeSet(int i,
double value) |
getT, getZ, isFullyMutable, isMutable, isView, sparse, sparseCloneabs, absCopy, add, add, add, add, add, add, add, addAt, addCopy, addCopy, addCopy, addInnerProduct, addInnerProduct, addInnerProduct, addMultiple, addMultiple, addMultiple, addMultiple, addMultiple, addMultiple, addMultiple, addMultiple, addMultipleCopy, addMultipleToArray, addMultipleToArray, addPower, addPower, addPower, addProduct, addProduct, addProduct, addProductCopy, addProductCopy, addProductToArray, addProductToArray, addToArray, addToArray, addToArray, addWeighted, angle, applyOp, applyOp, applyOp, applyOp, applyOpCopy, asDoubleArray, asElementList, asVector, broadcast, broadcastLike, broadcastLike, broadcastLike, checkDimension, checkIndex, checkLength, checkRange, checkSameLength, checkSameLength, checkSameLength, clamp, clampMax, clampMin, compareTo, copy, copyTo, copyTo, copyTo, copyTo, copyTo, crossProduct, crossProduct, dense, denseClone, dimensionality, distance, distanceL1, distanceLinf, distanceSquared, divide, divide, divide, divide, divideCopy, divideCopy, divideTo, dotProduct, dotProduct, dotProduct, elementAbsPowSum, elementCount, elementIterator, elementPowSum, elementsEqual, epsilonEquals, epsilonEquals, epsilonEquals, epsilonEquals, equals, equals, equalsArray, fillRange, get, get, get, get, get, getElements, getElements, getLongShape, getShape, getShape, getShapeClone, getSlices, getTranspose, getTransposeCopy, getTransposeView, hashCode, hasUncountable, immutable, innerProduct, innerProduct, innerProduct, innerProduct, innerProduct, innerProduct, interpolate, isElementConstrained, isRangeZero, isSameShape, isSameShape, isUnitLengthVector, isUnitLengthVector, iterator, join, join, join, log, logistic, magnitudeSquared, maxAbsElement, maxAbsElementIndex, maxElement, maxElementIndex, minElement, minElementIndex, multiply, multiply, multiply, multiply, multiplyCopy, multiplyCopy, multiplyCopy, multiplyTo, mutable, negateCopy, nonSparseIndex, nonZeroCount, nonZeroIndices, nonZeroValues, normalise, normaliseCopy, normaliseMaxAbsElement, outerProduct, outerProduct, pow, projectToPlane, reduceSlices, reduceSlices, reorder, reorder, reshape, rotateCopy, rotateView, rotateView, scale, 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, slice, sliceCount, sliceValue, softmax, softmaxCopy, sqrtCopy, square, squareCopy, sub, sub, subArray, subAt, subCopy, subCopy, subMultiple, subVector, tanh, toList, toSliceArray, toString, toStringFull, toVector, tryEfficientJoin, validateadd, addInnerProduct, addInnerProduct, addOuterProduct, broadcastCloneLike, broadcastCopyLike, checkMutable, componentCount, density, ensureMutable, 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, waitaddOuterProduct, broadcastCloneLike, broadcastCopyLike, checkMutable, componentCount, ensureMutable, exp, get, get, get, getComponent, getComponents, getElements, getElements, getSlices, getSliceViews, isBoolean, isDense, isSparse, reciprocal, reciprocalCopy, scale, set, set, signumCopy, sqrt, sub, toArray, withComponentsforEach, spliteratorpublic static Vector2 of(double x, double y)
public static Vector2 of(double... values)
public void applyOp(Op op)
INDArraypublic double reduce(Op2 op, double init)
INDArraypublic double reduce(Op2 op)
INDArraypublic boolean isZero()
AVectorpublic void add(Vector2 v)
public void sub(Vector2 v)
public void addMultiple(Vector2 v, double factor)
public double dotProduct(AVector a)
AVectordotProduct in class AVectorpublic double dotProduct(double[] data,
int offset)
AVectordotProduct in class AVectorpublic double dotProduct(Vector2 a)
public void scaleAdd(double factor,
double constant)
AVectorpublic void scaleAdd(double factor,
Vector2 constant)
public void complexMultiply(Vector2 a)
a - public Vector2 complexConjugate()
public Vector2 complexReciprocal()
public Vector2 complexNegation()
public void negate()
AVectorpublic void multiply(double factor)
AVectorpublic void add(double constant)
INDArraypublic void add(double dx,
double dy)
public void add(AVector v)
AVectorpublic int length()
IVectorpublic double elementSum()
AVectorelementSum in interface INDArrayelementSum in class AVectorpublic double elementProduct()
INDArrayelementProduct in interface INDArrayelementProduct in class AVectorpublic 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 AVectorpublic double magnitude()
AVectorpublic double get(int i)
INDArraypublic void getElements(double[] data,
int offset)
INDArraygetElements in interface INDArraygetElements in class AVectorpublic void toDoubleBuffer(DoubleBuffer dest)
INDArraytoDoubleBuffer in interface INDArraytoDoubleBuffer in class AVectorpublic double[] toDoubleArray()
INDArraytoDoubleArray in interface INDArraytoDoubleArray in class AVectorpublic Vector2 toNormal()
AVectortoNormal in class APrimitiveVectorpublic void set(int i,
double value)
INDArraypublic void fill(double v)
AVectorpublic void addAt(int i,
double value)
AVectorpublic void rotateInPlace(int angle)
angle - public void setValues(double x,
double y)
public Vector2 clone()
AVectorpublic double getX()
getX in class APrimitiveVectorpublic double getY()
getY in class APrimitiveVectorpublic Vector2 exactClone()
AVectorexactClone in interface INDArrayexactClone in class APrimitiveVectorpublic boolean equals(Vector2 v)
public boolean equalsArray(double[] data,
int offset)
AVectorequalsArray in interface INDArrayequalsArray in class AVectordata - Array of double element values to check for equalityoffset - Offset into the data arrayCopyright © 2016. All rights reserved.