Download as pdf or txt
Download as pdf or txt
You are on page 1of 17

Multiplication and Convolution:

Consider the following binary representation


"#$ "#$

h = # ℎ !! 2 !! , x = # x!" 2!" , ℎ' , 𝑥! ∈ {0,1}


!! %& !" %&

Then the product of x and h can be computed as


"#$ "#$

y = x ∙ h = 1 # x !" 2 !" 2 1 # h !! 2 !! 2
!" %& !! %&
"#$ "#$

= # # h!! ∙ x!" ∙ 2!! )!"


!! %& !" %&

Changing the coordinates with i3=i1+i2 gives


*"#* "#$

y = # ( # h!! ∙ x!# #!! ) 2!#


!# %& !! %&
*"#*

= # y!# ∙ 2!# , note y!# is no longer binary code


!# %&
"#$

⇒ y!# = # h!! ∙ x!# #!! : convolution


!! %&

:A scalar multiplication can be viewed as the convolution of


two binary sequences.
Now if we extend the above derivation as
ℎ → ℎ(𝑥)
} a polynomial with degree B-1
𝑥 → 𝑥(𝑥)
ℎ' , 𝑥! ∈ 𝐹 : Some chosen fixed field and the scalar product is
now replaced by the polynomial product, then one can easily
get the following conclusion:
A polynomial product can be viewed as the convolution of
two scalar sequences.

Now let us consider the scalar convolution in the binary form,


that is
-#$

y+ = # h, x+#, , 𝑙 = 0, 1, … , 2𝑁 − 2
,%&
"#$

h, = # h,,/! 2/!
/! %&
"#$ ; h,,/! , x0,/" ∈ {0, 1}
x0 = # x0,/" 2/"
/" %&
-#$ "#$ "#$

⇒ y+ = # # # h,,/! ∙ x+#,,/" 2/! )/"


,%& /! %& /" %&
set b1 = b$ + b* as before,
*"#* -#$ "#$

y+ = # ( # # h,,/! x+#,,/# #/! )22#


/# %& ,%& /! %&
-#$ "#$

⇒ y+ ,/# = # # h,,/! ∙ x+#,,/# #/!


,%& /! %&

⇒ two − dimensional convolution


Note also that, y+ ,/# is not necessary belong to {0,1}.
: A scalar convolution can be viewed as the 2-D scalar
convolution of two scalar arrays.

By the same extension procedures given above, we can get


the following useful conclusion:
A polynomial convolution can be viewed as the 2-D scalar
convolution of two scalar arrays.

This conclusion implies that:


A 2-D scalar convolution can be computed as a polynomial
convolution: polynomial transformation
Polynomial Transforms ( PTs )
PTs can be viewed as DFTs defined in rings of polynomials. PTs
can be computed without multiplications using ordinary
arithmetic and produce an efficient mapping of Multi-D
convolutions into 1-D convolutions and polynomial products.

2-D array:
X(n, m) h(n, m)
... X0(z) ... H0(z)

... X1(z) ... H1(z)


. .
. .
. .

... XN-1(z) ... HN-1(z)

-#$ -#$

𝑋, (𝑧) = # x(n, m)𝑧 0 𝐻, (𝑧) = # h(n, m)𝑧 0


0%& 0%&

1-D polynomial sequences


{ X0(z), X1(z), …, XN-1(z) } { H0(z), H1(z), …, HN-1(z) }
Then

-#$
Convolution of
𝑌+ (𝑧) = # 𝐻, (𝑧)𝑋+#, (𝑧)
,%& polynomial sequences

-#$ -#$

y(𝑙, 𝑚) = # # x(𝑛, 𝑘 )h(𝑙 − 𝑛, 𝑚 − 𝑘)


,%& 3%&

2-D convolution of polynomial


coefficient arrays
-#$

𝑋, (𝑧) = # x(n, m)𝑧 0


0%&
-#$

𝐻, (𝑧) = # h(n, m)𝑧 0


0%&
-#$

𝑌+ (𝑧) = # 𝐻, (𝑧)𝑋+#, (𝑧)


,%&
-#$ -#$ -#$

= # # # x(𝑛, 𝑘 )h(𝑙 − 𝑛, 𝑠) 𝑧 3)4


,%& 3%& 4%&

Let m = k+s mod N s = m-k mod N

-#$ -#$ -#$

𝑌+ (𝑧) = # # # x(𝑛, 𝑘)h(𝑙 − 𝑛, 𝑚 − 𝑘 ) 𝑧 5


,%& 3%& 0%&
-#$

= # y(l, 𝑚) 𝑧 5
0%&
-#$ -#$ -#$

= # # # x(𝑛, 𝑘)h(𝑙 − 𝑛, 𝑚 − 𝑘 ) 𝑧 5
,%& 6%& 3%&
-#$

= # y(l, 𝑚) 𝑧 5
0%&
-#$ -#$

So, y(l, 𝑚) = # # x(𝑛, 𝑘 )h(𝑙 − 𝑛, 𝑚 − 𝑘)


,%& 3%&
-#$

That is, the polynomial convolution # 𝐻, (𝑧)𝑋+#, (𝑧) can be tre


,%&

2-D convolution of the two scalar(coefficient) arrays x(n, m)


and h(n,m)

Recall, 1-D scalar convolution can be computed very


efficiently through DFTs. Could this fact be extended to higher
dimensions?
In order to verify this conjecture, we introduce a transform
H3 (z) which has the same structure as the DFT, but with the
usual complex exponential operator replaced by one defined
as an exponential on the variable Z with all operations
defined modulo P(z). This transform is called the Polynomial
Transform and is defined as
8#$

X3 (z) = # X$,7 (z)z 73 mod P(z) , 𝑘 = 0,1, ⋯ , P − 1.


9%&

X$,7 (z) = X 7 (z) mod P(z)


And the corresponding inverse transform is defined as
8#$
1
X$,7 (z) = # X3 (z) z #9: mod P(z)
P
:%&

For supporting circular convolution, P(z) can be selected as


ZP-1 and PTs and IPTs can be reduced to
8#$

X3 (z) = # X 7 (z) z 9: mod (z ; − 1)


:%&

and
8#$
1
X 7 ( z) = # X3 (z) z #73 mod (z 8 − 1)
P
:%&

2-D circular convolution → 1-D polynomial convolution →


Polynomial Transforms
8<
X 7 (z) bc X3 (z)
8< =8<
H7 (z) bc H3 (z) bc H7 (z) ∗> X 7 (z)
Polynomial multiplication
modulo (zP-1)
Since z 8 − 1 = ∏?'%$ P' (z)
The degree of each cyclotomic polynomial Pi(z) is φ(𝑒! )
where 𝑒! |P. Since Pi(z) is irreducible, the polynomial
convolution (or PT) defined modulo (zP-1 ) can be computed
separately modulo each polynomial Pi(z), with reconstruction
of the final result by the CRT for polynomials.

Remark: Generalized Polynomial Transform


With the three following 3 conditions:
1. 𝑔- (z) ≡ 1 mod P(z)
2. N and g(z) have inverses modulo P(z)
A#$ @3 0 𝑓𝑜𝑟 𝑞 ≠ 0 mod 𝑁

3. S ≡ :%& 𝑔(𝑧) modulo P(z) ≡ l
𝑁 𝑓𝑜𝑟 𝑞 = 0 mod 𝑁
A polynomial convolution Yl(z) is computed by PTs with
A#$

Y+ (z) = # 𝐻0 (z)𝑋+#0 (z) mod P(z)


5%&
2#$

𝐻0 (z) = # h,,0 z B
B%&
2#$

𝑋7 (z) = # X 4,7 z C
B%&
A#$

𝐻3 (z) = # 𝐻0 (𝑧)[𝑔(𝑧)]03 mod P(z) , deguP(z)v = b


5%&
A#$
1
𝑌+ (𝑧) = # 𝐻3 (z) ∙ 𝑋3 (z)[𝑔(z)]#+3 mod P(z)
N
:%&

When a 2-D convolution has common factors in both


dimensions, it is always possible to define PTs which have
very simple roots g(z) and which can be computed without
multiplications.
Let Xn,m and Hn,m be two N*M arrays, then the 2-Dcircular
convolution Xn,m and Hn,m is defined by
-#$ E#$
𝑙 = 0, 1, … , N − 1
y+,D = # # 𝑋,,0 ℎ+#,,D#0 𝑓𝑜𝑟
𝑎 = 0, 1, … , M − 1 ,
,%& 0%&

Now define
E#$

𝑋, (𝑧) = # 𝑥,,0 𝑧 0 mod (𝑧 F − 1)


0%&
E#$

𝐻, (𝑧) = # ℎ,,0 𝑧 0 mod (𝑧 F − 1) ,


0%&

for n = 0, 1, … , N − 1
E#$

𝑎𝑛𝑑 𝑌+ (𝑧) = # 𝑦G,D 𝑧 H mod (𝑧 F − 1) ,


D%&

for 𝑙 = 0, 1, … , N − 1
E#$ -#$ E#$

= # ( # # 𝑋,,0 ℎ+#,,D#0 )𝑧 H mod (𝑧 F − 1)


D%& ,%& 0%&
Set t = a-m, then
E#$#0 -#$ E#$

𝑌+ (𝑧) = # ( # # 𝑋,,0 ℎ+#,,I )𝑧 J)5 mod (𝑧 F − 1)


I%#0 ,%& 0%&
-#$ E#$ E#$#0

= # # ( # 𝑋,,0 ℎ+#,,I 𝑧 J ) 𝑧 5 mod (𝑧 F − 1)


,%& 0%& I%#0
E#$#0

Since # 𝑋,,0 ℎ+#,,I 𝑧 J


I%#0
E#$

≡ # 𝑋,,0 ℎ+#,,I 𝑧 J mod (𝑧 F − 1)


I%&

So ∶ 𝑌+ (𝑧)
-#$ E#$ E#$

= # ( # 𝑋,,0 𝑧 5 )( # ℎ+#,,I 𝑧 J ) mod (𝑧 F − 1)


,%& 0%& I%&
-#$

= # 𝑋, (𝑧) 𝐻+#, (𝑧) mod (𝑧 F − 1)


,%&

= 𝑋, (𝑧) ∗K 𝐻+#, (𝑧)


1+z -1+0z 3+2z 0

2-z 4+2z -5-2z 2

-2-z 3+2z 7+2z 1

2+3z -1+2z 3
0-4z z 4+0z
Ex. Consider a simple convolution of 3x3.
2 3 1 2 1 2
H,,0 = }4 2 0€ X 4,7 = }1 3 0€
3 1 4 2 1 5
P = 3, z 1 − 1 = (z − 1)(z * + z + 1) = (z − 1)P(z)

Y$,+ (z) = Y+ (z) mod P(z)


Y*,+ (z) = Y+ (z) mod (z − 1)
Y+ (z) = S$ (z)Y$,+ (z) + S* (z)Y*,+ (z) mod (z 1 − 1)
S$ (z) = [3 − P(z)]⁄3
S* (z) = P(z)⁄3
After reduction modulo P(z), we have [z * = −z − 1]
H$,, (z): {(2 − 1), (3 − 1)} = {1,2} X$,7 (z): {0, −1}
{(4 − 0), (2 − 0)} = {4,2} {1,3}
{(3 − 4), (1 − 4)} = {−1, −3} {−3, −4}
*

H3 (z) = # H$,, (z)z ,3 mod (z * + z + 1)


B%&
*

H& (z) = # H$,, (z) mod (z * + z + 1)


B%&

= {(1 + 4 − 1), (2 + 2 − 3)} = {4,1}


*

H$ (z) = # H$,, (z) z B mod (z * + z + 1)


B%&

= {1,2} + {4,2}z + {−1, −3}z * = {−3,5}


*

H* (z) = # H$,, (z) z *B mod (z * + z + 1) = {2,0}


B%&

x3 (z) = {−2, −2}


{−4,0}
{6, −1}
T$ (z)
= [−z 8#* − 2z 8#1 − ⋯ − (P − 3)z * − (P − 2)z − (P − 1)]⁄P
= −(z + 2)⁄3 (where P = 3)
Thus, the polynomial, multiplication are defined by
−(z + 2)H3 (z)X3 (z)⁄9 mod P(z): {4,14}⁄9
{−44,8}⁄9
{−26, −10}⁄9

Computing the inverse PT of this result yields


{−66,12}⁄9
Y$,+ (z) = {66,42}⁄9
{12, −12}⁄9
The reduction modulo (z-1) are given by
H*,5 = {6,6,8} X *,9 = {5,4,8}
Which yields the length-3 convolution
Y*,+ (z) = {110,118,112}⁄3
The 2-D convolution output yL,+ is generated by CRT
reconstruction of Y$,+ (z) and Y*,+ (z)
44, 28, 38
YL,+ = }32, 42, 44€
36, 40, 36
Xs,r

Ordering of polynomial

Xr (z)

Reduction Reduction
mod P(z) Mod (z-1)

X1,r (z) X2,r (z)

Polynomial Transform P-point 1


𝐻$,&
module P(z) Convolution 𝑃

Mod p(z)
+
Xk (z)

P Polynomial Multiplications + k(z)


𝑇! (z)H
mod P(z)

Inverse
PT mod P(z)

𝑌!,# (z) 𝑌$,#

CRT
Reconstruction

𝑦%,#

You might also like