[][src]Macro const_linear::vector

macro_rules! vector {
    ($val:expr; $dim:expr) => { ... };
    ($($elem:expr),+$(,)?) => { ... };
}

Constructs a vector from either a value or a series of values.

Examples

Vector from value

An invocation in the form matrix![x; N] creates an N dimensional vector filled with the value x.

use const_linear::vector;

let expected = [1; 3];

let v = vector![1; 3];

for (x, y) in v.column_iter().zip(expected.iter()) {
    assert_eq!(x, y);
}

Vector from a series of values

An invocation in the form vector![x, y, z, w, ...] creates a vector with the elements [x, y, z, w, ...].

use const_linear::vector;

let v = vector![1, 2, 3, 4];

assert_eq!(v.length(), f64::sqrt(30.0));