twenty_first

Macro xfe_array

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

Simplifies constructing arrays of extension field elements.

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

ยงExamples

Array of constants.

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

Array of general extension field elements.

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

Array with the same constant for every entry.

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

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

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