Vector, java.io.Serializablepublic final class Vector1D extends java.lang.Object implements Vector, java.io.Serializable
| Constructor | Description |
|---|---|
Vector1D() |
|
Vector1D(double a1) |
|
Vector1D(double[] a) |
|
Vector1D(Vector1D u) |
| Modifier and Type | Method | Description |
|---|---|---|
void |
assignTo(double[] array) |
Assigns the components of this vector to the elements of the given array.
|
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 a1,
Vector u) |
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 u1,
Vector u2) |
Sets the components of this vector equal to (v1 - v2)
|
void |
Ev1Pv2(Vector u1,
Vector u2) |
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 function) |
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
|
void |
mod(Vector1D u) |
|
double |
Mv1Squared(Vector u1) |
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.
|
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 a1,
Vector u) |
Increments (+=) components by (a1 * v1)
|
void |
randomDirection(IRandom random) |
|
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.
|
java.lang.String |
toString() |
|
void |
XE(Vector u) |
Sets this vector equal to the cross product of this vector with the
given vector (only works for 3D vectors).
|
public Vector1D()
public Vector1D(double a1)
public Vector1D(double[] a)
public Vector1D(Vector1D u)
public boolean equals(Vector v)
Vectorpublic boolean isZero()
Vectorpublic java.lang.String toString()
toString in class java.lang.Objectpublic int getD()
Vectorpublic double getX(int i)
Vectorpublic void setX(int i,
double d)
Vectorpublic void assignTo(double[] array)
Vectorpublic void E(double a)
Vectorpublic void E(double[] a)
Vectorpublic void Ea1Tv1(double a1,
Vector u)
Vectorpublic void PEa1Tv1(double a1,
Vector u)
Vectorpublic void PE(double a)
Vectorpublic void TE(double a)
Vectorpublic void Ev1Pv2(Vector u1, Vector u2)
Vectorpublic void Ev1Mv2(Vector u1, Vector u2)
Vectorpublic double Mv1Squared(Vector u1)
VectorMv1Squared in interface Vectorpublic void mod(Vector u)
Vectorpublic void mod(Vector1D u)
public double squared()
Vectorpublic void normalize()
Vectorpublic void setRandomCube(IRandom random)
VectorsetRandomCube in interface Vectorrandom - the random number generator used to perform the operationpublic void setRandomInSphere(IRandom random)
VectorsetRandomInSphere in interface Vectorrandom - the random number generator used to perform the operationpublic void nearestImage(Vector dimensions)
nearestImage in interface Vectorpublic void setRandomSphere(IRandom random)
VectorsetRandomSphere in interface Vectorrandom - the random number generator used to perform the operationpublic void randomDirection(IRandom random)
public void E(Vector u)
Vectorpublic void PE(Vector u)
Vectorpublic void ME(Vector u)
Vectorpublic void TE(Vector u)
Vectorpublic void DE(Vector u)
Vectorpublic double dot(Vector u)
Vectorpublic boolean isNaN()
Vectorpublic void map(IFunction function)
Vector