Module initial_conditions::utils::vec_traits [] [src]

Extended Vec traits Addon traits to the standard Rust Vec type.

Traits

AddVec

add_vec (Trait)

  • adds the ith element of v1 (self) to the ith element of v2
CrossProduct

cross_pro (Trait)

  • Returns a vector orthogonal to v1 and v2
  • Assumes no more than three dimensions
Dot

dot (Trait)

  • v1.dot(v2) // returns the dot product of the two vectors
  • panic occurs when v1.len() != v2.len()
EuclideanNorm

euc_norm (Trait)

  • Returns the Euclidean Norm (length) of the vector (n-dimensional)
ScalarDiv

scalar_div (Trait)

  • divides each item in Vec by k, mutating self
  • If zero is passed as k, value will be inf
ScalarMult

scalar_mult (Trait)

  • multiplies each item in Vec by k, mutating self
SubVec

sub_vec (Trait)

  • subtracts the ith element of v2 from the ith element of v1 (self)