vector!() { /* proc-macro */ }
Expand description

Construct a fixed-size column vector directly from data.

Note: Requires the macro feature to be enabled (enabled by default).

Similarly to matrix!, this macro facilitates easy construction of fixed-size vectors. However, whereas the matrix! macro expects each row to be separated by a semi-colon, the syntax of this macro is instead similar to vec!, in that the elements of the vector are simply listed consecutively.

vector! is intended to be the most readable and performant way of constructing small, fixed-size vectors, and it is usable in const fn contexts.

Examples

use nalgebra::vector;

// Produces a Vector3<_> == SVector<_, 3>
let v = vector![1, 2, 3];