batch_normalize currently documents this caveat:
This function will panic if p.len() != q.len().
However, with const generics you can construct an output array that matches the input size with compile-time assurances:
fn batch_normalize_array<const N: usize>(points: &[Self, N]) -> [Self::AffineRepr; N] { ... }
This issue is to suggest an addition, rather than a replacement, specifically for use cases where the number of points is fixed at compile-time.
Note that this approach is also useful for stack allocating all intermediate values (since you can size the arrays by N), allowing for efficient implementations on heapless targets.
batch_normalizecurrently documents this caveat:However, with const generics you can construct an output array that matches the input size with compile-time assurances:
This issue is to suggest an addition, rather than a replacement, specifically for use cases where the number of points is fixed at compile-time.
Note that this approach is also useful for stack allocating all intermediate values (since you can size the arrays by
N), allowing for efficient implementations on heapless targets.