本文整理汇总了Python中sympy.physics.quantum.operator.UnitaryOperator._eval_args方法的典型用法代码示例。如果您正苦于以下问题:Python UnitaryOperator._eval_args方法的具体用法?Python UnitaryOperator._eval_args怎么用?Python UnitaryOperator._eval_args使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类sympy.physics.quantum.operator.UnitaryOperator
的用法示例。
在下文中一共展示了UnitaryOperator._eval_args方法的4个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。
示例1: _eval_args
# 需要导入模块: from sympy.physics.quantum.operator import UnitaryOperator [as 别名]
# 或者: from sympy.physics.quantum.operator.UnitaryOperator import _eval_args [as 别名]
def _eval_args(cls, args):
if len(args) != 2:
raise QuantumError(
'Insufficient/excessive arguments to Oracle. Please ' +
'supply the number of qubits and an unknown function.'
)
sub_args = args[0],
sub_args = UnitaryOperator._eval_args(sub_args)
if not sub_args[0].is_Integer:
raise TypeError('Integer expected, got: %r' % sub_args[0])
if not callable(args[1]):
raise TypeError('Callable expected, got: %r' % args[1])
sub_args = UnitaryOperator._eval_args(tuple(range(args[0])))
return (sub_args, args[1])
示例2: _eval_args
# 需要导入模块: from sympy.physics.quantum.operator import UnitaryOperator [as 别名]
# 或者: from sympy.physics.quantum.operator.UnitaryOperator import _eval_args [as 别名]
def _eval_args(cls, args):
# _eval_args has the right logic for the controls argument.
controls = args[0]
gate = args[1]
if not is_sequence(controls):
controls = (controls,)
controls = UnitaryOperator._eval_args(controls)
_validate_targets_controls(chain(controls,gate.targets))
return (Tuple(*controls), gate)
示例3: _eval_args
# 需要导入模块: from sympy.physics.quantum.operator import UnitaryOperator [as 别名]
# 或者: from sympy.physics.quantum.operator.UnitaryOperator import _eval_args [as 别名]
def _eval_args(cls, args):
# _eval_args has the right logic for the controls argument.
controls = args[0]
gate = args[1]
if not ordered_iter(controls, include=Tuple):
controls = (controls,)
controls = UnitaryOperator._eval_args(controls)
_validate_targets_controls(chain(controls,gate.targets))
return (controls, gate)
示例4: _eval_args
# 需要导入模块: from sympy.physics.quantum.operator import UnitaryOperator [as 别名]
# 或者: from sympy.physics.quantum.operator.UnitaryOperator import _eval_args [as 别名]
def _eval_args(cls, args):
if len(args) != 1:
raise QuantumError(
'Insufficient/excessive arguments to W gate. Please ' +
'supply the number of qubits to operate on.'
)
args = UnitaryOperator._eval_args(args)
if not args[0].is_Integer:
raise TypeError('Integer expected, got: %r' % args[0])
return args