triton_vm::prelude

Macro xfe_vec

Source
macro_rules! xfe_vec {
    ($x:expr; $n:expr) => { ... };
    ([$c0:expr, $c1:expr, $c2:expr]; $n:expr) => { ... };
    ($($x:expr),* $(,)?) => { ... };
    ($([$c0:expr, $c1:expr, $c2:expr]),* $(,)?) => { ... };
}
Expand description

Simplifies constructing vectors of extension field elements.

The type XFieldElement must be in scope for this macro to work. See also xfe!.

ยงExamples

Vector of constants.

let a = xfe_vec![1, 2, 3];
let b = vec![xfe!(1), xfe!(2), xfe!(3)];
assert_eq!(a, b);

Vector of general extension field elements.

let a = xfe_vec![[1, 0, 0], [0, 2, 0], [0, 0, 3]];
let b = vec![xfe!([1, 0, 0]), xfe!([0, 2, 0]), xfe!([0, 0, 3])];
assert_eq!(a, b);

Vector with the same constant for every entry.

let a = xfe_vec![42; 15];
let b = vec![xfe!(42); 15];
assert_eq!(a, b);

Vector with the same general extension field element for every entry.

let a = xfe_vec![[42, 43, 44]; 15];
let b = vec![xfe!([42, 43, 44]); 15];
assert_eq!(a, b);