On Sat, Nov 26, 2011 at 7:29 PM, David Ju <sgtmook...@gmail.com> wrote:
> class OracleGate(Gate):
>     """A black box gate.
>     The gate marks the desired qubits of an unknown function by flipping
>     the sign of the qubits.  The unknown function returns true when it
>     finds its desired qubits and false otherwise.
>     Parameters
>     ==========
>     qubits : int
>         Number of qubits.
>     oracle : callable
>         A callable function that returns a boolean on a computational basis.
>     Examples
>     ========
>     Apply an Oracle gate that flips the sign of |2> on different qubits::
>         >>> from sympy.physics.quantum.qubit import IntQubit
>         >>> from sympy.physics.quantum.qapply import qapply
>         >>> from sympy.physics.quantum.grover import OracleGate
>         >>> f = lambda qubits: qubits == IntQubit(2)
>         >>> v = OracleGate(2, f)
>         >>> qapply(v*IntQubit(2))
>         -|2>
>         >>> qapply(v*IntQubit(3))
>         |3>
>     """
> In this example for OracleGate in sympy.physics.quantum.grover , the python
> lambda is used, and cannot be converted into the sympy Lambda class. This
> has resulted in some problem in test_args.
>

Right.  Would it be possible to use only Lambda here?  I don't know
what kinds of boolean expressions are used, if they are only simple
ones that can be represented by And(), Or(), Eq(), etc., or if it
really needs the fully power of Python lambda.  And if it can't use
Lambda, what is a good solution, since the args should all be Basic
(that is the problem with test_args).

Aaron Meurer

-- 
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