linalg-traits
Traits for generic linear algebra.
Documentation
Please see https://docs.rs/linalg-traits.
Examples
Let's define a function that takes in a vector and returns a new vector with all the elements repeated twice. Using the Scalar and Vector traits, we can write it in a way that makes it independent of what types we use to represent scalars and vectors.
use ;
use ;
use *;
// Define the function for repeating the elements.
// Define the vector to be repeated.
let v: = array!;
// Repeat the elements.
let v_repeated: = repeat_elements;
// Check that the elements were properly repeated.
assert_arrays_equal!;