Modifier and Type | Method | Description |
---|---|---|
void |
assignTo(double[] array) |
Assigns the components of this vector to the elements of the given array.
|
static Vector |
d(int dimension) |
Creates a Vector of the given dimension.
|
void |
DE(Vector u) |
Divide-equals (/=) operation.
|
double |
dot(Vector u) |
Returns the dot product of this vector with the given one.
|
void |
E(double a) |
Sets all components of this vector equal to the given value.
|
void |
E(double[] a) |
Sets the components of this vector equal to the corresponding elements of
the given array.
|
void |
E(Vector u) |
Sets the components of this vector equal to those of the given vector.
|
void |
Ea1Tv1(double a,
Vector v1) |
Operation (= a1 * v1); sets the components of this to those of the given
vector multiplied by the given constant.
|
boolean |
equals(Vector v) |
Returns true if all corresponding elements of this and the given vector
are equal; returns false otherwise.
|
void |
Ev1Mv2(Vector v1,
Vector v2) |
Sets the components of this vector equal to (v1 - v2)
|
void |
Ev1Pv2(Vector v1,
Vector v2) |
Sets the components of this vector equal to (v1 + v2)
|
int |
getD() |
Dimension of the space occupied by the vector.
|
double |
getX(int i) |
Vector components corresponding to the given index.
|
boolean |
isNaN() |
Returns true if any element of the vector is not-a-number.
|
boolean |
isZero() |
Returns true if all components of this vector are zero; false otherwise.
|
void |
map(IFunction f) |
Applies the given function to each element of the vector.
|
void |
ME(Vector u) |
Minus-equals (-=) operation.
|
void |
mod(Vector u) |
Replaces each component of this vector with its value modulo
the corresponding component in u
|
double |
Mv1Squared(Vector v1) |
Returns square of vector resulting from subtracting given vector
from this one.
|
void |
nearestImage(Vector dimensions) |
|
void |
normalize() |
Normalizes this vector, so this.squared() == 1.
|
static Vector |
of(double... components) |
Returns a Vector initialized to the given set of values.
|
static Vector |
of(int... components) |
Returns a Vector initialized to the given set of values (cast to double).
|
void |
PE(double a) |
Plus-equals (+=) operation, causing a constant value to be added to all
components of this vector.
|
void |
PE(Vector u) |
Plus-equals (+=) operation.
|
void |
PEa1Tv1(double a,
Vector v1) |
Increments (+=) components by (a1 * v1)
|
void |
setRandomCube(IRandom random) |
Assigns each component to (its own) random value between -0.5 and + 0.5.
|
void |
setRandomInSphere(IRandom random) |
Assigns this vector to equal a point chosen randomly in the volume
of a unit sphere.
|
void |
setRandomSphere(IRandom random) |
Assigns this vector to equal a point chosen randomly on the
surface of a unit sphere.
|
void |
setX(int i,
double d) |
Sets the i-th component of the vector to the given value d.
|
double |
squared() |
Returns the square magnitude of this vector, e.g., x^2 + y^2 for D = 2.
|
void |
TE(double a) |
Multiplies all components by a constant.
|
void |
TE(Vector u) |
Times-equals (*=) operation.
|
default double[] |
toArray() |
|
void |
XE(Vector u) |
Sets this vector equal to the cross product of this vector with the
given vector (only works for 3D vectors).
|
int getD()
void assignTo(double[] array)
default double[] toArray()
boolean equals(Vector v)
double getX(int i)
double squared()
boolean isZero()
double dot(Vector u)
boolean isNaN()
double Mv1Squared(Vector v1)
void setX(int i, double d)
void E(Vector u)
void E(double a)
void E(double[] a)
void PE(Vector u)
void PE(double a)
void ME(Vector u)
void TE(Vector u)
void DE(Vector u)
void TE(double a)
void Ea1Tv1(double a, Vector v1)
void PEa1Tv1(double a, Vector v1)
void mod(Vector u)
void normalize()
void map(IFunction f)
void XE(Vector u)
void setRandomSphere(IRandom random)
random
- the random number generator used to perform the operationvoid setRandomCube(IRandom random)
random
- the random number generator used to perform the operationvoid setRandomInSphere(IRandom random)
random
- the random number generator used to perform the operationvoid nearestImage(Vector dimensions)
static Vector of(double... components)
java.lang.IllegalArgumentException
- if number of components is not greater than 0static Vector of(int... components)
static Vector d(int dimension)
dimension
- greater than 0