scale

Function scale 

Source
pub fn scale<'a, const F: usize, T: Mul<Output = T> + Div<Output = T> + Debug + Copy>(
    vec: &'a [T; F],
    scalar: &T,
) -> [T; F]
where &'a T: Mul<&'a T>,
Expand description

Vector Scaling

Scale the Vector a specified amount.

§Examples

use vector_operations::scale;

let a = [1, 2, 3, 4, 5];
let expected = [5, 10, 15, 20, 25];
assert_eq!(scale(&a, &5), expected);

§Type Parameters

  • F: The length of the vector.

§Arguments

  • vec: The vector to scale.
  • scalar: The scalar value to multiply the vector by.

§Returns

A new vector containing the scaled values of the input vector.