VectorUtil
The VectorUtil class is used to work with vectors.
To import this class use:
import ru.biosoft.physicell.biofvm.VectorUtil
All members of the VectorUtil class are presented below.
Class member |
Description |
|---|---|
static double[] newDiff(double[] vector1, double[] vector2) |
vector1 is a three-dimensional vector.
vector2 is a three-dimensional vector.
Returns a three-dimensional vector that is the coordinate difference of the vectors vector1 and vector2.
Example of usage.
|
static double norm(double[] vector) |
|
static double norm_squared(double[] vector) |
|
static double[] newNormalize(double[] vector) |
|
static void normalize(double[] vector) |
|
static double dist(double[] vector1, double[] vector2) |
|
static double[] newProd(double[] vector, double const) |
vector - a three-dimensional vector.
const - number.
Returns a three-dimensional vector res_vector of the following form:
res_vector[i] = const*vector[i],
where i is each coordinate of the vectors res_vector and vector.
Example of usage.
|
static double[] axpy(double[] vector1, double const, double[] vector2) |
vector1 is a three-dimensional vector.
const - number.
vector2 is a three-dimensional vector.
Returns a three-dimensional vector of the following form:
vector[i] = vector1[i] + const*vector2[i],
где i - каждая координата векторов vector, vector1 и vector2.
Example of usage.
|
static void zero(double[] vector) |
Vector Operations Help
Coordinate vector difference
The coordinate difference of vectors is a vector subtraction operation in which the corresponding components (coordinates) of the vectors are subtracted.
// Given
Vector3D a = new Vector3D(5, 3, 7);
Vector3D b = new Vector3D(1, 2, 4);
// Component-wise difference
Vector3D difference = a.subtract(b); // Result: (4, 1, 3)
L2-norm of a vector
The L2 norm of a vector (Euclidean norm) is a standard way of measuring the length of a vector. It is calculated as the square root of the sum of the squares of all vector components.
For a vector v = (v1, v2, ..., vn) in n-dimensional space:
Vector normalization
Vector normalization is the transformation of a vector into a unit-length vector (with L2-norm equal to 1) preserving its direction.
The normalized version of the vector v = (v1, v2, ..., vn) is a vector v`, each coordinate of which is less than the corresponding coordinate of the vector v in the L2 norm of that vector:
Расстояние между векторами
В двумерной системе координат расстояние (d) между векторами A(x1, y1) и B(x2, y2) вычисляется следующим образом:
В трехмерной системе координат расстояние (d) между векторами A(x1, y1, z1) и B(x2, y2, z2) вычисляется следующим образом: