Download presentation

Presentation is loading. Please wait.

1
Calculating Spectral Coefficients for Walsh Transform using Butterflies Marek Perkowski September 21, 2005

2
Symbols a -- the number of true minterms of Boolean function F, where both the function F and the standard trivial function have the logical values 1; b -- the number of false minterms of Boolean function F, where the function F has the logical value 0 and the standard trivial function has the logical value 1; c -- the number of true minterms of Boolean function F, where the function F has the logical value 1 and the standard trivial function has the logical value 0; d -- the number of false minterms of Boolean function F, where both the function F and the standard trivial function have the logical values 0, and e be the number of don't care minterms of Boolean function F.

3
Then, for completely specified Boolean functions having n variables, this formula holds: a + b + c + d = 2 n Accordingly, for incompletely specified Boolean functions, having n variables, holds: a + b + c + d + e = 2 n

4
X Y 0 1 1 0 1 1 Data Function X Y 0 1 1 0 Standard Trivial function for XOR of input variables X Y 0 1 1 0 Standard Trivial Function for whole map X Y 0 1 1 0 Standard Trivial function for input variable X X Y 0 1 1 0 Standard Trivial function for input variable Y

5
The spectral coefficients for completely specified Boolean function can be defined in the following way: s 0 = 2 n – 2 * a s i = 2 * (a + d) - 2 n, when i ≠ 0. X Y 0 1 1 0 1 1 a -- the number of true minterms of Boolean function F, where both the function F and the standard trivial function have the logical values 1; d -- the number of false minterms of Boolean function F, where both the function F and the standard trivial function have the logical values 0 a = 2, d = 2, n =2 s 0 = 2 n – 2 * a = 4 – 2 * 2 = 0 s 3 = 2 * (a + d) - 2 n = 2(2+2) – 4 = 4 best correlation

6
s i = 2 * (a + d) - 2 n, when i ≠ 0. X Y 0 1 1 0 1 1 a -- the number of true minterms of Boolean function F, where both the function F and the standard trivial function have the logical values 1; d -- the number of false minterms of Boolean function F, where both the function F and the standard trivial function have the logical values 0 a = 2, d = 2, n =2 s 3 = 2 * (a + d) - 2 n = 2(0+0) – 4 = - 4 worst correlation Negation of the previous function

7
X Y 0 1 1 0 1 1 a -- the number of true minterms of Boolean function F, where both the function F and the standard trivial function have the logical values 1; Other functions 1 1 s 0 = 2 n – 2 * a = 4 – 2 * 4 = - 4 X Y 0 1 1 0 0 0 0 0 s 0 = 2 n – 2 * a = 4 – 2 * 0 = + 4

8
Butterflies in S encoding + + + + - - - - 0= 0 = 1 1= 1 = -1 2= 1 = -1 3= 0 = 1 0 2 0 -2 0 0 0 4 S encoding XOR

9
Butterflies in S encoding + + + + - - - - 0= 0 = -1 1= 1 = 1 2= 1 = 1 3= 0 = -1 0 -2 0 2 0 0 0 -4 S encoding XNOR

10
Butterflies in S encoding + + + + - - - - 0= 0 = -1 1= 1 = 1 2= 1 = 1 3= 0 = 1 0 -2 2 0 2 S encoding X’ Y’

11
Butterflies in S encoding + + + + - - - - 0= 0 = 1 1= 1 = -1 2= 1 = 1 3= 0 = 1 0 2 2 0 2 2 -2 2 S encoding X’ Y

12
Butterflies in S encoding + + + + - - - - 0= 0 = 1 1= 1 = 1 2= 1 = -1 3= 0 = 1 2 0 0 -2 2 2 2 S encoding X Y’

13
Butterflies in S encoding + + + + - - - - 0= 0 = 1 1= 1 = 1 2= 1 = 1 3= 0 = -1 2 0 0 2 2 2 2 -2 S encoding X Y

14
Butterflies in S encoding + + + + - - - - 0= 0 = -1 1= 1 = -1 2= 1 = 1 3= 0 = 1 -2 0 2 0 0 0 -4 0 S encoding X’

15
Butterflies in S encoding + + + + - - - - 0= 0 = 1 1= 1 = 1 2= 1 = -1 3= 0 = -1 2 0 -2 0 0 0 4 0 S encoding X

16
Butterflies in S encoding + + + + - - - - 0= 0 = 1 1= 1 = -1 2= 1 = 1 3= 0 = -1 0 2 0 2 0 4 0 0 S encoding Y

17
Butterflies in S encoding + + + + - - - - 0= 0 = -1 1= 1 = 1 2= 1 = -1 3= 0 = 1 0 -2 0 0 -4 0 0 S encoding Y’

18
Butterflies in S encoding + + + + - - - - 0 = -1 1 = -1 2 = -1 3 = -1 -2 0 0 -4 0 0 0 S encoding Constant 1

19
Butterflies in S encoding + + + + - - - - 0= 0 = 1 1= 1 = 1 2= 1 = 1 3= 0 = 1 2 0 2 0 4 0 0 0 S encoding Constant 0

20
Butterflies in R encoding + + + + - - - - 0= 0 1= 0 2= 0 3= 0 2 0 2 0 0 0 0 0 R encoding Constant 0

21
Butterflies in R encoding + + + + - - - - 0= 1 1= 1 2= 1 3= 1 2 0 2 0 4 0 0 0 R encoding Constant 1

22
Butterflies in R encoding + + + + - - - - 0= 0 1= 1 2= 1 3= 0 1 1 1 2 0 0 -2 R encoding XOR

23
Butterflies in R encoding + + + + - - - - 0= 1 1= 0 2= 0 3= 1 1 1 1 2 0 0 2 R encoding XNOR

24
Butterflies in R encoding + + + + - - - - 0= 0 1= 1 2= 1 3= 1 1 2 0 3 R encoding X OR Y

25
Butterflies in S encoding + + + + - - - - 0= 1 1= -1 2= -1 3= -1 0 2 -2 0 2 2 2 S encoding X OR Y

26
Butterflies in S encoding + + + + - - - - 0= -1 1= -1 2= 1 3= -1 -2 0 0 2 2 S encoding X’ OR Y 11 1 X Y

27
s i = 2 * (a + d) - 2 n, when i ≠ 0. X Y 0 1 1 0 1 1 a -- the number of true minterms of Boolean function F, where both the function F and the standard trivial function have the logical values 1; d -- the number of false minterms of Boolean function F, where both the function F and the standard trivial function have the logical values 0 a = 2, d = 2, n =2 s 2 = 2 * (a + d) - 2 n = 2(1+1) – 4 = 0

28
s i = 2 * (a + d) - 2 n, when i ≠ 0. X Y 0 1 1 0 1 1 a -- the number of true minterms of Boolean function F, where both the function F and the standard trivial function have the logical values 1; d -- the number of false minterms of Boolean function F, where both the function F and the standard trivial function have the logical values 0 a = 2, d = 2, n =2 s 1 = 2 * (a + d) - 2 n = 2(1+1) – 4 = 0

29
Since each standard function has the same number of true and false minterms that is equal to 2 n-1, then we can have alternative definitions of spectral coefficients. Please note that only for the spectral coefficient s 0, is the above rule not valid and the appropriate standard function is a tautology, –i.e. the logical function that is true for all its minterms. Thus, we have: a + b = c + d = 2 n-1 and s i = 2 *(c + b) - 2 n

30
or s i = 2 * (a + d) - 2 n = 2 * (a + 2 n-1 - c) - 2 n or s i = 2 * (a + d) - 2 n = 2 * (a + d) - (a + b + c + d) = (a + d) - (b + c), when i ≠ 0. and s 0 = 2 n – 2 * a = a + b + c + d – 2 * a = b + c + d - a = b - a, since for s 0, c and d are always equal to 0.

31
The spectral coefficients for incompletely specified Boolean function, having n variables, can be defined in the following way: s 0 = 2 n – 2 * a - e and s i = 2 * (a + d) + e - 2 n, when i ≠ 0. As we can see, for the case when e = 0, i.e. for completely specified Boolean function, the above formulas reduce to the formulas presented previously.

32
All but S 0 coefficients And again, by easy mathematical transformations, we can define all but s 0 spectral coefficients in the following way: s i = 2 * (a +d) + e - 2 n = 2 * (a+d) + e - (a+b+c+d+e) = (a+d) - (b+c), when i≠ 0

33
s 0 spectral coefficient Simultaneously, the s 0 spectral coefficient can be rewritten in the following way: s 0 = 2 n - 2*a – e = a+b+c+d+e - 2*a – e = b+c+d-a = b - a, since for s 0, c and d are always equal to 0.

34
Thus, in the final formulas, describing all spectral coefficients, the number of don't care minterms e can be eliminated from them. Moreover, the final formulas are exactly the same as the ones for completely specified Boolean function. Of course, it does not mean, that the spectral coefficients for incompletely specified Boolean function do not depend on the number of don't care minterms. They do depend on those numbers, but the problem is already taken into account in the last two formulas themselves. Simply, the previously stated formula for the numbers a, b, c, d, and e bonds all these values together.

35
Properties of Transform Matrices The transform matrix is complete and orthogonal, and therefore, there is no information lost in the spectrum S, concerning the minterms in Boolean function F. Only the Hadamard-Walsh matrix has the recursive Kronecker product structure – and for this reason is preferred over other possible variants of Walsh transform known in the literature as Walsh-Kaczmarz, Rademacher-Walsh, and Walsh-Paley transforms. Only the Rademacher-Walsh transform is not symmetric; –all other variants of Walsh transform are symmetric, –so that, disregarding a scaling factor, the same matrix can be used for both the forward and inverse transform operations.

36
When the classical matrix multiplication method is used to generate the spectral coefficients for different Walsh transforms, then the only difference is the order in which particular coefficients are created. –The values of all these coefficients are the same for every Walsh transform. Each spectral coefficient s I gives a correlation value between the function F and a standard trivial function e I corresponding to this coefficient. The standard trivial functions for the spectral coefficients are, respectively, –for the coefficient s 0 ( dc coefficient ) - the universe of the Boolean function denoted by e 0, –for the coefficient s i ( first order coefficient ) – the variable x i of the Boolean function denoted by e i, Properties of Transform Matrices

37
for the coefficient s ij ( second order coefficient ) - the exclusive-or function between variables x i and x j of the Boolean function denoted by e ij, for the coefficient s ijk ( third order coefficient ) - the exclusive-or function between variables x i, x j, and x k of the Boolean function denoted by e ijk, etc. Properties of Transform Matrices cont

38
The sum of all spectral coefficients s I of spectrum S for any completely specified Boolean function is 2 n. is notThe sum of all spectral coefficients s I of spectrum S for any incompletely specified Boolean function is not 2 n. Properties of Transform Matrices

39
The maximum value of any individual spectral coefficient s I in spectrum S is 2 n. –This happens when the Boolean function is equal to either a standard trivial function e I ( sign + ) or to its complement ( sign - ). –In either case, all the remaining spectral coefficients have zero values because of the orthogonality of the transform matrix T. Each but e 0 standard trivial function e I corresponding to n variable Boolean function has the same number of true and false minterms equal to 2 n-1. Properties of Transform Matrices

40
The spectrum S of each true minterm of n variable Boolean function is given by s 0 = 2 n - 2, and all remaining 2 n - 1 spectral coefficients s I are equal to 2. Properties of Transform Matrices + + + + - - - - m0= -1 m1= -1 m2= 1 m3= 1 -2 0 2 0 0 0 -4 0 S encoding + + + + - - - - m4= -1 m5= -1 m6= 1 m7= 1 -2 0 2 0 0 0 -4 0 + + + + - - - - 0 0 - 8 0 0 0 0 0

41
The spectrum S of each true minterm of n variable Boolean function is given by s 0 = 2 n - 2, and all remaining 2 n - 1 spectral coefficients s I are equal to 2. Properties of Transform Matrices + + + + - - - - m0= -1 m1= 1 m2= 1 m3= 1 0 -2 2 0 2 S encoding + + + + - - - - m4= 1 m5= 1 m6= 1 m7= 1 2 0 2 0 4 0 0 0 + + + + - - - - 6 = 2 3 - 2 - 2

42
The spectrum S of each true minterm of n variable Boolean function is given by s 0 = 2 n - 2, and all remaining 2 n - 1 spectral coefficients s I are equal to 2. The spectrum S of each don't care minterm of n variable Boolean function is given by s 0 = 2 n - 1, –and all remaining 2 n - 1 spectral coefficients s I are equal to 1. The spectrum S of each false minterm of n variable Boolean function is given by s I = 0. Properties of Transform Matrices

43
What we achieved? 1. If the function is known to be linear or affine, by measuring once we can distinguish which one is the linear function in the box. We cannot distinguish a linear function from its negation. They differ by sign that is lost in measurement. 2. If function is a constant (zero for satisfiability and one for tautology) we can find with high probability that it is constant. –Thus we can solve SAT with high probability but without knowing which input minterm satisfies. (a single one in a Kmap of zeros) –Thus we can solve Tautology with high probability but without knowing which input minterm fails (a single zero in kmap of ones).

44
What we achieved? 3. We can find the highest spectral coefficients by generating them randomly. –In terms of signals and images it gives the basic harmonics or patterns in signal, such as textures. 4. Instead of using Hadamard gates in the transform we can use V to find a separation of some Boolean functions. But we were not able to extend this to more variables.

45
What we achieved? 5. Knowing some high coefficients, we can calculate their values exactly, one run (measurement) for each spectral coefficient.

46
Symbols a -- the number of true minterms of Boolean function F, where both the function F and the standard trivial function have the logical values 1; b -- the number of false minterms of Boolean function F, where the function F has the logical value 0 and the standard trivial function has the logical value 1; c -- the number of true minterms of Boolean function F, where the function F has the logical value 1 and the standard trivial function has the logical value 0; d -- the number of false minterms of Boolean function F, where both the function F and the standard trivial function have the logical values 0, and e be the number of don't care minterms of Boolean function F. 1 0 a=8b=0 c=0 d=8

47
s i = 2 * (a + d) - 2 n = 2 * (a + d) - (a + b + c + d) = (a + d) - (b + c), when i ≠ 0. 1 0 a=8 c=0 d=8 b=0 s i = (a + d) - (b + c) = 16

48
s i = 2 * (a + d) - 2 n = 2 * (a + d) - (a + b + c + d) = (a + d) - (b + c), when i ≠ 0. 1 0 1 0 a=7 c=0 d=8 b=1 s i = (a + d) - (b + c) = 16 Ones inside Zeros outside zeros inside Ones outside (7+8 ) - (1+0) = 14

49
s i = 2 * (a + d) - 2 n = 2 * (a + d) - (a + b + c + d) = (a + d) - (b + c), when i ≠ 0. 1 0 a=0 c=8 d=0 b=8 s i = (a + d) - (b + c) = -16

50
s i = 2 * (a + d) - 2 n = 2 * (a + d) - (a + b + c + d) = (a + d) - (b + c), when i ≠ 0. 1 0 a=4 c=4 d=4 b=4 s i = (a + d) - (b + c) = 0

51
s i = 2 * (a + d) - 2 n = 2 * (a + d) - (a + b + c + d) = (a + d) - (b + c), when i ≠ 0. 1 0 a=4 c=4 d=4 b=4 s i = (a + d) - (b + c) = 0

52
s i = 2 * (a + d) - 2 n = 2 * (a + d) - (a + b + c + d) = (a + d) - (b + c), when i ≠ 0. 1 0 1 0 a=3 c=4 d=4 b=4 s i = (a + d) - (b + c) = (3+4) – (4+4) = -1

53
Problems for students Butterfly for Hadamard Software for Hadamard Matrices for Hadamard Hadamard coefficients Basic Orthogonal functions and their meanings. Use Kmaps.

Similar presentations

© 2019 SlidePlayer.com Inc.

All rights reserved.

To make this website work, we log user data and share it with processors. To use this website, you must agree to our Privacy Policy, including cookie policy.

Ads by Google