当前位置: 首页>>代码示例>>Python>>正文


Python UnitaryOperator._eval_args方法代码示例

本文整理汇总了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])
开发者ID:MichaelMayorov,项目名称:sympy,代码行数:16,代码来源:grover.py

示例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)
开发者ID:yangle,项目名称:sympy,代码行数:11,代码来源:gate.py

示例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)
开发者ID:fxkr,项目名称:sympy,代码行数:11,代码来源:gate.py

示例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
开发者ID:A-turing-machine,项目名称:sympy,代码行数:12,代码来源:grover.py


注:本文中的sympy.physics.quantum.operator.UnitaryOperator._eval_args方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。