use crate::{ api::{ VecZnxAdd, VecZnxAddInplace, VecZnxAddNormal, VecZnxAddScalar, VecZnxAddScalarInplace, VecZnxAutomorphism, VecZnxAutomorphismInplace, VecZnxAutomorphismInplaceTmpBytes, VecZnxCopy, VecZnxFillNormal, VecZnxFillUniform, VecZnxLsh, VecZnxLshInplace, VecZnxLshTmpBytes, VecZnxMergeRings, VecZnxMergeRingsTmpBytes, VecZnxMulXpMinusOne, VecZnxMulXpMinusOneInplace, VecZnxMulXpMinusOneInplaceTmpBytes, VecZnxNegate, VecZnxNegateInplace, VecZnxNormalize, VecZnxNormalizeInplace, VecZnxNormalizeTmpBytes, VecZnxRotate, VecZnxRotateInplace, VecZnxRotateInplaceTmpBytes, VecZnxRsh, VecZnxRshInplace, VecZnxRshTmpBytes, VecZnxSplitRing, VecZnxSplitRingTmpBytes, VecZnxSub, VecZnxSubInplace, VecZnxSubNegateInplace, VecZnxSubScalar, VecZnxSubScalarInplace, VecZnxSwitchRing, VecZnxZero, }, layouts::{Backend, Module, ScalarZnxToRef, Scratch, VecZnxToMut, VecZnxToRef}, oep::{ VecZnxAddImpl, VecZnxAddInplaceImpl, VecZnxAddNormalImpl, VecZnxAddScalarImpl, VecZnxAddScalarInplaceImpl, VecZnxAutomorphismImpl, VecZnxAutomorphismInplaceImpl, VecZnxAutomorphismInplaceTmpBytesImpl, VecZnxCopyImpl, VecZnxFillNormalImpl, VecZnxFillUniformImpl, VecZnxLshImpl, VecZnxLshInplaceImpl, VecZnxLshTmpBytesImpl, VecZnxMergeRingsImpl, VecZnxMergeRingsTmpBytesImpl, VecZnxMulXpMinusOneImpl, VecZnxMulXpMinusOneInplaceImpl, VecZnxMulXpMinusOneInplaceTmpBytesImpl, VecZnxNegateImpl, VecZnxNegateInplaceImpl, VecZnxNormalizeImpl, VecZnxNormalizeInplaceImpl, VecZnxNormalizeTmpBytesImpl, VecZnxRotateImpl, VecZnxRotateInplaceImpl, VecZnxRotateInplaceTmpBytesImpl, VecZnxRshImpl, VecZnxRshInplaceImpl, VecZnxRshTmpBytesImpl, VecZnxSplitRingImpl, VecZnxSplitRingTmpBytesImpl, VecZnxSubImpl, VecZnxSubInplaceImpl, VecZnxSubNegateInplaceImpl, VecZnxSubScalarImpl, VecZnxSubScalarInplaceImpl, VecZnxSwitchRingImpl, VecZnxZeroImpl, }, source::Source, }; impl VecZnxZero for Module where B: Backend + VecZnxZeroImpl, { fn vec_znx_zero(&self, res: &mut R, res_col: usize) where R: VecZnxToMut, { B::vec_znx_zero_impl(self, res, res_col); } } impl VecZnxNormalizeTmpBytes for Module where B: Backend + VecZnxNormalizeTmpBytesImpl, { fn vec_znx_normalize_tmp_bytes(&self) -> usize { B::vec_znx_normalize_tmp_bytes_impl(self) } } impl VecZnxNormalize for Module where B: Backend + VecZnxNormalizeImpl, { #[allow(clippy::too_many_arguments)] fn vec_znx_normalize( &self, res_basek: usize, res: &mut R, res_col: usize, a_basek: usize, a: &A, a_col: usize, scratch: &mut Scratch, ) where R: VecZnxToMut, A: VecZnxToRef, { B::vec_znx_normalize_impl(self, res_basek, res, res_col, a_basek, a, a_col, scratch) } } impl VecZnxNormalizeInplace for Module where B: Backend + VecZnxNormalizeInplaceImpl, { fn vec_znx_normalize_inplace(&self, base2k: usize, a: &mut A, a_col: usize, scratch: &mut Scratch) where A: VecZnxToMut, { B::vec_znx_normalize_inplace_impl(self, base2k, a, a_col, scratch) } } impl VecZnxAdd for Module where B: Backend + VecZnxAddImpl, { fn vec_znx_add(&self, res: &mut R, res_col: usize, a: &A, a_col: usize, b: &C, b_col: usize) where R: VecZnxToMut, A: VecZnxToRef, C: VecZnxToRef, { B::vec_znx_add_impl(self, res, res_col, a, a_col, b, b_col) } } impl VecZnxAddInplace for Module where B: Backend + VecZnxAddInplaceImpl, { fn vec_znx_add_inplace(&self, res: &mut R, res_col: usize, a: &A, a_col: usize) where R: VecZnxToMut, A: VecZnxToRef, { B::vec_znx_add_inplace_impl(self, res, res_col, a, a_col) } } impl VecZnxAddScalar for Module where B: Backend + VecZnxAddScalarImpl, { fn vec_znx_add_scalar(&self, res: &mut R, res_col: usize, a: &A, a_col: usize, b: &D, b_col: usize, b_limb: usize) where R: VecZnxToMut, A: ScalarZnxToRef, D: VecZnxToRef, { B::vec_znx_add_scalar_impl(self, res, res_col, a, a_col, b, b_col, b_limb) } } impl VecZnxAddScalarInplace for Module where B: Backend + VecZnxAddScalarInplaceImpl, { fn vec_znx_add_scalar_inplace(&self, res: &mut R, res_col: usize, res_limb: usize, a: &A, a_col: usize) where R: VecZnxToMut, A: ScalarZnxToRef, { B::vec_znx_add_scalar_inplace_impl(self, res, res_col, res_limb, a, a_col) } } impl VecZnxSub for Module where B: Backend + VecZnxSubImpl, { fn vec_znx_sub(&self, res: &mut R, res_col: usize, a: &A, a_col: usize, b: &C, b_col: usize) where R: VecZnxToMut, A: VecZnxToRef, C: VecZnxToRef, { B::vec_znx_sub_impl(self, res, res_col, a, a_col, b, b_col) } } impl VecZnxSubInplace for Module where B: Backend + VecZnxSubInplaceImpl, { fn vec_znx_sub_inplace(&self, res: &mut R, res_col: usize, a: &A, a_col: usize) where R: VecZnxToMut, A: VecZnxToRef, { B::vec_znx_sub_inplace_impl(self, res, res_col, a, a_col) } } impl VecZnxSubNegateInplace for Module where B: Backend + VecZnxSubNegateInplaceImpl, { fn vec_znx_sub_negate_inplace(&self, res: &mut R, res_col: usize, a: &A, a_col: usize) where R: VecZnxToMut, A: VecZnxToRef, { B::vec_znx_sub_negate_inplace_impl(self, res, res_col, a, a_col) } } impl VecZnxSubScalar for Module where B: Backend + VecZnxSubScalarImpl, { fn vec_znx_sub_scalar(&self, res: &mut R, res_col: usize, a: &A, a_col: usize, b: &D, b_col: usize, b_limb: usize) where R: VecZnxToMut, A: ScalarZnxToRef, D: VecZnxToRef, { B::vec_znx_sub_scalar_impl(self, res, res_col, a, a_col, b, b_col, b_limb) } } impl VecZnxSubScalarInplace for Module where B: Backend + VecZnxSubScalarInplaceImpl, { fn vec_znx_sub_scalar_inplace(&self, res: &mut R, res_col: usize, res_limb: usize, a: &A, a_col: usize) where R: VecZnxToMut, A: ScalarZnxToRef, { B::vec_znx_sub_scalar_inplace_impl(self, res, res_col, res_limb, a, a_col) } } impl VecZnxNegate for Module where B: Backend + VecZnxNegateImpl, { fn vec_znx_negate(&self, res: &mut R, res_col: usize, a: &A, a_col: usize) where R: VecZnxToMut, A: VecZnxToRef, { B::vec_znx_negate_impl(self, res, res_col, a, a_col) } } impl VecZnxNegateInplace for Module where B: Backend + VecZnxNegateInplaceImpl, { fn vec_znx_negate_inplace(&self, a: &mut A, a_col: usize) where A: VecZnxToMut, { B::vec_znx_negate_inplace_impl(self, a, a_col) } } impl VecZnxRshTmpBytes for Module where B: Backend + VecZnxRshTmpBytesImpl, { fn vec_znx_rsh_tmp_bytes(&self) -> usize { B::vec_znx_rsh_tmp_bytes_impl(self) } } impl VecZnxLshTmpBytes for Module where B: Backend + VecZnxLshTmpBytesImpl, { fn vec_znx_lsh_tmp_bytes(&self) -> usize { B::vec_znx_lsh_tmp_bytes_impl(self) } } impl VecZnxLsh for Module where B: Backend + VecZnxLshImpl, { fn vec_znx_lsh( &self, base2k: usize, k: usize, res: &mut R, res_col: usize, a: &A, a_col: usize, scratch: &mut Scratch, ) where R: VecZnxToMut, A: VecZnxToRef, { B::vec_znx_lsh_impl(self, base2k, k, res, res_col, a, a_col, scratch); } } impl VecZnxRsh for Module where B: Backend + VecZnxRshImpl, { fn vec_znx_rsh( &self, base2k: usize, k: usize, res: &mut R, res_col: usize, a: &A, a_col: usize, scratch: &mut Scratch, ) where R: VecZnxToMut, A: VecZnxToRef, { B::vec_znx_rsh_impl(self, base2k, k, res, res_col, a, a_col, scratch); } } impl VecZnxLshInplace for Module where B: Backend + VecZnxLshInplaceImpl, { fn vec_znx_lsh_inplace(&self, base2k: usize, k: usize, a: &mut A, a_col: usize, scratch: &mut Scratch) where A: VecZnxToMut, { B::vec_znx_lsh_inplace_impl(self, base2k, k, a, a_col, scratch) } } impl VecZnxRshInplace for Module where B: Backend + VecZnxRshInplaceImpl, { fn vec_znx_rsh_inplace(&self, base2k: usize, k: usize, a: &mut A, a_col: usize, scratch: &mut Scratch) where A: VecZnxToMut, { B::vec_znx_rsh_inplace_impl(self, base2k, k, a, a_col, scratch) } } impl VecZnxRotate for Module where B: Backend + VecZnxRotateImpl, { fn vec_znx_rotate(&self, k: i64, res: &mut R, res_col: usize, a: &A, a_col: usize) where R: VecZnxToMut, A: VecZnxToRef, { B::vec_znx_rotate_impl(self, k, res, res_col, a, a_col) } } impl VecZnxRotateInplaceTmpBytes for Module where B: Backend + VecZnxRotateInplaceTmpBytesImpl, { fn vec_znx_rotate_inplace_tmp_bytes(&self) -> usize { B::vec_znx_rotate_inplace_tmp_bytes_impl(self) } } impl VecZnxRotateInplace for Module where B: Backend + VecZnxRotateInplaceImpl, { fn vec_znx_rotate_inplace(&self, k: i64, a: &mut A, a_col: usize, scratch: &mut Scratch) where A: VecZnxToMut, { B::vec_znx_rotate_inplace_impl(self, k, a, a_col, scratch) } } impl VecZnxAutomorphism for Module where B: Backend + VecZnxAutomorphismImpl, { fn vec_znx_automorphism(&self, k: i64, res: &mut R, res_col: usize, a: &A, a_col: usize) where R: VecZnxToMut, A: VecZnxToRef, { B::vec_znx_automorphism_impl(self, k, res, res_col, a, a_col) } } impl VecZnxAutomorphismInplaceTmpBytes for Module where B: Backend + VecZnxAutomorphismInplaceTmpBytesImpl, { fn vec_znx_automorphism_inplace_tmp_bytes(&self) -> usize { B::vec_znx_automorphism_inplace_tmp_bytes_impl(self) } } impl VecZnxAutomorphismInplace for Module where B: Backend + VecZnxAutomorphismInplaceImpl, { fn vec_znx_automorphism_inplace(&self, k: i64, res: &mut R, res_col: usize, scratch: &mut Scratch) where R: VecZnxToMut, { B::vec_znx_automorphism_inplace_impl(self, k, res, res_col, scratch) } } impl VecZnxMulXpMinusOne for Module where B: Backend + VecZnxMulXpMinusOneImpl, { fn vec_znx_mul_xp_minus_one(&self, p: i64, res: &mut R, res_col: usize, a: &A, a_col: usize) where R: VecZnxToMut, A: VecZnxToRef, { B::vec_znx_mul_xp_minus_one_impl(self, p, res, res_col, a, a_col); } } impl VecZnxMulXpMinusOneInplaceTmpBytes for Module where B: Backend + VecZnxMulXpMinusOneInplaceTmpBytesImpl, { fn vec_znx_mul_xp_minus_one_inplace_tmp_bytes(&self) -> usize { B::vec_znx_mul_xp_minus_one_inplace_tmp_bytes_impl(self) } } impl VecZnxMulXpMinusOneInplace for Module where B: Backend + VecZnxMulXpMinusOneInplaceImpl, { fn vec_znx_mul_xp_minus_one_inplace(&self, p: i64, res: &mut R, res_col: usize, scratch: &mut Scratch) where R: VecZnxToMut, { B::vec_znx_mul_xp_minus_one_inplace_impl(self, p, res, res_col, scratch); } } impl VecZnxSplitRingTmpBytes for Module where B: Backend + VecZnxSplitRingTmpBytesImpl, { fn vec_znx_split_ring_tmp_bytes(&self) -> usize { B::vec_znx_split_ring_tmp_bytes_impl(self) } } impl VecZnxSplitRing for Module where B: Backend + VecZnxSplitRingImpl, { fn vec_znx_split_ring(&self, res: &mut [R], res_col: usize, a: &A, a_col: usize, scratch: &mut Scratch) where R: VecZnxToMut, A: VecZnxToRef, { B::vec_znx_split_ring_impl(self, res, res_col, a, a_col, scratch) } } impl VecZnxMergeRingsTmpBytes for Module where B: Backend + VecZnxMergeRingsTmpBytesImpl, { fn vec_znx_merge_rings_tmp_bytes(&self) -> usize { B::vec_znx_merge_rings_tmp_bytes_impl(self) } } impl VecZnxMergeRings for Module where B: Backend + VecZnxMergeRingsImpl, { fn vec_znx_merge_rings(&self, res: &mut R, res_col: usize, a: &[A], a_col: usize, scratch: &mut Scratch) where R: VecZnxToMut, A: VecZnxToRef, { B::vec_znx_merge_rings_impl(self, res, res_col, a, a_col, scratch) } } impl VecZnxSwitchRing for Module where B: Backend + VecZnxSwitchRingImpl, { fn vec_znx_switch_ring(&self, res: &mut R, res_col: usize, a: &A, a_col: usize) where R: VecZnxToMut, A: VecZnxToRef, { B::vec_znx_switch_ring_impl(self, res, res_col, a, a_col) } } impl VecZnxCopy for Module where B: Backend + VecZnxCopyImpl, { fn vec_znx_copy(&self, res: &mut R, res_col: usize, a: &A, a_col: usize) where R: VecZnxToMut, A: VecZnxToRef, { B::vec_znx_copy_impl(self, res, res_col, a, a_col) } } impl VecZnxFillUniform for Module where B: Backend + VecZnxFillUniformImpl, { fn vec_znx_fill_uniform(&self, base2k: usize, res: &mut R, res_col: usize, source: &mut Source) where R: VecZnxToMut, { B::vec_znx_fill_uniform_impl(self, base2k, res, res_col, source); } } impl VecZnxFillNormal for Module where B: Backend + VecZnxFillNormalImpl, { fn vec_znx_fill_normal( &self, base2k: usize, res: &mut R, res_col: usize, k: usize, source: &mut Source, sigma: f64, bound: f64, ) where R: VecZnxToMut, { B::vec_znx_fill_normal_impl(self, base2k, res, res_col, k, source, sigma, bound); } } impl VecZnxAddNormal for Module where B: Backend + VecZnxAddNormalImpl, { fn vec_znx_add_normal( &self, base2k: usize, res: &mut R, res_col: usize, k: usize, source: &mut Source, sigma: f64, bound: f64, ) where R: VecZnxToMut, { B::vec_znx_add_normal_impl(self, base2k, res, res_col, k, source, sigma, bound); } }