@@ -11,10 +11,10 @@ use std::{
11
11
} ;
12
12
13
13
#[ allow( clippy:: many_single_char_names) ]
14
- pub fn convolution < M : Modulus > (
15
- a : & [ StaticModInt < M > ] ,
16
- b : & [ StaticModInt < M > ] ,
17
- ) -> Vec < StaticModInt < M > > {
14
+ pub fn convolution < M > ( a : & [ StaticModInt < M > ] , b : & [ StaticModInt < M > ] ) -> Vec < StaticModInt < M > >
15
+ where
16
+ M : Modulus ,
17
+ {
18
18
if a. is_empty ( ) || b. is_empty ( ) {
19
19
return vec ! [ ] ;
20
20
}
@@ -49,14 +49,12 @@ pub fn convolution<M: Modulus>(
49
49
a
50
50
}
51
51
52
- pub fn convolution_raw <
53
- T : RemEuclidU32 + TryFrom < u32 , Error = E > + Clone ,
54
- E : fmt:: Debug ,
52
+ pub fn convolution_raw < T , M > ( a : & [ T ] , b : & [ T ] ) -> Vec < T >
53
+ where
54
+ T : RemEuclidU32 + TryFrom < u32 > + Clone ,
55
+ T :: Error : fmt:: Debug ,
55
56
M : Modulus ,
56
- > (
57
- a : & [ T ] ,
58
- b : & [ T ] ,
59
- ) -> Vec < T > {
57
+ {
60
58
let a = a. iter ( ) . cloned ( ) . map ( Into :: into) . collect :: < Vec < _ > > ( ) ;
61
59
let b = b. iter ( ) . cloned ( ) . map ( Into :: into) . collect :: < Vec < _ > > ( ) ;
62
60
convolution :: < M > ( & a, & b)
@@ -110,9 +108,9 @@ pub fn convolution_i64(a: &[i64], b: &[i64]) -> Vec<i64> {
110
108
let i2 = internal_math:: inv_gcd ( M1M3 as _ , M2 as _ ) . 1 ;
111
109
let i3 = internal_math:: inv_gcd ( M1M2 as _ , M3 as _ ) . 1 ;
112
110
113
- let c1 = convolution_raw :: < i64 , _ , M1 > ( a, b) ;
114
- let c2 = convolution_raw :: < i64 , _ , M2 > ( a, b) ;
115
- let c3 = convolution_raw :: < i64 , _ , M3 > ( a, b) ;
111
+ let c1 = convolution_raw :: < i64 , M1 > ( a, b) ;
112
+ let c2 = convolution_raw :: < i64 , M2 > ( a, b) ;
113
+ let c3 = convolution_raw :: < i64 , M3 > ( a, b) ;
116
114
117
115
c1. into_iter ( )
118
116
. zip ( c2)
0 commit comments