pub struct FourVec { /* private fields */ }
Expand description
Four Vector
Implementations
Returns a reference to the first element of the vector
Example
use calcify::FourVec;
let vec4 = FourVec::new(1.0,2.0,3.0,4.0);
let element_zero: f64 = *vec4.m0();
assert_eq!(element_zero,1.0);
Returns a reference to the second element of the vector
Example
use calcify::FourVec;
let vec4 = FourVec::new(1.0,2.0,3.0,4.0);
let element_one: f64 = *vec4.m1();
assert_eq!(element_one,2.0);
Returns a reference to the third element of the vector
Example
use calcify::FourVec;
let vec4 = FourVec::new(1.0,2.0,3.0,4.0);
let element_two: f64 = *vec4.m2();
assert_eq!(element_two,3.0);
Returns a reference to the forth element of the vector
Example
use calcify::FourVec;
let vec4 = FourVec::new(1.0,2.0,3.0,4.0);
let element_three: f64 = *vec4.m3();
assert_eq!(element_three,4.0);
Returns the covariant vector with metric [1,-1,-1,-1].
Example
use calcify::FourVec;
let vec4 = FourVec::new(1.0,2.0,3.0,4.0);
let cov_vec4: FourVec = vec4.cov();
assert_eq!(cov_vec4,FourVec::new(1.0,-2.0,-3.0,-4.0));
assert_eq!(vec4.cov()*vec4, -28.0)
Returns the space-time invariant classification S^2 of a space-time vector. Returns a variant of the calcify::Sinv enum
Example
use calcify::FourVec;
use calcify::Sinv;
let vec4 = FourVec::new(10.0,2.0,2.0,2.0);
let ss: Sinv = vec4.s2();
assert_eq!(ss,Sinv::TimeLike);
Trait Implementations
Performs the +=
operation. Read more
Matrix multiplication with vector
Note
Only works in one direction FourMat*FourVec, implying FourVec as a column vector.
Example
use calcify::FourMat;
use calcify::FourVec;
let mat4 = FourMat::new(FourVec::new(1.0,2.0,3.0,4.0),
FourVec::new(1.0,2.0,3.0,4.0),
FourVec::new(1.0,2.0,3.0,4.0),
FourVec::new(1.0,2.0,3.0,4.0));
assert_eq!(
mat4*FourVec::new(2.0,2.0,2.0,2.0),
FourVec::new(20.0,20.0,20.0,20.0)
);
Performs the -=
operation. Read more
Auto Trait Implementations
impl RefUnwindSafe for FourVec
impl UnwindSafe for FourVec
Blanket Implementations
Mutably borrows from an owned value. Read more