Chris Pollett > Students >
Chen

    ( Print View )

    [Bio]

    [CS297Proposal]

    [Del1]

    [Del2]

    [Del3]

    [CS297Report-PDF]

    [CS298Proposal]

    [CS298FinalReport-PDF]

    [CS298Presentation-PDF]

                            

























Simulating the classical log-depth, AND, OR, NOT circuits for threshold gates

threshold gate
Figure 1:A threshold gate

As Figure 1 shows, the input for the threshold gate is a 0-1 vector of A=(a1, a2,...,an) and a threshold value k, the output is a 0/1 value, which is:

   if  (a1+a2+...+an >= k)  then

      Output = 1

   else

      Output = 0

The value of the above threshold gate Ta1, a2,..,ank can be evaluated in the following recursive way:

  • Ta1, a2,...,ank = Ta1, a2,...,an/20 AND Ta(n/2+1), a(n/2+2),...,ank OR Ta1, a2, ... ,an/21 OR Ta(n/2+1),a(n/2+2),...,ank-1 OR ... OR Ta1, a2,...,an/2k AND Ta(n/2+1), a(n/2+2),...,an0
  • Tn0...= 1
  • Ta1,a2,...,aji = 0    if j>i

Thus, we can construct a circuit with classical AND and OR gates to simulate a threshold gate. It is easy to see that the depth of this evaluation is log(n). We use the above algorithm to implement our program.

In this implementation, we use three classes. A CAND class is used for defining and operating a classical AND gate. Similarly, a COR class is created for OR gate. Finally, a CThreshold class is used for describing a threshold gate. We first construct a classical circuit consist of AND and OR gates for threshold gate. Then given input bits and a threshold value m, we evaluate the circuit and output the result.

Here is a link to a directory containing my code.