Hello

Thanks for your informative replies. I am kinda new to git but I will
try to figure out how to do pull requests (do I need to create a
separate fork in github that you can pull?)
We probably also need some sort of class to handle mixed control gates
ie. trigger on some qubits on and some off. I was fiddling around with
making the gate listen to the control value to determine filled or not
filled, but I didn't wont to mess to much with the API.

Regarding the CNOT gate I think we should also add a note in the
documentation or a more clearly worded error to indicate that it is
not supposed to be able to handle more than one control qubit. Right
now the documentation for CNOT and CGate looks very much the same.

I am new to contributing but I will try to come up with some suggestions.

-Hans

On Fri, Oct 7, 2011 at 11:07 PM, Brian Granger <elliso...@gmail.com> wrote:
> On Thu, Oct 6, 2011 at 2:19 PM, Hans Harhoff Andersen
> <hansharh...@gmail.com> wrote:
>> I just checked that the problem persists even in newest git version.
>
> I should mention that I don't consider this to be a bug as most people
> use the word "CNOT gate" to mean the two qubit gate.
>
>> Also I have a feature request for circuit_plot. It would be very nice
>> to have a way of making circuit plot display unfilled circles for
>> controls which are triggered on qubit being in 0 state instead of
>> state 1 (cf. Nielsen and Chuang book for examples of this eg. page 193
>> (fig. 4.16)).
>> Without this feature you have to include a lot of NOTs in your circuit
>> digram which makes it ugly and unreadable.
>
> A simple subclass of CGate would accomplish this:
>
> class AntiCGate(CGate):
>
>    control_value = Integer(0)
>
>    def plot_gate(self, circ_plot, gate_idx):
>        min_wire = int(min(chain(self.controls, self.targets)))
>        max_wire = int(max(chain(self.controls, self.targets)))
>        circ_plot.control_line(gate_idx, min_wire, max_wire)
>        for c in self.controls:
>            circ_plot.anti_control_point(gate_idx, int(c))
>        self.gate.plot_gate(circ_plot, gate_idx)
>
> This would also require the anti_control_point method of
> circuitplot.CircuitPlot:
>
>        def anti_control_point(self, gate_idx, wire_idx):
>            """Draw a control point."""
>            x = self._gate_grid[gate_idx]
>            y = self._wire_grid[wire_idx]
>            radius = self.control_radius
>            c = Circle(
>                (x,y),
>                radius*self.scale,
>                ec='k',
>                fc='k',
>                fill=False,
>                lw=self.linewidth
>            )
>            self._axes.add_patch(c)
>
> Could you create a pull request on github with these changes?  I am
> short on time right now and won't be able to get to this for a while.
> If you can't create a pull request, please open an issue with this
> information.
>
> Cheers,
>
> Brian
>
>
>
>
>> Best regards, Hans
>>
>> On Oct 6, 9:13 pm, Hans Harhoff Andersen <hansharh...@gmail.com>
>> wrote:
>>> I suspect that this is a bug since I can get it to work by writing:
>>> gate.CGate((2,1),gate.X(0))
>>>
>>> When I do
>>> gate.CNOT((2,1),0)
>>> I get:
>>> TypeError: List indices must be integers, not Tuple
>>>
>>> On Thu, Oct 6, 2011 at 8:54 PM, Hans Harhoff Andersen
>>>
>>>
>>>
>>>
>>>
>>>
>>>
>>> <hansharh...@gmail.com> wrote:
>>> > Hi Sympy.
>>>
>>> > I am trying to use circuit_plot to plot my quantum circuit. I can get
>>> > CNOT and such gates working, but I can't get the Toffoli/CCNOT gate to
>>> > plot. As I read the documentation I should be able to use mutiple
>>> > control qubits on the CNOT gate by writing something like:
>>> > gate.CNOT([2,1],0) to have qubit 1 and 2 control qubit 0. But this
>>> > doesn't work with sympy 0.7.
>>>
>>> > Any hints or suggestions?
>>
>> --
>> You received this message because you are subscribed to the Google Groups 
>> "sympy" group.
>> To post to this group, send email to sympy@googlegroups.com.
>> To unsubscribe from this group, send email to 
>> sympy+unsubscr...@googlegroups.com.
>> For more options, visit this group at 
>> http://groups.google.com/group/sympy?hl=en.
>>
>>
>
>
>
> --
> Brian E. Granger
> Cal Poly State University, San Luis Obispo
> bgran...@calpoly.edu and elliso...@gmail.com
>
> --
> You received this message because you are subscribed to the Google Groups 
> "sympy" group.
> To post to this group, send email to sympy@googlegroups.com.
> To unsubscribe from this group, send email to 
> sympy+unsubscr...@googlegroups.com.
> For more options, visit this group at 
> http://groups.google.com/group/sympy?hl=en.
>
>

-- 
You received this message because you are subscribed to the Google Groups 
"sympy" group.
To post to this group, send email to sympy@googlegroups.com.
To unsubscribe from this group, send email to 
sympy+unsubscr...@googlegroups.com.
For more options, visit this group at 
http://groups.google.com/group/sympy?hl=en.

Reply via email to