laddu_core

Type Alias Vector4

Source
pub type Vector4<T> = Matrix<T, Const<4>, Const<1>, ArrayStorage<T, 4, 1>>;
Expand description

A stack-allocated, 4-dimensional column vector.

Aliased Type§

struct Vector4<T> {
    pub data: ArrayStorage<T, 4, 1>,
    /* private fields */
}

Fields§

§data: ArrayStorage<T, 4, 1>

The data storage that contains all the matrix components. Disappointed?

Well, if you came here to see how you can access the matrix components, you may be in luck: you can access the individual components of all vectors with compile-time dimensions <= 6 using field notation like this: vec.x, vec.y, vec.z, vec.w, vec.a, vec.b. Reference and assignation work too:

let mut vec = Vector3::new(1.0, 2.0, 3.0);
vec.x = 10.0;
vec.y += 30.0;
assert_eq!(vec.x, 10.0);
assert_eq!(vec.y + 100.0, 132.0);

Similarly, for matrices with compile-time dimensions <= 6, you can use field notation like this: mat.m11, mat.m42, etc. The first digit identifies the row to address and the second digit identifies the column to address. So mat.m13 identifies the component at the first row and third column (note that the count of rows and columns start at 1 instead of 0 here. This is so we match the mathematical notation).

For all matrices and vectors, independently from their size, individual components can be accessed and modified using indexing: vec[20], mat[(20, 19)]. Here the indexing starts at 0 as you would expect.

Trait Implementations§

Source§

impl FourMomentum for Vector4<Float>

Source§

fn px(&self) -> Float

Momentum in the $x$-direction
Source§

fn py(&self) -> Float

Momentum in the $y$-direction
Source§

fn pz(&self) -> Float

Momentum in the $z$-direction
Source§

fn e(&self) -> Float

Energy
Source§

fn momentum(&self) -> VectorView<'_, Float, U3, U1, U4>

The three-momentum
Source§

fn gamma(&self) -> Float

The $\gamma$ factor $\frac{1}{\sqrt{1 - \beta^2}}$.
Source§

fn beta(&self) -> Vector3<Float>

The $\vec{\beta}$ vector $\frac{\vec{p}}{E}$.
Source§

fn m(&self) -> Float

The mass of the corresponding object.
Source§

fn m2(&self) -> Float

The squared mass of the corresponding object.
Source§

fn to_p4_string(&self) -> String

Pretty-prints the four-momentum.
Source§

impl FourVector for Vector4<Float>

Source§

fn mag(&self) -> Float

The magnitude of the vector (with $---+$ signature).
Source§

fn mag2(&self) -> Float

The squared magnitude of the vector (with $---+$ signature).
Source§

fn boost(&self, beta: &Vector3<Float>) -> Self

Gives the vector boosted along a $\vec{\beta}$ vector.
Source§

fn vec3(&self) -> VectorView<'_, Float, U3, U1, U4>

Yields the three-vector part.