ECE 1620 - Assignment #7 Extra - Due: 22 March 2019


  1. a7/p3.c - quantum computing simulation plot

    Start with a copy of your program from part 2. Then: remove the scanf() and just set n=5; remove the parts involving fx(); and remove all output except for printing the value of P0.

    Then write your own quantum Boolean function in the form: void fqv( double q[], int M, int v);
    which represents f=1 for x<v, f=0 for x≥v, i.e. it is neither constant nor balanced, but variable, depending on the value of v.

    In the main program, perform the quantum simulation in a loop over the possible values of v, something like this:

      for( int v = 0; v <= N; ++v)
      {
        init( q, M); H( q, M); fqv( q, M, v); H( q, M);
        ..
    
    and for each value of v print v and P0, so the output is a table with two columns suitable for plotting.

    The result should show how the quantum probability of the function being constant varies vs. the number of 1's.

    Sample plot