算术算子

算术算子实现量子整数运算,包括加法、乘法、移位、比较等操作。可用寄存器类型见 寄存器类型,端到端用法见 示例。

概述

算术算子总览

算子

操作

类型

幺正类

Add_UInt_UInt

result ^= lhs + rhs

Out-of-place

SelfAdjoint

Add_UInt_UInt_InPlace

rhs += lhs

In-place

BaseOperator

Add_UInt_ConstUInt

result ^= lhs + const

Out-of-place

SelfAdjoint

Add_ConstUInt_InPlace

reg += const

In-place

BaseOperator

Mult_UInt_ConstUInt

result ^= input * const

Out-of-place

SelfAdjoint

Add_Mult_UInt_ConstUInt_InPlace

res += lhs * const

In-place

BaseOperator

Mod_Mult_UInt_ConstUInt_InPlace

y = y * a^(2^x) mod N

In-place

BaseOperator

ShiftLeft_InPlace

循环左移

In-place

BaseOperator

ShiftRight_InPlace

循环右移

In-place

BaseOperator

Compare_UInt_UInt

比较标志

Out-of-place

SelfAdjoint

Less_UInt_UInt

小于标志

Out-of-place

SelfAdjoint

Assign

dst ^= src

Out-of-place

SelfAdjoint

FlipBools

按位取反

In-place

SelfAdjoint

Swap_General_General

交换两寄存器

In-place

SelfAdjoint

GetMid_UInt_UInt

计算中点

Out-of-place

SelfAdjoint

上表仅列出最常用的算术算子;完整清单(含带符号、位运算与溢出版本)见下文 Additional Arithmetic Operators 一节。

---

加法算子

Add_UInt_UInt(外置加法)

class pysparq.Add_UInt_UInt

Add two unsigned integer registers.

Computes: |a⟩|b⟩|0⟩ → |a⟩|b⟩|a+b⟩ (mod 2^n)

参数:
  • input_reg1 -- Name/ID of the first input register (addend).

  • input_reg2 -- Name/ID of the second input register (addend).

  • output_reg -- Name/ID of the output register (accumulates sum).

示例

Add_UInt_UInt("a", "b", "result")(state) # result = a + b

clear_control_all_ones(self: pysparq._core.Add_UInt_UInt) → None

Clear all control conditions of the specified type.

clear_control_by_bit(self: pysparq._core.Add_UInt_UInt) → None

Clear all control conditions of the specified type.

clear_control_by_value(self: pysparq._core.Add_UInt_UInt) → None

Clear all control conditions of the specified type.

clear_control_nonzeros(self: pysparq._core.Add_UInt_UInt) → None

Clear all control conditions of the specified type.

property condition_variable_all_ones
property condition_variable_by_bit
property condition_variable_by_value
property condition_variable_nonzeros
conditioned_by_all_ones(*args, **kwargs)

Overloaded function.

  1. conditioned_by_all_ones(self: pysparq._core.Add_UInt_UInt, cond: str) -> pysparq._core.Add_UInt_UInt

Condition this operation on registers where all bits are 1.

Calling this method replaces prior all-ones conditions. Pass the list overload to require several registers simultaneously; conditions of different kinds are combined with logical AND.

参数:
  • cond -- Register name (str) or ID (int) to condition on.

  • conds -- List of register names or IDs for multi-condition.

返回:

Self, for method chaining.

  1. conditioned_by_all_ones(self: pysparq._core.Add_UInt_UInt, conds: collections.abc.Sequence[str]) -> pysparq._core.Add_UInt_UInt

Condition this operation on registers where all bits are 1.

Calling this method replaces prior all-ones conditions. Pass the list overload to require several registers simultaneously; conditions of different kinds are combined with logical AND.

参数:
  • cond -- Register name (str) or ID (int) to condition on.

  • conds -- List of register names or IDs for multi-condition.

返回:

Self, for method chaining.

  1. conditioned_by_all_ones(self: pysparq._core.Add_UInt_UInt, cond: typing.SupportsInt | typing.SupportsIndex) -> pysparq._core.Add_UInt_UInt

Condition this operation on registers where all bits are 1.

Calling this method replaces prior all-ones conditions. Pass the list overload to require several registers simultaneously; conditions of different kinds are combined with logical AND.

参数:
  • cond -- Register name (str) or ID (int) to condition on.

  • conds -- List of register names or IDs for multi-condition.

返回:

Self, for method chaining.

  1. conditioned_by_all_ones(self: pysparq._core.Add_UInt_UInt, conds: collections.abc.Sequence[typing.SupportsInt | typing.SupportsIndex]) -> pysparq._core.Add_UInt_UInt

Condition this operation on registers where all bits are 1.

Calling this method replaces prior all-ones conditions. Pass the list overload to require several registers simultaneously; conditions of different kinds are combined with logical AND.

参数:
  • cond -- Register name (str) or ID (int) to condition on.

  • conds -- List of register names or IDs for multi-condition.

返回:

Self, for method chaining.

conditioned_by_bit(*args, **kwargs)

Overloaded function.

  1. conditioned_by_bit(self: pysparq._core.Add_UInt_UInt, cond: str, pos: typing.SupportsInt | typing.SupportsIndex) -> pysparq._core.Add_UInt_UInt

Condition this operation on a specific bit position.

Calling this method replaces prior bit conditions. Pass the list-of-pairs overload to require several bits simultaneously; conditions of different kinds are combined with logical AND.

参数:
  • cond -- Register name (str) or ID (int).

  • pos -- Bit position to check (0-indexed).

  • conds -- List of (register, position) pairs.

返回:

Self, for method chaining.

  1. conditioned_by_bit(self: pysparq._core.Add_UInt_UInt, conds: collections.abc.Sequence[tuple[str, typing.SupportsInt | typing.SupportsIndex]]) -> pysparq._core.Add_UInt_UInt

Condition this operation on a specific bit position.

Calling this method replaces prior bit conditions. Pass the list-of-pairs overload to require several bits simultaneously; conditions of different kinds are combined with logical AND.

参数:
  • cond -- Register name (str) or ID (int).

  • pos -- Bit position to check (0-indexed).

  • conds -- List of (register, position) pairs.

返回:

Self, for method chaining.

  1. conditioned_by_bit(self: pysparq._core.Add_UInt_UInt, cond: typing.SupportsInt | typing.SupportsIndex, pos: typing.SupportsInt | typing.SupportsIndex) -> pysparq._core.Add_UInt_UInt

Condition this operation on a specific bit position.

Calling this method replaces prior bit conditions. Pass the list-of-pairs overload to require several bits simultaneously; conditions of different kinds are combined with logical AND.

参数:
  • cond -- Register name (str) or ID (int).

  • pos -- Bit position to check (0-indexed).

  • conds -- List of (register, position) pairs.

返回:

Self, for method chaining.

  1. conditioned_by_bit(self: pysparq._core.Add_UInt_UInt, conds: collections.abc.Sequence[tuple[typing.SupportsInt | typing.SupportsIndex, typing.SupportsInt | typing.SupportsIndex]]) -> pysparq._core.Add_UInt_UInt

Condition this operation on a specific bit position.

Calling this method replaces prior bit conditions. Pass the list-of-pairs overload to require several bits simultaneously; conditions of different kinds are combined with logical AND.

参数:
  • cond -- Register name (str) or ID (int).

  • pos -- Bit position to check (0-indexed).

  • conds -- List of (register, position) pairs.

返回:

Self, for method chaining.

conditioned_by_nonzeros(*args, **kwargs)

Overloaded function.

  1. conditioned_by_nonzeros(self: pysparq._core.Add_UInt_UInt, cond: str) -> pysparq._core.Add_UInt_UInt

Condition this operation on registers with nonzero values.

Calling this method replaces prior nonzero-register conditions. Pass the list overload to require several registers simultaneously; conditions of different kinds are combined with logical AND.

参数:
  • cond -- Register name (str) or ID (int) to condition on.

  • conds -- List of register names or IDs for multi-condition.

返回:

Self, for method chaining.

示例

op.conditioned_by_nonzeros('control_reg')(state)

  1. conditioned_by_nonzeros(self: pysparq._core.Add_UInt_UInt, conds: collections.abc.Sequence[str]) -> pysparq._core.Add_UInt_UInt

Condition this operation on registers with nonzero values.

Calling this method replaces prior nonzero-register conditions. Pass the list overload to require several registers simultaneously; conditions of different kinds are combined with logical AND.

参数:
  • cond -- Register name (str) or ID (int) to condition on.

  • conds -- List of register names or IDs for multi-condition.

返回:

Self, for method chaining.

示例

op.conditioned_by_nonzeros('control_reg')(state)

  1. conditioned_by_nonzeros(self: pysparq._core.Add_UInt_UInt, cond: typing.SupportsInt | typing.SupportsIndex) -> pysparq._core.Add_UInt_UInt

Condition this operation on registers with nonzero values.

Calling this method replaces prior nonzero-register conditions. Pass the list overload to require several registers simultaneously; conditions of different kinds are combined with logical AND.

参数:
  • cond -- Register name (str) or ID (int) to condition on.

  • conds -- List of register names or IDs for multi-condition.

返回:

Self, for method chaining.

示例

op.conditioned_by_nonzeros('control_reg')(state)

  1. conditioned_by_nonzeros(self: pysparq._core.Add_UInt_UInt, conds: collections.abc.Sequence[typing.SupportsInt | typing.SupportsIndex]) -> pysparq._core.Add_UInt_UInt

Condition this operation on registers with nonzero values.

Calling this method replaces prior nonzero-register conditions. Pass the list overload to require several registers simultaneously; conditions of different kinds are combined with logical AND.

参数:
  • cond -- Register name (str) or ID (int) to condition on.

  • conds -- List of register names or IDs for multi-condition.

返回:

Self, for method chaining.

示例

op.conditioned_by_nonzeros('control_reg')(state)

conditioned_by_value(*args, **kwargs)

Overloaded function.

  1. conditioned_by_value(self: pysparq._core.Add_UInt_UInt, cond: str, pos: typing.SupportsInt | typing.SupportsIndex) -> pysparq._core.Add_UInt_UInt

Condition this operation on registers holding a specific value.

Calling this method replaces prior value conditions. Pass the list-of-pairs overload to require several values simultaneously; conditions of different kinds are combined with logical AND.

参数:
  • cond -- Register name (str) or ID (int).

  • pos -- Value to match.

  • conds -- List of (register, value) pairs.

返回:

Self, for method chaining.

  1. conditioned_by_value(self: pysparq._core.Add_UInt_UInt, conds: collections.abc.Sequence[tuple[str, typing.SupportsInt | typing.SupportsIndex]]) -> pysparq._core.Add_UInt_UInt

Condition this operation on registers holding a specific value.

Calling this method replaces prior value conditions. Pass the list-of-pairs overload to require several values simultaneously; conditions of different kinds are combined with logical AND.

参数:
  • cond -- Register name (str) or ID (int).

  • pos -- Value to match.

  • conds -- List of (register, value) pairs.

返回:

Self, for method chaining.

  1. conditioned_by_value(self: pysparq._core.Add_UInt_UInt, cond: typing.SupportsInt | typing.SupportsIndex, pos: typing.SupportsInt | typing.SupportsIndex) -> pysparq._core.Add_UInt_UInt

Condition this operation on registers holding a specific value.

Calling this method replaces prior value conditions. Pass the list-of-pairs overload to require several values simultaneously; conditions of different kinds are combined with logical AND.

参数:
  • cond -- Register name (str) or ID (int).

  • pos -- Value to match.

  • conds -- List of (register, value) pairs.

返回:

Self, for method chaining.

  1. conditioned_by_value(self: pysparq._core.Add_UInt_UInt, conds: collections.abc.Sequence[tuple[typing.SupportsInt | typing.SupportsIndex, typing.SupportsInt | typing.SupportsIndex]]) -> pysparq._core.Add_UInt_UInt

Condition this operation on registers holding a specific value.

Calling this method replaces prior value conditions. Pass the list-of-pairs overload to require several values simultaneously; conditions of different kinds are combined with logical AND.

参数:
  • cond -- Register name (str) or ID (int).

  • pos -- Value to match.

  • conds -- List of (register, value) pairs.

返回:

Self, for method chaining.

操作: result ^= lhs + rhs

幺正保证: XOR 机制 — 应用两次恢复原值。

类型约束: 所有寄存器必须是 UnsignedInteger。

位约束: 无特殊要求,结果按输出寄存器大小截断。

import pysparq as ps

ps.System.clear()

ps.System.add_register("lhs", ps.UnsignedInteger, 4)
ps.System.add_register("rhs", ps.UnsignedInteger, 4)
ps.System.add_register("result", ps.UnsignedInteger, 4)

state = ps.SparseState()
ps.Init_Unsafe("lhs", 3)(state)
ps.Init_Unsafe("rhs", 5)(state)

# result = 0 ^ (3 + 5) = 8
ps.Add_UInt_UInt("lhs", "rhs", "result")(state)

ps.pprint(state)
# 输出: |lhs=3,rhs=5,result=8⟩ : (1+0j)

# 再次应用 = 撤销
ps.Add_UInt_UInt("lhs", "rhs", "result")(state)
# result = 8 ^ 8 = 0

Add_UInt_UInt_InPlace(内置加法)

class pysparq.Add_UInt_UInt_InPlace
clear_control_all_ones(self: pysparq._core.Add_UInt_UInt_InPlace) → None

Clear all control conditions of the specified type.

clear_control_by_bit(self: pysparq._core.Add_UInt_UInt_InPlace) → None

Clear all control conditions of the specified type.

clear_control_by_value(self: pysparq._core.Add_UInt_UInt_InPlace) → None

Clear all control conditions of the specified type.

clear_control_nonzeros(self: pysparq._core.Add_UInt_UInt_InPlace) → None

Clear all control conditions of the specified type.

property condition_variable_all_ones
property condition_variable_by_bit
property condition_variable_by_value
property condition_variable_nonzeros
conditioned_by_all_ones(*args, **kwargs)

Overloaded function.

  1. conditioned_by_all_ones(self: pysparq._core.Add_UInt_UInt_InPlace, cond: str) -> pysparq._core.Add_UInt_UInt_InPlace

Condition this operation on registers where all bits are 1.

Calling this method replaces prior all-ones conditions. Pass the list overload to require several registers simultaneously; conditions of different kinds are combined with logical AND.

参数:
  • cond -- Register name (str) or ID (int) to condition on.

  • conds -- List of register names or IDs for multi-condition.

返回:

Self, for method chaining.

  1. conditioned_by_all_ones(self: pysparq._core.Add_UInt_UInt_InPlace, conds: collections.abc.Sequence[str]) -> pysparq._core.Add_UInt_UInt_InPlace

Condition this operation on registers where all bits are 1.

Calling this method replaces prior all-ones conditions. Pass the list overload to require several registers simultaneously; conditions of different kinds are combined with logical AND.

参数:
  • cond -- Register name (str) or ID (int) to condition on.

  • conds -- List of register names or IDs for multi-condition.

返回:

Self, for method chaining.

  1. conditioned_by_all_ones(self: pysparq._core.Add_UInt_UInt_InPlace, cond: typing.SupportsInt | typing.SupportsIndex) -> pysparq._core.Add_UInt_UInt_InPlace

Condition this operation on registers where all bits are 1.

Calling this method replaces prior all-ones conditions. Pass the list overload to require several registers simultaneously; conditions of different kinds are combined with logical AND.

参数:
  • cond -- Register name (str) or ID (int) to condition on.

  • conds -- List of register names or IDs for multi-condition.

返回:

Self, for method chaining.

  1. conditioned_by_all_ones(self: pysparq._core.Add_UInt_UInt_InPlace, conds: collections.abc.Sequence[typing.SupportsInt | typing.SupportsIndex]) -> pysparq._core.Add_UInt_UInt_InPlace

Condition this operation on registers where all bits are 1.

Calling this method replaces prior all-ones conditions. Pass the list overload to require several registers simultaneously; conditions of different kinds are combined with logical AND.

参数:
  • cond -- Register name (str) or ID (int) to condition on.

  • conds -- List of register names or IDs for multi-condition.

返回:

Self, for method chaining.

conditioned_by_bit(*args, **kwargs)

Overloaded function.

  1. conditioned_by_bit(self: pysparq._core.Add_UInt_UInt_InPlace, cond: str, pos: typing.SupportsInt | typing.SupportsIndex) -> pysparq._core.Add_UInt_UInt_InPlace

Condition this operation on a specific bit position.

Calling this method replaces prior bit conditions. Pass the list-of-pairs overload to require several bits simultaneously; conditions of different kinds are combined with logical AND.

参数:
  • cond -- Register name (str) or ID (int).

  • pos -- Bit position to check (0-indexed).

  • conds -- List of (register, position) pairs.

返回:

Self, for method chaining.

  1. conditioned_by_bit(self: pysparq._core.Add_UInt_UInt_InPlace, conds: collections.abc.Sequence[tuple[str, typing.SupportsInt | typing.SupportsIndex]]) -> pysparq._core.Add_UInt_UInt_InPlace

Condition this operation on a specific bit position.

Calling this method replaces prior bit conditions. Pass the list-of-pairs overload to require several bits simultaneously; conditions of different kinds are combined with logical AND.

参数:
  • cond -- Register name (str) or ID (int).

  • pos -- Bit position to check (0-indexed).

  • conds -- List of (register, position) pairs.

返回:

Self, for method chaining.

  1. conditioned_by_bit(self: pysparq._core.Add_UInt_UInt_InPlace, cond: typing.SupportsInt | typing.SupportsIndex, pos: typing.SupportsInt | typing.SupportsIndex) -> pysparq._core.Add_UInt_UInt_InPlace

Condition this operation on a specific bit position.

Calling this method replaces prior bit conditions. Pass the list-of-pairs overload to require several bits simultaneously; conditions of different kinds are combined with logical AND.

参数:
  • cond -- Register name (str) or ID (int).

  • pos -- Bit position to check (0-indexed).

  • conds -- List of (register, position) pairs.

返回:

Self, for method chaining.

  1. conditioned_by_bit(self: pysparq._core.Add_UInt_UInt_InPlace, conds: collections.abc.Sequence[tuple[typing.SupportsInt | typing.SupportsIndex, typing.SupportsInt | typing.SupportsIndex]]) -> pysparq._core.Add_UInt_UInt_InPlace

Condition this operation on a specific bit position.

Calling this method replaces prior bit conditions. Pass the list-of-pairs overload to require several bits simultaneously; conditions of different kinds are combined with logical AND.

参数:
  • cond -- Register name (str) or ID (int).

  • pos -- Bit position to check (0-indexed).

  • conds -- List of (register, position) pairs.

返回:

Self, for method chaining.

conditioned_by_nonzeros(*args, **kwargs)

Overloaded function.

  1. conditioned_by_nonzeros(self: pysparq._core.Add_UInt_UInt_InPlace, cond: str) -> pysparq._core.Add_UInt_UInt_InPlace

Condition this operation on registers with nonzero values.

Calling this method replaces prior nonzero-register conditions. Pass the list overload to require several registers simultaneously; conditions of different kinds are combined with logical AND.

参数:
  • cond -- Register name (str) or ID (int) to condition on.

  • conds -- List of register names or IDs for multi-condition.

返回:

Self, for method chaining.

示例

op.conditioned_by_nonzeros('control_reg')(state)

  1. conditioned_by_nonzeros(self: pysparq._core.Add_UInt_UInt_InPlace, conds: collections.abc.Sequence[str]) -> pysparq._core.Add_UInt_UInt_InPlace

Condition this operation on registers with nonzero values.

Calling this method replaces prior nonzero-register conditions. Pass the list overload to require several registers simultaneously; conditions of different kinds are combined with logical AND.

参数:
  • cond -- Register name (str) or ID (int) to condition on.

  • conds -- List of register names or IDs for multi-condition.

返回:

Self, for method chaining.

示例

op.conditioned_by_nonzeros('control_reg')(state)

  1. conditioned_by_nonzeros(self: pysparq._core.Add_UInt_UInt_InPlace, cond: typing.SupportsInt | typing.SupportsIndex) -> pysparq._core.Add_UInt_UInt_InPlace

Condition this operation on registers with nonzero values.

Calling this method replaces prior nonzero-register conditions. Pass the list overload to require several registers simultaneously; conditions of different kinds are combined with logical AND.

参数:
  • cond -- Register name (str) or ID (int) to condition on.

  • conds -- List of register names or IDs for multi-condition.

返回:

Self, for method chaining.

示例

op.conditioned_by_nonzeros('control_reg')(state)

  1. conditioned_by_nonzeros(self: pysparq._core.Add_UInt_UInt_InPlace, conds: collections.abc.Sequence[typing.SupportsInt | typing.SupportsIndex]) -> pysparq._core.Add_UInt_UInt_InPlace

Condition this operation on registers with nonzero values.

Calling this method replaces prior nonzero-register conditions. Pass the list overload to require several registers simultaneously; conditions of different kinds are combined with logical AND.

参数:
  • cond -- Register name (str) or ID (int) to condition on.

  • conds -- List of register names or IDs for multi-condition.

返回:

Self, for method chaining.

示例

op.conditioned_by_nonzeros('control_reg')(state)

conditioned_by_value(*args, **kwargs)

Overloaded function.

  1. conditioned_by_value(self: pysparq._core.Add_UInt_UInt_InPlace, cond: str, pos: typing.SupportsInt | typing.SupportsIndex) -> pysparq._core.Add_UInt_UInt_InPlace

Condition this operation on registers holding a specific value.

Calling this method replaces prior value conditions. Pass the list-of-pairs overload to require several values simultaneously; conditions of different kinds are combined with logical AND.

参数:
  • cond -- Register name (str) or ID (int).

  • pos -- Value to match.

  • conds -- List of (register, value) pairs.

返回:

Self, for method chaining.

  1. conditioned_by_value(self: pysparq._core.Add_UInt_UInt_InPlace, conds: collections.abc.Sequence[tuple[str, typing.SupportsInt | typing.SupportsIndex]]) -> pysparq._core.Add_UInt_UInt_InPlace

Condition this operation on registers holding a specific value.

Calling this method replaces prior value conditions. Pass the list-of-pairs overload to require several values simultaneously; conditions of different kinds are combined with logical AND.

参数:
  • cond -- Register name (str) or ID (int).

  • pos -- Value to match.

  • conds -- List of (register, value) pairs.

返回:

Self, for method chaining.

  1. conditioned_by_value(self: pysparq._core.Add_UInt_UInt_InPlace, cond: typing.SupportsInt | typing.SupportsIndex, pos: typing.SupportsInt | typing.SupportsIndex) -> pysparq._core.Add_UInt_UInt_InPlace

Condition this operation on registers holding a specific value.

Calling this method replaces prior value conditions. Pass the list-of-pairs overload to require several values simultaneously; conditions of different kinds are combined with logical AND.

参数:
  • cond -- Register name (str) or ID (int).

  • pos -- Value to match.

  • conds -- List of (register, value) pairs.

返回:

Self, for method chaining.

  1. conditioned_by_value(self: pysparq._core.Add_UInt_UInt_InPlace, conds: collections.abc.Sequence[tuple[typing.SupportsInt | typing.SupportsIndex, typing.SupportsInt | typing.SupportsIndex]]) -> pysparq._core.Add_UInt_UInt_InPlace

Condition this operation on registers holding a specific value.

Calling this method replaces prior value conditions. Pass the list-of-pairs overload to require several values simultaneously; conditions of different kinds are combined with logical AND.

参数:
  • cond -- Register name (str) or ID (int).

  • pos -- Value to match.

  • conds -- List of (register, value) pairs.

返回:

Self, for method chaining.

dag(self: pysparq._core.Add_UInt_UInt_InPlace, state: pysparq._core.SparseState) → None

Apply the adjoint (inverse) of this operation.

参数:

state -- The quantum state to operate on.

Note: Only available for self-adjoint operators.

操作: rhs = (rhs + lhs) mod 2^n

Dagger 实现: rhs = (rhs + 2^n - lhs) mod 2^n

类型约束: 两个寄存器必须是 UnsignedInteger。

位约束: 建议两寄存器大小相同,否则较小值被截断。

ps.System.clear()

ps.System.add_register("lhs", ps.UnsignedInteger, 4)
ps.System.add_register("rhs", ps.UnsignedInteger, 4)

state = ps.SparseState()
ps.Init_Unsafe("lhs", 7)(state)
ps.Init_Unsafe("rhs", 10)(state)

# rhs = (10 + 7) % 16 = 1(溢出回绕)
op = ps.Add_UInt_UInt_InPlace("lhs", "rhs")
op(state)

# 撤销: rhs = (1 + 16 - 7) % 16 = 10
op.dag(state)

Add_UInt_ConstUInt(常量外置加法)

class pysparq.Add_UInt_ConstUInt
clear_control_all_ones(self: pysparq._core.Add_UInt_ConstUInt) → None

Clear all control conditions of the specified type.

clear_control_by_bit(self: pysparq._core.Add_UInt_ConstUInt) → None

Clear all control conditions of the specified type.

clear_control_by_value(self: pysparq._core.Add_UInt_ConstUInt) → None

Clear all control conditions of the specified type.

clear_control_nonzeros(self: pysparq._core.Add_UInt_ConstUInt) → None

Clear all control conditions of the specified type.

property condition_variable_all_ones
property condition_variable_by_bit
property condition_variable_by_value
property condition_variable_nonzeros
conditioned_by_all_ones(*args, **kwargs)

Overloaded function.

  1. conditioned_by_all_ones(self: pysparq._core.Add_UInt_ConstUInt, cond: str) -> pysparq._core.Add_UInt_ConstUInt

Condition this operation on registers where all bits are 1.

Calling this method replaces prior all-ones conditions. Pass the list overload to require several registers simultaneously; conditions of different kinds are combined with logical AND.

参数:
  • cond -- Register name (str) or ID (int) to condition on.

  • conds -- List of register names or IDs for multi-condition.

返回:

Self, for method chaining.

  1. conditioned_by_all_ones(self: pysparq._core.Add_UInt_ConstUInt, conds: collections.abc.Sequence[str]) -> pysparq._core.Add_UInt_ConstUInt

Condition this operation on registers where all bits are 1.

Calling this method replaces prior all-ones conditions. Pass the list overload to require several registers simultaneously; conditions of different kinds are combined with logical AND.

参数:
  • cond -- Register name (str) or ID (int) to condition on.

  • conds -- List of register names or IDs for multi-condition.

返回:

Self, for method chaining.

  1. conditioned_by_all_ones(self: pysparq._core.Add_UInt_ConstUInt, cond: typing.SupportsInt | typing.SupportsIndex) -> pysparq._core.Add_UInt_ConstUInt

Condition this operation on registers where all bits are 1.

Calling this method replaces prior all-ones conditions. Pass the list overload to require several registers simultaneously; conditions of different kinds are combined with logical AND.

参数:
  • cond -- Register name (str) or ID (int) to condition on.

  • conds -- List of register names or IDs for multi-condition.

返回:

Self, for method chaining.

  1. conditioned_by_all_ones(self: pysparq._core.Add_UInt_ConstUInt, conds: collections.abc.Sequence[typing.SupportsInt | typing.SupportsIndex]) -> pysparq._core.Add_UInt_ConstUInt

Condition this operation on registers where all bits are 1.

Calling this method replaces prior all-ones conditions. Pass the list overload to require several registers simultaneously; conditions of different kinds are combined with logical AND.

参数:
  • cond -- Register name (str) or ID (int) to condition on.

  • conds -- List of register names or IDs for multi-condition.

返回:

Self, for method chaining.

conditioned_by_bit(*args, **kwargs)

Overloaded function.

  1. conditioned_by_bit(self: pysparq._core.Add_UInt_ConstUInt, cond: str, pos: typing.SupportsInt | typing.SupportsIndex) -> pysparq._core.Add_UInt_ConstUInt

Condition this operation on a specific bit position.

Calling this method replaces prior bit conditions. Pass the list-of-pairs overload to require several bits simultaneously; conditions of different kinds are combined with logical AND.

参数:
  • cond -- Register name (str) or ID (int).

  • pos -- Bit position to check (0-indexed).

  • conds -- List of (register, position) pairs.

返回:

Self, for method chaining.

  1. conditioned_by_bit(self: pysparq._core.Add_UInt_ConstUInt, conds: collections.abc.Sequence[tuple[str, typing.SupportsInt | typing.SupportsIndex]]) -> pysparq._core.Add_UInt_ConstUInt

Condition this operation on a specific bit position.

Calling this method replaces prior bit conditions. Pass the list-of-pairs overload to require several bits simultaneously; conditions of different kinds are combined with logical AND.

参数:
  • cond -- Register name (str) or ID (int).

  • pos -- Bit position to check (0-indexed).

  • conds -- List of (register, position) pairs.

返回:

Self, for method chaining.

  1. conditioned_by_bit(self: pysparq._core.Add_UInt_ConstUInt, cond: typing.SupportsInt | typing.SupportsIndex, pos: typing.SupportsInt | typing.SupportsIndex) -> pysparq._core.Add_UInt_ConstUInt

Condition this operation on a specific bit position.

Calling this method replaces prior bit conditions. Pass the list-of-pairs overload to require several bits simultaneously; conditions of different kinds are combined with logical AND.

参数:
  • cond -- Register name (str) or ID (int).

  • pos -- Bit position to check (0-indexed).

  • conds -- List of (register, position) pairs.

返回:

Self, for method chaining.

  1. conditioned_by_bit(self: pysparq._core.Add_UInt_ConstUInt, conds: collections.abc.Sequence[tuple[typing.SupportsInt | typing.SupportsIndex, typing.SupportsInt | typing.SupportsIndex]]) -> pysparq._core.Add_UInt_ConstUInt

Condition this operation on a specific bit position.

Calling this method replaces prior bit conditions. Pass the list-of-pairs overload to require several bits simultaneously; conditions of different kinds are combined with logical AND.

参数:
  • cond -- Register name (str) or ID (int).

  • pos -- Bit position to check (0-indexed).

  • conds -- List of (register, position) pairs.

返回:

Self, for method chaining.

conditioned_by_nonzeros(*args, **kwargs)

Overloaded function.

  1. conditioned_by_nonzeros(self: pysparq._core.Add_UInt_ConstUInt, cond: str) -> pysparq._core.Add_UInt_ConstUInt

Condition this operation on registers with nonzero values.

Calling this method replaces prior nonzero-register conditions. Pass the list overload to require several registers simultaneously; conditions of different kinds are combined with logical AND.

参数:
  • cond -- Register name (str) or ID (int) to condition on.

  • conds -- List of register names or IDs for multi-condition.

返回:

Self, for method chaining.

示例

op.conditioned_by_nonzeros('control_reg')(state)

  1. conditioned_by_nonzeros(self: pysparq._core.Add_UInt_ConstUInt, conds: collections.abc.Sequence[str]) -> pysparq._core.Add_UInt_ConstUInt

Condition this operation on registers with nonzero values.

Calling this method replaces prior nonzero-register conditions. Pass the list overload to require several registers simultaneously; conditions of different kinds are combined with logical AND.

参数:
  • cond -- Register name (str) or ID (int) to condition on.

  • conds -- List of register names or IDs for multi-condition.

返回:

Self, for method chaining.

示例

op.conditioned_by_nonzeros('control_reg')(state)

  1. conditioned_by_nonzeros(self: pysparq._core.Add_UInt_ConstUInt, cond: typing.SupportsInt | typing.SupportsIndex) -> pysparq._core.Add_UInt_ConstUInt

Condition this operation on registers with nonzero values.

Calling this method replaces prior nonzero-register conditions. Pass the list overload to require several registers simultaneously; conditions of different kinds are combined with logical AND.

参数:
  • cond -- Register name (str) or ID (int) to condition on.

  • conds -- List of register names or IDs for multi-condition.

返回:

Self, for method chaining.

示例

op.conditioned_by_nonzeros('control_reg')(state)

  1. conditioned_by_nonzeros(self: pysparq._core.Add_UInt_ConstUInt, conds: collections.abc.Sequence[typing.SupportsInt | typing.SupportsIndex]) -> pysparq._core.Add_UInt_ConstUInt

Condition this operation on registers with nonzero values.

Calling this method replaces prior nonzero-register conditions. Pass the list overload to require several registers simultaneously; conditions of different kinds are combined with logical AND.

参数:
  • cond -- Register name (str) or ID (int) to condition on.

  • conds -- List of register names or IDs for multi-condition.

返回:

Self, for method chaining.

示例

op.conditioned_by_nonzeros('control_reg')(state)

conditioned_by_value(*args, **kwargs)

Overloaded function.

  1. conditioned_by_value(self: pysparq._core.Add_UInt_ConstUInt, cond: str, pos: typing.SupportsInt | typing.SupportsIndex) -> pysparq._core.Add_UInt_ConstUInt

Condition this operation on registers holding a specific value.

Calling this method replaces prior value conditions. Pass the list-of-pairs overload to require several values simultaneously; conditions of different kinds are combined with logical AND.

参数:
  • cond -- Register name (str) or ID (int).

  • pos -- Value to match.

  • conds -- List of (register, value) pairs.

返回:

Self, for method chaining.

  1. conditioned_by_value(self: pysparq._core.Add_UInt_ConstUInt, conds: collections.abc.Sequence[tuple[str, typing.SupportsInt | typing.SupportsIndex]]) -> pysparq._core.Add_UInt_ConstUInt

Condition this operation on registers holding a specific value.

Calling this method replaces prior value conditions. Pass the list-of-pairs overload to require several values simultaneously; conditions of different kinds are combined with logical AND.

参数:
  • cond -- Register name (str) or ID (int).

  • pos -- Value to match.

  • conds -- List of (register, value) pairs.

返回:

Self, for method chaining.

  1. conditioned_by_value(self: pysparq._core.Add_UInt_ConstUInt, cond: typing.SupportsInt | typing.SupportsIndex, pos: typing.SupportsInt | typing.SupportsIndex) -> pysparq._core.Add_UInt_ConstUInt

Condition this operation on registers holding a specific value.

Calling this method replaces prior value conditions. Pass the list-of-pairs overload to require several values simultaneously; conditions of different kinds are combined with logical AND.

参数:
  • cond -- Register name (str) or ID (int).

  • pos -- Value to match.

  • conds -- List of (register, value) pairs.

返回:

Self, for method chaining.

  1. conditioned_by_value(self: pysparq._core.Add_UInt_ConstUInt, conds: collections.abc.Sequence[tuple[typing.SupportsInt | typing.SupportsIndex, typing.SupportsInt | typing.SupportsIndex]]) -> pysparq._core.Add_UInt_ConstUInt

Condition this operation on registers holding a specific value.

Calling this method replaces prior value conditions. Pass the list-of-pairs overload to require several values simultaneously; conditions of different kinds are combined with logical AND.

参数:
  • cond -- Register name (str) or ID (int).

  • pos -- Value to match.

  • conds -- List of (register, value) pairs.

返回:

Self, for method chaining.

操作: result ^= lhs + const

类型约束: 所有寄存器必须是 UnsignedInteger。

ps.System.clear()

ps.System.add_register("lhs", ps.UnsignedInteger, 4)
ps.System.add_register("result", ps.UnsignedInteger, 4)

state = ps.SparseState()
ps.Init_Unsafe("lhs", 3)(state)

# result = 0 ^ (3 + 5) = 8
ps.Add_UInt_ConstUInt("lhs", 5, "result")(state)

Add_ConstUInt_InPlace(常量内置加法)

class pysparq.Add_ConstUInt_InPlace
clear_control_all_ones(self: pysparq._core.Add_ConstUInt_InPlace) → None

Clear all control conditions of the specified type.

clear_control_by_bit(self: pysparq._core.Add_ConstUInt_InPlace) → None

Clear all control conditions of the specified type.

clear_control_by_value(self: pysparq._core.Add_ConstUInt_InPlace) → None

Clear all control conditions of the specified type.

clear_control_nonzeros(self: pysparq._core.Add_ConstUInt_InPlace) → None

Clear all control conditions of the specified type.

property condition_variable_all_ones
property condition_variable_by_bit
property condition_variable_by_value
property condition_variable_nonzeros
conditioned_by_all_ones(*args, **kwargs)

Overloaded function.

  1. conditioned_by_all_ones(self: pysparq._core.Add_ConstUInt_InPlace, cond: str) -> pysparq._core.Add_ConstUInt_InPlace

Condition this operation on registers where all bits are 1.

Calling this method replaces prior all-ones conditions. Pass the list overload to require several registers simultaneously; conditions of different kinds are combined with logical AND.

参数:
  • cond -- Register name (str) or ID (int) to condition on.

  • conds -- List of register names or IDs for multi-condition.

返回:

Self, for method chaining.

  1. conditioned_by_all_ones(self: pysparq._core.Add_ConstUInt_InPlace, conds: collections.abc.Sequence[str]) -> pysparq._core.Add_ConstUInt_InPlace

Condition this operation on registers where all bits are 1.

Calling this method replaces prior all-ones conditions. Pass the list overload to require several registers simultaneously; conditions of different kinds are combined with logical AND.

参数:
  • cond -- Register name (str) or ID (int) to condition on.

  • conds -- List of register names or IDs for multi-condition.

返回:

Self, for method chaining.

  1. conditioned_by_all_ones(self: pysparq._core.Add_ConstUInt_InPlace, cond: typing.SupportsInt | typing.SupportsIndex) -> pysparq._core.Add_ConstUInt_InPlace

Condition this operation on registers where all bits are 1.

Calling this method replaces prior all-ones conditions. Pass the list overload to require several registers simultaneously; conditions of different kinds are combined with logical AND.

参数:
  • cond -- Register name (str) or ID (int) to condition on.

  • conds -- List of register names or IDs for multi-condition.

返回:

Self, for method chaining.

  1. conditioned_by_all_ones(self: pysparq._core.Add_ConstUInt_InPlace, conds: collections.abc.Sequence[typing.SupportsInt | typing.SupportsIndex]) -> pysparq._core.Add_ConstUInt_InPlace

Condition this operation on registers where all bits are 1.

Calling this method replaces prior all-ones conditions. Pass the list overload to require several registers simultaneously; conditions of different kinds are combined with logical AND.

参数:
  • cond -- Register name (str) or ID (int) to condition on.

  • conds -- List of register names or IDs for multi-condition.

返回:

Self, for method chaining.

conditioned_by_bit(*args, **kwargs)

Overloaded function.

  1. conditioned_by_bit(self: pysparq._core.Add_ConstUInt_InPlace, cond: str, pos: typing.SupportsInt | typing.SupportsIndex) -> pysparq._core.Add_ConstUInt_InPlace

Condition this operation on a specific bit position.

Calling this method replaces prior bit conditions. Pass the list-of-pairs overload to require several bits simultaneously; conditions of different kinds are combined with logical AND.

参数:
  • cond -- Register name (str) or ID (int).

  • pos -- Bit position to check (0-indexed).

  • conds -- List of (register, position) pairs.

返回:

Self, for method chaining.

  1. conditioned_by_bit(self: pysparq._core.Add_ConstUInt_InPlace, conds: collections.abc.Sequence[tuple[str, typing.SupportsInt | typing.SupportsIndex]]) -> pysparq._core.Add_ConstUInt_InPlace

Condition this operation on a specific bit position.

Calling this method replaces prior bit conditions. Pass the list-of-pairs overload to require several bits simultaneously; conditions of different kinds are combined with logical AND.

参数:
  • cond -- Register name (str) or ID (int).

  • pos -- Bit position to check (0-indexed).

  • conds -- List of (register, position) pairs.

返回:

Self, for method chaining.

  1. conditioned_by_bit(self: pysparq._core.Add_ConstUInt_InPlace, cond: typing.SupportsInt | typing.SupportsIndex, pos: typing.SupportsInt | typing.SupportsIndex) -> pysparq._core.Add_ConstUInt_InPlace

Condition this operation on a specific bit position.

Calling this method replaces prior bit conditions. Pass the list-of-pairs overload to require several bits simultaneously; conditions of different kinds are combined with logical AND.

参数:
  • cond -- Register name (str) or ID (int).

  • pos -- Bit position to check (0-indexed).

  • conds -- List of (register, position) pairs.

返回:

Self, for method chaining.

  1. conditioned_by_bit(self: pysparq._core.Add_ConstUInt_InPlace, conds: collections.abc.Sequence[tuple[typing.SupportsInt | typing.SupportsIndex, typing.SupportsInt | typing.SupportsIndex]]) -> pysparq._core.Add_ConstUInt_InPlace

Condition this operation on a specific bit position.

Calling this method replaces prior bit conditions. Pass the list-of-pairs overload to require several bits simultaneously; conditions of different kinds are combined with logical AND.

参数:
  • cond -- Register name (str) or ID (int).

  • pos -- Bit position to check (0-indexed).

  • conds -- List of (register, position) pairs.

返回:

Self, for method chaining.

conditioned_by_nonzeros(*args, **kwargs)

Overloaded function.

  1. conditioned_by_nonzeros(self: pysparq._core.Add_ConstUInt_InPlace, cond: str) -> pysparq._core.Add_ConstUInt_InPlace

Condition this operation on registers with nonzero values.

Calling this method replaces prior nonzero-register conditions. Pass the list overload to require several registers simultaneously; conditions of different kinds are combined with logical AND.

参数:
  • cond -- Register name (str) or ID (int) to condition on.

  • conds -- List of register names or IDs for multi-condition.

返回:

Self, for method chaining.

示例

op.conditioned_by_nonzeros('control_reg')(state)

  1. conditioned_by_nonzeros(self: pysparq._core.Add_ConstUInt_InPlace, conds: collections.abc.Sequence[str]) -> pysparq._core.Add_ConstUInt_InPlace

Condition this operation on registers with nonzero values.

Calling this method replaces prior nonzero-register conditions. Pass the list overload to require several registers simultaneously; conditions of different kinds are combined with logical AND.

参数:
  • cond -- Register name (str) or ID (int) to condition on.

  • conds -- List of register names or IDs for multi-condition.

返回:

Self, for method chaining.

示例

op.conditioned_by_nonzeros('control_reg')(state)

  1. conditioned_by_nonzeros(self: pysparq._core.Add_ConstUInt_InPlace, cond: typing.SupportsInt | typing.SupportsIndex) -> pysparq._core.Add_ConstUInt_InPlace

Condition this operation on registers with nonzero values.

Calling this method replaces prior nonzero-register conditions. Pass the list overload to require several registers simultaneously; conditions of different kinds are combined with logical AND.

参数:
  • cond -- Register name (str) or ID (int) to condition on.

  • conds -- List of register names or IDs for multi-condition.

返回:

Self, for method chaining.

示例

op.conditioned_by_nonzeros('control_reg')(state)

  1. conditioned_by_nonzeros(self: pysparq._core.Add_ConstUInt_InPlace, conds: collections.abc.Sequence[typing.SupportsInt | typing.SupportsIndex]) -> pysparq._core.Add_ConstUInt_InPlace

Condition this operation on registers with nonzero values.

Calling this method replaces prior nonzero-register conditions. Pass the list overload to require several registers simultaneously; conditions of different kinds are combined with logical AND.

参数:
  • cond -- Register name (str) or ID (int) to condition on.

  • conds -- List of register names or IDs for multi-condition.

返回:

Self, for method chaining.

示例

op.conditioned_by_nonzeros('control_reg')(state)

conditioned_by_value(*args, **kwargs)

Overloaded function.

  1. conditioned_by_value(self: pysparq._core.Add_ConstUInt_InPlace, cond: str, pos: typing.SupportsInt | typing.SupportsIndex) -> pysparq._core.Add_ConstUInt_InPlace

Condition this operation on registers holding a specific value.

Calling this method replaces prior value conditions. Pass the list-of-pairs overload to require several values simultaneously; conditions of different kinds are combined with logical AND.

参数:
  • cond -- Register name (str) or ID (int).

  • pos -- Value to match.

  • conds -- List of (register, value) pairs.

返回:

Self, for method chaining.

  1. conditioned_by_value(self: pysparq._core.Add_ConstUInt_InPlace, conds: collections.abc.Sequence[tuple[str, typing.SupportsInt | typing.SupportsIndex]]) -> pysparq._core.Add_ConstUInt_InPlace

Condition this operation on registers holding a specific value.

Calling this method replaces prior value conditions. Pass the list-of-pairs overload to require several values simultaneously; conditions of different kinds are combined with logical AND.

参数:
  • cond -- Register name (str) or ID (int).

  • pos -- Value to match.

  • conds -- List of (register, value) pairs.

返回:

Self, for method chaining.

  1. conditioned_by_value(self: pysparq._core.Add_ConstUInt_InPlace, cond: typing.SupportsInt | typing.SupportsIndex, pos: typing.SupportsInt | typing.SupportsIndex) -> pysparq._core.Add_ConstUInt_InPlace

Condition this operation on registers holding a specific value.

Calling this method replaces prior value conditions. Pass the list-of-pairs overload to require several values simultaneously; conditions of different kinds are combined with logical AND.

参数:
  • cond -- Register name (str) or ID (int).

  • pos -- Value to match.

  • conds -- List of (register, value) pairs.

返回:

Self, for method chaining.

  1. conditioned_by_value(self: pysparq._core.Add_ConstUInt_InPlace, conds: collections.abc.Sequence[tuple[typing.SupportsInt | typing.SupportsIndex, typing.SupportsInt | typing.SupportsIndex]]) -> pysparq._core.Add_ConstUInt_InPlace

Condition this operation on registers holding a specific value.

Calling this method replaces prior value conditions. Pass the list-of-pairs overload to require several values simultaneously; conditions of different kinds are combined with logical AND.

参数:
  • cond -- Register name (str) or ID (int).

  • pos -- Value to match.

  • conds -- List of (register, value) pairs.

返回:

Self, for method chaining.

dag(self: pysparq._core.Add_ConstUInt_InPlace, state: pysparq._core.SparseState) → None

Apply the adjoint (inverse) of this operation.

参数:

state -- The quantum state to operate on.

Note: Only available for self-adjoint operators.

操作: reg = (reg + const) mod 2^n

Dagger 实现: reg = (reg + 2^n - const) mod 2^n

ps.System.clear()

ps.System.add_register("counter", ps.UnsignedInteger, 4)

state = ps.SparseState()
ps.Init_Unsafe("counter", 10)(state)

# counter = (10 + 7) % 16 = 1
op = ps.Add_ConstUInt_InPlace("counter", 7)
op(state)

# 撤销
op.dag(state)  # counter = 10

---

乘法算子

Mult_UInt_ConstUInt(常量外置乘法)

class pysparq.Mult_UInt_ConstUInt
clear_control_all_ones(self: pysparq._core.Mult_UInt_ConstUInt) → None

Clear all control conditions of the specified type.

clear_control_by_bit(self: pysparq._core.Mult_UInt_ConstUInt) → None

Clear all control conditions of the specified type.

clear_control_by_value(self: pysparq._core.Mult_UInt_ConstUInt) → None

Clear all control conditions of the specified type.

clear_control_nonzeros(self: pysparq._core.Mult_UInt_ConstUInt) → None

Clear all control conditions of the specified type.

property condition_variable_all_ones
property condition_variable_by_bit
property condition_variable_by_value
property condition_variable_nonzeros
conditioned_by_all_ones(*args, **kwargs)

Overloaded function.

  1. conditioned_by_all_ones(self: pysparq._core.Mult_UInt_ConstUInt, cond: str) -> pysparq._core.Mult_UInt_ConstUInt

Condition this operation on registers where all bits are 1.

Calling this method replaces prior all-ones conditions. Pass the list overload to require several registers simultaneously; conditions of different kinds are combined with logical AND.

参数:
  • cond -- Register name (str) or ID (int) to condition on.

  • conds -- List of register names or IDs for multi-condition.

返回:

Self, for method chaining.

  1. conditioned_by_all_ones(self: pysparq._core.Mult_UInt_ConstUInt, conds: collections.abc.Sequence[str]) -> pysparq._core.Mult_UInt_ConstUInt

Condition this operation on registers where all bits are 1.

Calling this method replaces prior all-ones conditions. Pass the list overload to require several registers simultaneously; conditions of different kinds are combined with logical AND.

参数:
  • cond -- Register name (str) or ID (int) to condition on.

  • conds -- List of register names or IDs for multi-condition.

返回:

Self, for method chaining.

  1. conditioned_by_all_ones(self: pysparq._core.Mult_UInt_ConstUInt, cond: typing.SupportsInt | typing.SupportsIndex) -> pysparq._core.Mult_UInt_ConstUInt

Condition this operation on registers where all bits are 1.

Calling this method replaces prior all-ones conditions. Pass the list overload to require several registers simultaneously; conditions of different kinds are combined with logical AND.

参数:
  • cond -- Register name (str) or ID (int) to condition on.

  • conds -- List of register names or IDs for multi-condition.

返回:

Self, for method chaining.

  1. conditioned_by_all_ones(self: pysparq._core.Mult_UInt_ConstUInt, conds: collections.abc.Sequence[typing.SupportsInt | typing.SupportsIndex]) -> pysparq._core.Mult_UInt_ConstUInt

Condition this operation on registers where all bits are 1.

Calling this method replaces prior all-ones conditions. Pass the list overload to require several registers simultaneously; conditions of different kinds are combined with logical AND.

参数:
  • cond -- Register name (str) or ID (int) to condition on.

  • conds -- List of register names or IDs for multi-condition.

返回:

Self, for method chaining.

conditioned_by_bit(*args, **kwargs)

Overloaded function.

  1. conditioned_by_bit(self: pysparq._core.Mult_UInt_ConstUInt, cond: str, pos: typing.SupportsInt | typing.SupportsIndex) -> pysparq._core.Mult_UInt_ConstUInt

Condition this operation on a specific bit position.

Calling this method replaces prior bit conditions. Pass the list-of-pairs overload to require several bits simultaneously; conditions of different kinds are combined with logical AND.

参数:
  • cond -- Register name (str) or ID (int).

  • pos -- Bit position to check (0-indexed).

  • conds -- List of (register, position) pairs.

返回:

Self, for method chaining.

  1. conditioned_by_bit(self: pysparq._core.Mult_UInt_ConstUInt, conds: collections.abc.Sequence[tuple[str, typing.SupportsInt | typing.SupportsIndex]]) -> pysparq._core.Mult_UInt_ConstUInt

Condition this operation on a specific bit position.

Calling this method replaces prior bit conditions. Pass the list-of-pairs overload to require several bits simultaneously; conditions of different kinds are combined with logical AND.

参数:
  • cond -- Register name (str) or ID (int).

  • pos -- Bit position to check (0-indexed).

  • conds -- List of (register, position) pairs.

返回:

Self, for method chaining.

  1. conditioned_by_bit(self: pysparq._core.Mult_UInt_ConstUInt, cond: typing.SupportsInt | typing.SupportsIndex, pos: typing.SupportsInt | typing.SupportsIndex) -> pysparq._core.Mult_UInt_ConstUInt

Condition this operation on a specific bit position.

Calling this method replaces prior bit conditions. Pass the list-of-pairs overload to require several bits simultaneously; conditions of different kinds are combined with logical AND.

参数:
  • cond -- Register name (str) or ID (int).

  • pos -- Bit position to check (0-indexed).

  • conds -- List of (register, position) pairs.

返回:

Self, for method chaining.

  1. conditioned_by_bit(self: pysparq._core.Mult_UInt_ConstUInt, conds: collections.abc.Sequence[tuple[typing.SupportsInt | typing.SupportsIndex, typing.SupportsInt | typing.SupportsIndex]]) -> pysparq._core.Mult_UInt_ConstUInt

Condition this operation on a specific bit position.

Calling this method replaces prior bit conditions. Pass the list-of-pairs overload to require several bits simultaneously; conditions of different kinds are combined with logical AND.

参数:
  • cond -- Register name (str) or ID (int).

  • pos -- Bit position to check (0-indexed).

  • conds -- List of (register, position) pairs.

返回:

Self, for method chaining.

conditioned_by_nonzeros(*args, **kwargs)

Overloaded function.

  1. conditioned_by_nonzeros(self: pysparq._core.Mult_UInt_ConstUInt, cond: str) -> pysparq._core.Mult_UInt_ConstUInt

Condition this operation on registers with nonzero values.

Calling this method replaces prior nonzero-register conditions. Pass the list overload to require several registers simultaneously; conditions of different kinds are combined with logical AND.

参数:
  • cond -- Register name (str) or ID (int) to condition on.

  • conds -- List of register names or IDs for multi-condition.

返回:

Self, for method chaining.

示例

op.conditioned_by_nonzeros('control_reg')(state)

  1. conditioned_by_nonzeros(self: pysparq._core.Mult_UInt_ConstUInt, conds: collections.abc.Sequence[str]) -> pysparq._core.Mult_UInt_ConstUInt

Condition this operation on registers with nonzero values.

Calling this method replaces prior nonzero-register conditions. Pass the list overload to require several registers simultaneously; conditions of different kinds are combined with logical AND.

参数:
  • cond -- Register name (str) or ID (int) to condition on.

  • conds -- List of register names or IDs for multi-condition.

返回:

Self, for method chaining.

示例

op.conditioned_by_nonzeros('control_reg')(state)

  1. conditioned_by_nonzeros(self: pysparq._core.Mult_UInt_ConstUInt, cond: typing.SupportsInt | typing.SupportsIndex) -> pysparq._core.Mult_UInt_ConstUInt

Condition this operation on registers with nonzero values.

Calling this method replaces prior nonzero-register conditions. Pass the list overload to require several registers simultaneously; conditions of different kinds are combined with logical AND.

参数:
  • cond -- Register name (str) or ID (int) to condition on.

  • conds -- List of register names or IDs for multi-condition.

返回:

Self, for method chaining.

示例

op.conditioned_by_nonzeros('control_reg')(state)

  1. conditioned_by_nonzeros(self: pysparq._core.Mult_UInt_ConstUInt, conds: collections.abc.Sequence[typing.SupportsInt | typing.SupportsIndex]) -> pysparq._core.Mult_UInt_ConstUInt

Condition this operation on registers with nonzero values.

Calling this method replaces prior nonzero-register conditions. Pass the list overload to require several registers simultaneously; conditions of different kinds are combined with logical AND.

参数:
  • cond -- Register name (str) or ID (int) to condition on.

  • conds -- List of register names or IDs for multi-condition.

返回:

Self, for method chaining.

示例

op.conditioned_by_nonzeros('control_reg')(state)

conditioned_by_value(*args, **kwargs)

Overloaded function.

  1. conditioned_by_value(self: pysparq._core.Mult_UInt_ConstUInt, cond: str, pos: typing.SupportsInt | typing.SupportsIndex) -> pysparq._core.Mult_UInt_ConstUInt

Condition this operation on registers holding a specific value.

Calling this method replaces prior value conditions. Pass the list-of-pairs overload to require several values simultaneously; conditions of different kinds are combined with logical AND.

参数:
  • cond -- Register name (str) or ID (int).

  • pos -- Value to match.

  • conds -- List of (register, value) pairs.

返回:

Self, for method chaining.

  1. conditioned_by_value(self: pysparq._core.Mult_UInt_ConstUInt, conds: collections.abc.Sequence[tuple[str, typing.SupportsInt | typing.SupportsIndex]]) -> pysparq._core.Mult_UInt_ConstUInt

Condition this operation on registers holding a specific value.

Calling this method replaces prior value conditions. Pass the list-of-pairs overload to require several values simultaneously; conditions of different kinds are combined with logical AND.

参数:
  • cond -- Register name (str) or ID (int).

  • pos -- Value to match.

  • conds -- List of (register, value) pairs.

返回:

Self, for method chaining.

  1. conditioned_by_value(self: pysparq._core.Mult_UInt_ConstUInt, cond: typing.SupportsInt | typing.SupportsIndex, pos: typing.SupportsInt | typing.SupportsIndex) -> pysparq._core.Mult_UInt_ConstUInt

Condition this operation on registers holding a specific value.

Calling this method replaces prior value conditions. Pass the list-of-pairs overload to require several values simultaneously; conditions of different kinds are combined with logical AND.

参数:
  • cond -- Register name (str) or ID (int).

  • pos -- Value to match.

  • conds -- List of (register, value) pairs.

返回:

Self, for method chaining.

  1. conditioned_by_value(self: pysparq._core.Mult_UInt_ConstUInt, conds: collections.abc.Sequence[tuple[typing.SupportsInt | typing.SupportsIndex, typing.SupportsInt | typing.SupportsIndex]]) -> pysparq._core.Mult_UInt_ConstUInt

Condition this operation on registers holding a specific value.

Calling this method replaces prior value conditions. Pass the list-of-pairs overload to require several values simultaneously; conditions of different kinds are combined with logical AND.

参数:
  • cond -- Register name (str) or ID (int).

  • pos -- Value to match.

  • conds -- List of (register, value) pairs.

返回:

Self, for method chaining.

操作: result ^= input * const

幺正保证: XOR 机制。

警告

**乘数应为奇数**才能保证双射性。偶数乘数会丢失最低位信息。

ps.System.clear()

ps.System.add_register("input", ps.UnsignedInteger, 4)
ps.System.add_register("result", ps.UnsignedInteger, 4)

state = ps.SparseState()
ps.Init_Unsafe("input", 3)(state)

# 好:奇数乘数
ps.Mult_UInt_ConstUInt("input", 3, "result")(state)
# result = 0 ^ (3 * 3) = 9

# 避免:偶数乘数不双射
# ps.Mult_UInt_ConstUInt("input", 2, "result")(state)  # 丢失 LSB

Add_Mult_UInt_ConstUInt_InPlace(累加乘法)

class pysparq.Add_Mult_UInt_ConstUInt_InPlace
clear_control_all_ones(self: pysparq._core.Add_Mult_UInt_ConstUInt_InPlace) → None

Clear all control conditions of the specified type.

clear_control_by_bit(self: pysparq._core.Add_Mult_UInt_ConstUInt_InPlace) → None

Clear all control conditions of the specified type.

clear_control_by_value(self: pysparq._core.Add_Mult_UInt_ConstUInt_InPlace) → None

Clear all control conditions of the specified type.

clear_control_nonzeros(self: pysparq._core.Add_Mult_UInt_ConstUInt_InPlace) → None

Clear all control conditions of the specified type.

property condition_variable_all_ones
property condition_variable_by_bit
property condition_variable_by_value
property condition_variable_nonzeros
conditioned_by_all_ones(*args, **kwargs)

Overloaded function.

  1. conditioned_by_all_ones(self: pysparq._core.Add_Mult_UInt_ConstUInt_InPlace, cond: str) -> pysparq._core.Add_Mult_UInt_ConstUInt_InPlace

Condition this operation on registers where all bits are 1.

Calling this method replaces prior all-ones conditions. Pass the list overload to require several registers simultaneously; conditions of different kinds are combined with logical AND.

参数:
  • cond -- Register name (str) or ID (int) to condition on.

  • conds -- List of register names or IDs for multi-condition.

返回:

Self, for method chaining.

  1. conditioned_by_all_ones(self: pysparq._core.Add_Mult_UInt_ConstUInt_InPlace, conds: collections.abc.Sequence[str]) -> pysparq._core.Add_Mult_UInt_ConstUInt_InPlace

Condition this operation on registers where all bits are 1.

Calling this method replaces prior all-ones conditions. Pass the list overload to require several registers simultaneously; conditions of different kinds are combined with logical AND.

参数:
  • cond -- Register name (str) or ID (int) to condition on.

  • conds -- List of register names or IDs for multi-condition.

返回:

Self, for method chaining.

  1. conditioned_by_all_ones(self: pysparq._core.Add_Mult_UInt_ConstUInt_InPlace, cond: typing.SupportsInt | typing.SupportsIndex) -> pysparq._core.Add_Mult_UInt_ConstUInt_InPlace

Condition this operation on registers where all bits are 1.

Calling this method replaces prior all-ones conditions. Pass the list overload to require several registers simultaneously; conditions of different kinds are combined with logical AND.

参数:
  • cond -- Register name (str) or ID (int) to condition on.

  • conds -- List of register names or IDs for multi-condition.

返回:

Self, for method chaining.

  1. conditioned_by_all_ones(self: pysparq._core.Add_Mult_UInt_ConstUInt_InPlace, conds: collections.abc.Sequence[typing.SupportsInt | typing.SupportsIndex]) -> pysparq._core.Add_Mult_UInt_ConstUInt_InPlace

Condition this operation on registers where all bits are 1.

Calling this method replaces prior all-ones conditions. Pass the list overload to require several registers simultaneously; conditions of different kinds are combined with logical AND.

参数:
  • cond -- Register name (str) or ID (int) to condition on.

  • conds -- List of register names or IDs for multi-condition.

返回:

Self, for method chaining.

conditioned_by_bit(*args, **kwargs)

Overloaded function.

  1. conditioned_by_bit(self: pysparq._core.Add_Mult_UInt_ConstUInt_InPlace, cond: str, pos: typing.SupportsInt | typing.SupportsIndex) -> pysparq._core.Add_Mult_UInt_ConstUInt_InPlace

Condition this operation on a specific bit position.

Calling this method replaces prior bit conditions. Pass the list-of-pairs overload to require several bits simultaneously; conditions of different kinds are combined with logical AND.

参数:
  • cond -- Register name (str) or ID (int).

  • pos -- Bit position to check (0-indexed).

  • conds -- List of (register, position) pairs.

返回:

Self, for method chaining.

  1. conditioned_by_bit(self: pysparq._core.Add_Mult_UInt_ConstUInt_InPlace, conds: collections.abc.Sequence[tuple[str, typing.SupportsInt | typing.SupportsIndex]]) -> pysparq._core.Add_Mult_UInt_ConstUInt_InPlace

Condition this operation on a specific bit position.

Calling this method replaces prior bit conditions. Pass the list-of-pairs overload to require several bits simultaneously; conditions of different kinds are combined with logical AND.

参数:
  • cond -- Register name (str) or ID (int).

  • pos -- Bit position to check (0-indexed).

  • conds -- List of (register, position) pairs.

返回:

Self, for method chaining.

  1. conditioned_by_bit(self: pysparq._core.Add_Mult_UInt_ConstUInt_InPlace, cond: typing.SupportsInt | typing.SupportsIndex, pos: typing.SupportsInt | typing.SupportsIndex) -> pysparq._core.Add_Mult_UInt_ConstUInt_InPlace

Condition this operation on a specific bit position.

Calling this method replaces prior bit conditions. Pass the list-of-pairs overload to require several bits simultaneously; conditions of different kinds are combined with logical AND.

参数:
  • cond -- Register name (str) or ID (int).

  • pos -- Bit position to check (0-indexed).

  • conds -- List of (register, position) pairs.

返回:

Self, for method chaining.

  1. conditioned_by_bit(self: pysparq._core.Add_Mult_UInt_ConstUInt_InPlace, conds: collections.abc.Sequence[tuple[typing.SupportsInt | typing.SupportsIndex, typing.SupportsInt | typing.SupportsIndex]]) -> pysparq._core.Add_Mult_UInt_ConstUInt_InPlace

Condition this operation on a specific bit position.

Calling this method replaces prior bit conditions. Pass the list-of-pairs overload to require several bits simultaneously; conditions of different kinds are combined with logical AND.

参数:
  • cond -- Register name (str) or ID (int).

  • pos -- Bit position to check (0-indexed).

  • conds -- List of (register, position) pairs.

返回:

Self, for method chaining.

conditioned_by_nonzeros(*args, **kwargs)

Overloaded function.

  1. conditioned_by_nonzeros(self: pysparq._core.Add_Mult_UInt_ConstUInt_InPlace, cond: str) -> pysparq._core.Add_Mult_UInt_ConstUInt_InPlace

Condition this operation on registers with nonzero values.

Calling this method replaces prior nonzero-register conditions. Pass the list overload to require several registers simultaneously; conditions of different kinds are combined with logical AND.

参数:
  • cond -- Register name (str) or ID (int) to condition on.

  • conds -- List of register names or IDs for multi-condition.

返回:

Self, for method chaining.

示例

op.conditioned_by_nonzeros('control_reg')(state)

  1. conditioned_by_nonzeros(self: pysparq._core.Add_Mult_UInt_ConstUInt_InPlace, conds: collections.abc.Sequence[str]) -> pysparq._core.Add_Mult_UInt_ConstUInt_InPlace

Condition this operation on registers with nonzero values.

Calling this method replaces prior nonzero-register conditions. Pass the list overload to require several registers simultaneously; conditions of different kinds are combined with logical AND.

参数:
  • cond -- Register name (str) or ID (int) to condition on.

  • conds -- List of register names or IDs for multi-condition.

返回:

Self, for method chaining.

示例

op.conditioned_by_nonzeros('control_reg')(state)

  1. conditioned_by_nonzeros(self: pysparq._core.Add_Mult_UInt_ConstUInt_InPlace, cond: typing.SupportsInt | typing.SupportsIndex) -> pysparq._core.Add_Mult_UInt_ConstUInt_InPlace

Condition this operation on registers with nonzero values.

Calling this method replaces prior nonzero-register conditions. Pass the list overload to require several registers simultaneously; conditions of different kinds are combined with logical AND.

参数:
  • cond -- Register name (str) or ID (int) to condition on.

  • conds -- List of register names or IDs for multi-condition.

返回:

Self, for method chaining.

示例

op.conditioned_by_nonzeros('control_reg')(state)

  1. conditioned_by_nonzeros(self: pysparq._core.Add_Mult_UInt_ConstUInt_InPlace, conds: collections.abc.Sequence[typing.SupportsInt | typing.SupportsIndex]) -> pysparq._core.Add_Mult_UInt_ConstUInt_InPlace

Condition this operation on registers with nonzero values.

Calling this method replaces prior nonzero-register conditions. Pass the list overload to require several registers simultaneously; conditions of different kinds are combined with logical AND.

参数:
  • cond -- Register name (str) or ID (int) to condition on.

  • conds -- List of register names or IDs for multi-condition.

返回:

Self, for method chaining.

示例

op.conditioned_by_nonzeros('control_reg')(state)

conditioned_by_value(*args, **kwargs)

Overloaded function.

  1. conditioned_by_value(self: pysparq._core.Add_Mult_UInt_ConstUInt_InPlace, cond: str, pos: typing.SupportsInt | typing.SupportsIndex) -> pysparq._core.Add_Mult_UInt_ConstUInt_InPlace

Condition this operation on registers holding a specific value.

Calling this method replaces prior value conditions. Pass the list-of-pairs overload to require several values simultaneously; conditions of different kinds are combined with logical AND.

参数:
  • cond -- Register name (str) or ID (int).

  • pos -- Value to match.

  • conds -- List of (register, value) pairs.

返回:

Self, for method chaining.

  1. conditioned_by_value(self: pysparq._core.Add_Mult_UInt_ConstUInt_InPlace, conds: collections.abc.Sequence[tuple[str, typing.SupportsInt | typing.SupportsIndex]]) -> pysparq._core.Add_Mult_UInt_ConstUInt_InPlace

Condition this operation on registers holding a specific value.

Calling this method replaces prior value conditions. Pass the list-of-pairs overload to require several values simultaneously; conditions of different kinds are combined with logical AND.

参数:
  • cond -- Register name (str) or ID (int).

  • pos -- Value to match.

  • conds -- List of (register, value) pairs.

返回:

Self, for method chaining.

  1. conditioned_by_value(self: pysparq._core.Add_Mult_UInt_ConstUInt_InPlace, cond: typing.SupportsInt | typing.SupportsIndex, pos: typing.SupportsInt | typing.SupportsIndex) -> pysparq._core.Add_Mult_UInt_ConstUInt_InPlace

Condition this operation on registers holding a specific value.

Calling this method replaces prior value conditions. Pass the list-of-pairs overload to require several values simultaneously; conditions of different kinds are combined with logical AND.

参数:
  • cond -- Register name (str) or ID (int).

  • pos -- Value to match.

  • conds -- List of (register, value) pairs.

返回:

Self, for method chaining.

  1. conditioned_by_value(self: pysparq._core.Add_Mult_UInt_ConstUInt_InPlace, conds: collections.abc.Sequence[tuple[typing.SupportsInt | typing.SupportsIndex, typing.SupportsInt | typing.SupportsIndex]]) -> pysparq._core.Add_Mult_UInt_ConstUInt_InPlace

Condition this operation on registers holding a specific value.

Calling this method replaces prior value conditions. Pass the list-of-pairs overload to require several values simultaneously; conditions of different kinds are combined with logical AND.

参数:
  • cond -- Register name (str) or ID (int).

  • pos -- Value to match.

  • conds -- List of (register, value) pairs.

返回:

Self, for method chaining.

dag(self: pysparq._core.Add_Mult_UInt_ConstUInt_InPlace, state: pysparq._core.SparseState) → None

Apply the adjoint (inverse) of this operation.

参数:

state -- The quantum state to operate on.

Note: Only available for self-adjoint operators.

操作: result += input * const

Dagger 实现: result += (2^n - input * const) mod 2^n

ps.System.clear()

ps.System.add_register("input", ps.UnsignedInteger, 4)
ps.System.add_register("result", ps.UnsignedInteger, 8)  # 更大防止溢出

state = ps.SparseState()
ps.Init_Unsafe("input", 3)(state)
ps.Init_Unsafe("result", 5)(state)

# result = 5 + (3 * 4) = 17
op = ps.Add_Mult_UInt_ConstUInt_InPlace("input", 4, "result")
op(state)

# 撤销
op.dag(state)

---

模乘算子

Mod_Mult_UInt_ConstUInt_InPlace(模乘算子)

class pysparq.Mod_Mult_UInt_ConstUInt_InPlace
clear_control_all_ones(self: pysparq._core.Mod_Mult_UInt_ConstUInt_InPlace) → None

Clear all control conditions of the specified type.

clear_control_by_bit(self: pysparq._core.Mod_Mult_UInt_ConstUInt_InPlace) → None

Clear all control conditions of the specified type.

clear_control_by_value(self: pysparq._core.Mod_Mult_UInt_ConstUInt_InPlace) → None

Clear all control conditions of the specified type.

clear_control_nonzeros(self: pysparq._core.Mod_Mult_UInt_ConstUInt_InPlace) → None

Clear all control conditions of the specified type.

property condition_variable_all_ones
property condition_variable_by_bit
property condition_variable_by_value
property condition_variable_nonzeros
conditioned_by_all_ones(*args, **kwargs)

Overloaded function.

  1. conditioned_by_all_ones(self: pysparq._core.Mod_Mult_UInt_ConstUInt_InPlace, cond: str) -> pysparq._core.Mod_Mult_UInt_ConstUInt_InPlace

Condition this operation on registers where all bits are 1.

Calling this method replaces prior all-ones conditions. Pass the list overload to require several registers simultaneously; conditions of different kinds are combined with logical AND.

参数:
  • cond -- Register name (str) or ID (int) to condition on.

  • conds -- List of register names or IDs for multi-condition.

返回:

Self, for method chaining.

  1. conditioned_by_all_ones(self: pysparq._core.Mod_Mult_UInt_ConstUInt_InPlace, conds: collections.abc.Sequence[str]) -> pysparq._core.Mod_Mult_UInt_ConstUInt_InPlace

Condition this operation on registers where all bits are 1.

Calling this method replaces prior all-ones conditions. Pass the list overload to require several registers simultaneously; conditions of different kinds are combined with logical AND.

参数:
  • cond -- Register name (str) or ID (int) to condition on.

  • conds -- List of register names or IDs for multi-condition.

返回:

Self, for method chaining.

  1. conditioned_by_all_ones(self: pysparq._core.Mod_Mult_UInt_ConstUInt_InPlace, cond: typing.SupportsInt | typing.SupportsIndex) -> pysparq._core.Mod_Mult_UInt_ConstUInt_InPlace

Condition this operation on registers where all bits are 1.

Calling this method replaces prior all-ones conditions. Pass the list overload to require several registers simultaneously; conditions of different kinds are combined with logical AND.

参数:
  • cond -- Register name (str) or ID (int) to condition on.

  • conds -- List of register names or IDs for multi-condition.

返回:

Self, for method chaining.

  1. conditioned_by_all_ones(self: pysparq._core.Mod_Mult_UInt_ConstUInt_InPlace, conds: collections.abc.Sequence[typing.SupportsInt | typing.SupportsIndex]) -> pysparq._core.Mod_Mult_UInt_ConstUInt_InPlace

Condition this operation on registers where all bits are 1.

Calling this method replaces prior all-ones conditions. Pass the list overload to require several registers simultaneously; conditions of different kinds are combined with logical AND.

参数:
  • cond -- Register name (str) or ID (int) to condition on.

  • conds -- List of register names or IDs for multi-condition.

返回:

Self, for method chaining.

conditioned_by_bit(*args, **kwargs)

Overloaded function.

  1. conditioned_by_bit(self: pysparq._core.Mod_Mult_UInt_ConstUInt_InPlace, cond: str, pos: typing.SupportsInt | typing.SupportsIndex) -> pysparq._core.Mod_Mult_UInt_ConstUInt_InPlace

Condition this operation on a specific bit position.

Calling this method replaces prior bit conditions. Pass the list-of-pairs overload to require several bits simultaneously; conditions of different kinds are combined with logical AND.

参数:
  • cond -- Register name (str) or ID (int).

  • pos -- Bit position to check (0-indexed).

  • conds -- List of (register, position) pairs.

返回:

Self, for method chaining.

  1. conditioned_by_bit(self: pysparq._core.Mod_Mult_UInt_ConstUInt_InPlace, conds: collections.abc.Sequence[tuple[str, typing.SupportsInt | typing.SupportsIndex]]) -> pysparq._core.Mod_Mult_UInt_ConstUInt_InPlace

Condition this operation on a specific bit position.

Calling this method replaces prior bit conditions. Pass the list-of-pairs overload to require several bits simultaneously; conditions of different kinds are combined with logical AND.

参数:
  • cond -- Register name (str) or ID (int).

  • pos -- Bit position to check (0-indexed).

  • conds -- List of (register, position) pairs.

返回:

Self, for method chaining.

  1. conditioned_by_bit(self: pysparq._core.Mod_Mult_UInt_ConstUInt_InPlace, cond: typing.SupportsInt | typing.SupportsIndex, pos: typing.SupportsInt | typing.SupportsIndex) -> pysparq._core.Mod_Mult_UInt_ConstUInt_InPlace

Condition this operation on a specific bit position.

Calling this method replaces prior bit conditions. Pass the list-of-pairs overload to require several bits simultaneously; conditions of different kinds are combined with logical AND.

参数:
  • cond -- Register name (str) or ID (int).

  • pos -- Bit position to check (0-indexed).

  • conds -- List of (register, position) pairs.

返回:

Self, for method chaining.

  1. conditioned_by_bit(self: pysparq._core.Mod_Mult_UInt_ConstUInt_InPlace, conds: collections.abc.Sequence[tuple[typing.SupportsInt | typing.SupportsIndex, typing.SupportsInt | typing.SupportsIndex]]) -> pysparq._core.Mod_Mult_UInt_ConstUInt_InPlace

Condition this operation on a specific bit position.

Calling this method replaces prior bit conditions. Pass the list-of-pairs overload to require several bits simultaneously; conditions of different kinds are combined with logical AND.

参数:
  • cond -- Register name (str) or ID (int).

  • pos -- Bit position to check (0-indexed).

  • conds -- List of (register, position) pairs.

返回:

Self, for method chaining.

conditioned_by_nonzeros(*args, **kwargs)

Overloaded function.

  1. conditioned_by_nonzeros(self: pysparq._core.Mod_Mult_UInt_ConstUInt_InPlace, cond: str) -> pysparq._core.Mod_Mult_UInt_ConstUInt_InPlace

Condition this operation on registers with nonzero values.

Calling this method replaces prior nonzero-register conditions. Pass the list overload to require several registers simultaneously; conditions of different kinds are combined with logical AND.

参数:
  • cond -- Register name (str) or ID (int) to condition on.

  • conds -- List of register names or IDs for multi-condition.

返回:

Self, for method chaining.

示例

op.conditioned_by_nonzeros('control_reg')(state)

  1. conditioned_by_nonzeros(self: pysparq._core.Mod_Mult_UInt_ConstUInt_InPlace, conds: collections.abc.Sequence[str]) -> pysparq._core.Mod_Mult_UInt_ConstUInt_InPlace

Condition this operation on registers with nonzero values.

Calling this method replaces prior nonzero-register conditions. Pass the list overload to require several registers simultaneously; conditions of different kinds are combined with logical AND.

参数:
  • cond -- Register name (str) or ID (int) to condition on.

  • conds -- List of register names or IDs for multi-condition.

返回:

Self, for method chaining.

示例

op.conditioned_by_nonzeros('control_reg')(state)

  1. conditioned_by_nonzeros(self: pysparq._core.Mod_Mult_UInt_ConstUInt_InPlace, cond: typing.SupportsInt | typing.SupportsIndex) -> pysparq._core.Mod_Mult_UInt_ConstUInt_InPlace

Condition this operation on registers with nonzero values.

Calling this method replaces prior nonzero-register conditions. Pass the list overload to require several registers simultaneously; conditions of different kinds are combined with logical AND.

参数:
  • cond -- Register name (str) or ID (int) to condition on.

  • conds -- List of register names or IDs for multi-condition.

返回:

Self, for method chaining.

示例

op.conditioned_by_nonzeros('control_reg')(state)

  1. conditioned_by_nonzeros(self: pysparq._core.Mod_Mult_UInt_ConstUInt_InPlace, conds: collections.abc.Sequence[typing.SupportsInt | typing.SupportsIndex]) -> pysparq._core.Mod_Mult_UInt_ConstUInt_InPlace

Condition this operation on registers with nonzero values.

Calling this method replaces prior nonzero-register conditions. Pass the list overload to require several registers simultaneously; conditions of different kinds are combined with logical AND.

参数:
  • cond -- Register name (str) or ID (int) to condition on.

  • conds -- List of register names or IDs for multi-condition.

返回:

Self, for method chaining.

示例

op.conditioned_by_nonzeros('control_reg')(state)

conditioned_by_value(*args, **kwargs)

Overloaded function.

  1. conditioned_by_value(self: pysparq._core.Mod_Mult_UInt_ConstUInt_InPlace, cond: str, pos: typing.SupportsInt | typing.SupportsIndex) -> pysparq._core.Mod_Mult_UInt_ConstUInt_InPlace

Condition this operation on registers holding a specific value.

Calling this method replaces prior value conditions. Pass the list-of-pairs overload to require several values simultaneously; conditions of different kinds are combined with logical AND.

参数:
  • cond -- Register name (str) or ID (int).

  • pos -- Value to match.

  • conds -- List of (register, value) pairs.

返回:

Self, for method chaining.

  1. conditioned_by_value(self: pysparq._core.Mod_Mult_UInt_ConstUInt_InPlace, conds: collections.abc.Sequence[tuple[str, typing.SupportsInt | typing.SupportsIndex]]) -> pysparq._core.Mod_Mult_UInt_ConstUInt_InPlace

Condition this operation on registers holding a specific value.

Calling this method replaces prior value conditions. Pass the list-of-pairs overload to require several values simultaneously; conditions of different kinds are combined with logical AND.

参数:
  • cond -- Register name (str) or ID (int).

  • pos -- Value to match.

  • conds -- List of (register, value) pairs.

返回:

Self, for method chaining.

  1. conditioned_by_value(self: pysparq._core.Mod_Mult_UInt_ConstUInt_InPlace, cond: typing.SupportsInt | typing.SupportsIndex, pos: typing.SupportsInt | typing.SupportsIndex) -> pysparq._core.Mod_Mult_UInt_ConstUInt_InPlace

Condition this operation on registers holding a specific value.

Calling this method replaces prior value conditions. Pass the list-of-pairs overload to require several values simultaneously; conditions of different kinds are combined with logical AND.

参数:
  • cond -- Register name (str) or ID (int).

  • pos -- Value to match.

  • conds -- List of (register, value) pairs.

返回:

Self, for method chaining.

  1. conditioned_by_value(self: pysparq._core.Mod_Mult_UInt_ConstUInt_InPlace, conds: collections.abc.Sequence[tuple[typing.SupportsInt | typing.SupportsIndex, typing.SupportsInt | typing.SupportsIndex]]) -> pysparq._core.Mod_Mult_UInt_ConstUInt_InPlace

Condition this operation on registers holding a specific value.

Calling this method replaces prior value conditions. Pass the list-of-pairs overload to require several values simultaneously; conditions of different kinds are combined with logical AND.

参数:
  • cond -- Register name (str) or ID (int).

  • pos -- Value to match.

  • conds -- List of (register, value) pairs.

返回:

Self, for method chaining.

dag(self: pysparq._core.Mod_Mult_UInt_ConstUInt_InPlace, state: pysparq._core.SparseState) → None

Apply the adjoint (inverse) of this operation.

参数:

state -- The quantum state to operate on.

Note: Only available for self-adjoint operators.

操作: ``y → y * a^(2^x) mod N``(原地模乘)

Dagger: ``y → y * a^(-2^x) mod N``(使用扩展欧几里得算法求模逆)

类型约束: UnsignedInteger,寄存器大小需 ≥ ⌈log₂(N)⌉。

条件: a 和 N 必须互质(gcd(a, N) = 1),否则构造时抛出异常。

import pysparq as ps

ps.System.clear()
reg = ps.System.add_register("y", ps.UnsignedInteger, 4)
state = ps.SparseState()
ps.Init_Unsafe("y", 3)(state)

# y = 3 * 7 mod 15 = 6
op = ps.Mod_Mult_UInt_ConstUInt_InPlace("y", 7, 0, 15)
op(state)

# 撤销: y = 6 * 13 mod 15 = 3
op.dag(state)

---

移位算子

ShiftLeft_InPlace(循环左移)

class pysparq.ShiftLeft_InPlace
clear_control_all_ones(self: pysparq._core.ShiftLeft_InPlace) → None

Clear all control conditions of the specified type.

clear_control_by_bit(self: pysparq._core.ShiftLeft_InPlace) → None

Clear all control conditions of the specified type.

clear_control_by_value(self: pysparq._core.ShiftLeft_InPlace) → None

Clear all control conditions of the specified type.

clear_control_nonzeros(self: pysparq._core.ShiftLeft_InPlace) → None

Clear all control conditions of the specified type.

property condition_variable_all_ones
property condition_variable_by_bit
property condition_variable_by_value
property condition_variable_nonzeros
conditioned_by_all_ones(*args, **kwargs)

Overloaded function.

  1. conditioned_by_all_ones(self: pysparq._core.ShiftLeft_InPlace, cond: str) -> pysparq._core.ShiftLeft_InPlace

Condition this operation on registers where all bits are 1.

Calling this method replaces prior all-ones conditions. Pass the list overload to require several registers simultaneously; conditions of different kinds are combined with logical AND.

参数:
  • cond -- Register name (str) or ID (int) to condition on.

  • conds -- List of register names or IDs for multi-condition.

返回:

Self, for method chaining.

  1. conditioned_by_all_ones(self: pysparq._core.ShiftLeft_InPlace, conds: collections.abc.Sequence[str]) -> pysparq._core.ShiftLeft_InPlace

Condition this operation on registers where all bits are 1.

Calling this method replaces prior all-ones conditions. Pass the list overload to require several registers simultaneously; conditions of different kinds are combined with logical AND.

参数:
  • cond -- Register name (str) or ID (int) to condition on.

  • conds -- List of register names or IDs for multi-condition.

返回:

Self, for method chaining.

  1. conditioned_by_all_ones(self: pysparq._core.ShiftLeft_InPlace, cond: typing.SupportsInt | typing.SupportsIndex) -> pysparq._core.ShiftLeft_InPlace

Condition this operation on registers where all bits are 1.

Calling this method replaces prior all-ones conditions. Pass the list overload to require several registers simultaneously; conditions of different kinds are combined with logical AND.

参数:
  • cond -- Register name (str) or ID (int) to condition on.

  • conds -- List of register names or IDs for multi-condition.

返回:

Self, for method chaining.

  1. conditioned_by_all_ones(self: pysparq._core.ShiftLeft_InPlace, conds: collections.abc.Sequence[typing.SupportsInt | typing.SupportsIndex]) -> pysparq._core.ShiftLeft_InPlace

Condition this operation on registers where all bits are 1.

Calling this method replaces prior all-ones conditions. Pass the list overload to require several registers simultaneously; conditions of different kinds are combined with logical AND.

参数:
  • cond -- Register name (str) or ID (int) to condition on.

  • conds -- List of register names or IDs for multi-condition.

返回:

Self, for method chaining.

conditioned_by_bit(*args, **kwargs)

Overloaded function.

  1. conditioned_by_bit(self: pysparq._core.ShiftLeft_InPlace, cond: str, pos: typing.SupportsInt | typing.SupportsIndex) -> pysparq._core.ShiftLeft_InPlace

Condition this operation on a specific bit position.

Calling this method replaces prior bit conditions. Pass the list-of-pairs overload to require several bits simultaneously; conditions of different kinds are combined with logical AND.

参数:
  • cond -- Register name (str) or ID (int).

  • pos -- Bit position to check (0-indexed).

  • conds -- List of (register, position) pairs.

返回:

Self, for method chaining.

  1. conditioned_by_bit(self: pysparq._core.ShiftLeft_InPlace, conds: collections.abc.Sequence[tuple[str, typing.SupportsInt | typing.SupportsIndex]]) -> pysparq._core.ShiftLeft_InPlace

Condition this operation on a specific bit position.

Calling this method replaces prior bit conditions. Pass the list-of-pairs overload to require several bits simultaneously; conditions of different kinds are combined with logical AND.

参数:
  • cond -- Register name (str) or ID (int).

  • pos -- Bit position to check (0-indexed).

  • conds -- List of (register, position) pairs.

返回:

Self, for method chaining.

  1. conditioned_by_bit(self: pysparq._core.ShiftLeft_InPlace, cond: typing.SupportsInt | typing.SupportsIndex, pos: typing.SupportsInt | typing.SupportsIndex) -> pysparq._core.ShiftLeft_InPlace

Condition this operation on a specific bit position.

Calling this method replaces prior bit conditions. Pass the list-of-pairs overload to require several bits simultaneously; conditions of different kinds are combined with logical AND.

参数:
  • cond -- Register name (str) or ID (int).

  • pos -- Bit position to check (0-indexed).

  • conds -- List of (register, position) pairs.

返回:

Self, for method chaining.

  1. conditioned_by_bit(self: pysparq._core.ShiftLeft_InPlace, conds: collections.abc.Sequence[tuple[typing.SupportsInt | typing.SupportsIndex, typing.SupportsInt | typing.SupportsIndex]]) -> pysparq._core.ShiftLeft_InPlace

Condition this operation on a specific bit position.

Calling this method replaces prior bit conditions. Pass the list-of-pairs overload to require several bits simultaneously; conditions of different kinds are combined with logical AND.

参数:
  • cond -- Register name (str) or ID (int).

  • pos -- Bit position to check (0-indexed).

  • conds -- List of (register, position) pairs.

返回:

Self, for method chaining.

conditioned_by_nonzeros(*args, **kwargs)

Overloaded function.

  1. conditioned_by_nonzeros(self: pysparq._core.ShiftLeft_InPlace, cond: str) -> pysparq._core.ShiftLeft_InPlace

Condition this operation on registers with nonzero values.

Calling this method replaces prior nonzero-register conditions. Pass the list overload to require several registers simultaneously; conditions of different kinds are combined with logical AND.

参数:
  • cond -- Register name (str) or ID (int) to condition on.

  • conds -- List of register names or IDs for multi-condition.

返回:

Self, for method chaining.

示例

op.conditioned_by_nonzeros('control_reg')(state)

  1. conditioned_by_nonzeros(self: pysparq._core.ShiftLeft_InPlace, conds: collections.abc.Sequence[str]) -> pysparq._core.ShiftLeft_InPlace

Condition this operation on registers with nonzero values.

Calling this method replaces prior nonzero-register conditions. Pass the list overload to require several registers simultaneously; conditions of different kinds are combined with logical AND.

参数:
  • cond -- Register name (str) or ID (int) to condition on.

  • conds -- List of register names or IDs for multi-condition.

返回:

Self, for method chaining.

示例

op.conditioned_by_nonzeros('control_reg')(state)

  1. conditioned_by_nonzeros(self: pysparq._core.ShiftLeft_InPlace, cond: typing.SupportsInt | typing.SupportsIndex) -> pysparq._core.ShiftLeft_InPlace

Condition this operation on registers with nonzero values.

Calling this method replaces prior nonzero-register conditions. Pass the list overload to require several registers simultaneously; conditions of different kinds are combined with logical AND.

参数:
  • cond -- Register name (str) or ID (int) to condition on.

  • conds -- List of register names or IDs for multi-condition.

返回:

Self, for method chaining.

示例

op.conditioned_by_nonzeros('control_reg')(state)

  1. conditioned_by_nonzeros(self: pysparq._core.ShiftLeft_InPlace, conds: collections.abc.Sequence[typing.SupportsInt | typing.SupportsIndex]) -> pysparq._core.ShiftLeft_InPlace

Condition this operation on registers with nonzero values.

Calling this method replaces prior nonzero-register conditions. Pass the list overload to require several registers simultaneously; conditions of different kinds are combined with logical AND.

参数:
  • cond -- Register name (str) or ID (int) to condition on.

  • conds -- List of register names or IDs for multi-condition.

返回:

Self, for method chaining.

示例

op.conditioned_by_nonzeros('control_reg')(state)

conditioned_by_value(*args, **kwargs)

Overloaded function.

  1. conditioned_by_value(self: pysparq._core.ShiftLeft_InPlace, cond: str, pos: typing.SupportsInt | typing.SupportsIndex) -> pysparq._core.ShiftLeft_InPlace

Condition this operation on registers holding a specific value.

Calling this method replaces prior value conditions. Pass the list-of-pairs overload to require several values simultaneously; conditions of different kinds are combined with logical AND.

参数:
  • cond -- Register name (str) or ID (int).

  • pos -- Value to match.

  • conds -- List of (register, value) pairs.

返回:

Self, for method chaining.

  1. conditioned_by_value(self: pysparq._core.ShiftLeft_InPlace, conds: collections.abc.Sequence[tuple[str, typing.SupportsInt | typing.SupportsIndex]]) -> pysparq._core.ShiftLeft_InPlace

Condition this operation on registers holding a specific value.

Calling this method replaces prior value conditions. Pass the list-of-pairs overload to require several values simultaneously; conditions of different kinds are combined with logical AND.

参数:
  • cond -- Register name (str) or ID (int).

  • pos -- Value to match.

  • conds -- List of (register, value) pairs.

返回:

Self, for method chaining.

  1. conditioned_by_value(self: pysparq._core.ShiftLeft_InPlace, cond: typing.SupportsInt | typing.SupportsIndex, pos: typing.SupportsInt | typing.SupportsIndex) -> pysparq._core.ShiftLeft_InPlace

Condition this operation on registers holding a specific value.

Calling this method replaces prior value conditions. Pass the list-of-pairs overload to require several values simultaneously; conditions of different kinds are combined with logical AND.

参数:
  • cond -- Register name (str) or ID (int).

  • pos -- Value to match.

  • conds -- List of (register, value) pairs.

返回:

Self, for method chaining.

  1. conditioned_by_value(self: pysparq._core.ShiftLeft_InPlace, conds: collections.abc.Sequence[tuple[typing.SupportsInt | typing.SupportsIndex, typing.SupportsInt | typing.SupportsIndex]]) -> pysparq._core.ShiftLeft_InPlace

Condition this operation on registers holding a specific value.

Calling this method replaces prior value conditions. Pass the list-of-pairs overload to require several values simultaneously; conditions of different kinds are combined with logical AND.

参数:
  • cond -- Register name (str) or ID (int).

  • pos -- Value to match.

  • conds -- List of (register, value) pairs.

返回:

Self, for method chaining.

dag(self: pysparq._core.ShiftLeft_InPlace, state: pysparq._core.SparseState) → None

Apply the adjoint (inverse) of this operation.

参数:

state -- The quantum state to operate on.

Note: Only available for self-adjoint operators.

操作: 循环左移 digit 位

Dagger: .dag() 已实现,效果等同 ShiftRight_InPlace(reg, digit);两者互为 dagger。

类型约束: UnsignedInteger 或 SignedInteger。

位约束: digit <= 寄存器大小。

ps.System.clear()

ps.System.add_register("reg", ps.UnsignedInteger, 4)

state = ps.SparseState()
ps.Init_Unsafe("reg", 0b1010)(state)  # 10

ps.ShiftLeft_InPlace("reg", 1)(state)
# reg = 0b0101 = 5

# 撤销
op.dag(state)
# reg = 0b1010 = 10

ShiftRight_InPlace(循环右移)

class pysparq.ShiftRight_InPlace
clear_control_all_ones(self: pysparq._core.ShiftRight_InPlace) → None

Clear all control conditions of the specified type.

clear_control_by_bit(self: pysparq._core.ShiftRight_InPlace) → None

Clear all control conditions of the specified type.

clear_control_by_value(self: pysparq._core.ShiftRight_InPlace) → None

Clear all control conditions of the specified type.

clear_control_nonzeros(self: pysparq._core.ShiftRight_InPlace) → None

Clear all control conditions of the specified type.

property condition_variable_all_ones
property condition_variable_by_bit
property condition_variable_by_value
property condition_variable_nonzeros
conditioned_by_all_ones(*args, **kwargs)

Overloaded function.

  1. conditioned_by_all_ones(self: pysparq._core.ShiftRight_InPlace, cond: str) -> pysparq._core.ShiftRight_InPlace

Condition this operation on registers where all bits are 1.

Calling this method replaces prior all-ones conditions. Pass the list overload to require several registers simultaneously; conditions of different kinds are combined with logical AND.

参数:
  • cond -- Register name (str) or ID (int) to condition on.

  • conds -- List of register names or IDs for multi-condition.

返回:

Self, for method chaining.

  1. conditioned_by_all_ones(self: pysparq._core.ShiftRight_InPlace, conds: collections.abc.Sequence[str]) -> pysparq._core.ShiftRight_InPlace

Condition this operation on registers where all bits are 1.

Calling this method replaces prior all-ones conditions. Pass the list overload to require several registers simultaneously; conditions of different kinds are combined with logical AND.

参数:
  • cond -- Register name (str) or ID (int) to condition on.

  • conds -- List of register names or IDs for multi-condition.

返回:

Self, for method chaining.

  1. conditioned_by_all_ones(self: pysparq._core.ShiftRight_InPlace, cond: typing.SupportsInt | typing.SupportsIndex) -> pysparq._core.ShiftRight_InPlace

Condition this operation on registers where all bits are 1.

Calling this method replaces prior all-ones conditions. Pass the list overload to require several registers simultaneously; conditions of different kinds are combined with logical AND.

参数:
  • cond -- Register name (str) or ID (int) to condition on.

  • conds -- List of register names or IDs for multi-condition.

返回:

Self, for method chaining.

  1. conditioned_by_all_ones(self: pysparq._core.ShiftRight_InPlace, conds: collections.abc.Sequence[typing.SupportsInt | typing.SupportsIndex]) -> pysparq._core.ShiftRight_InPlace

Condition this operation on registers where all bits are 1.

Calling this method replaces prior all-ones conditions. Pass the list overload to require several registers simultaneously; conditions of different kinds are combined with logical AND.

参数:
  • cond -- Register name (str) or ID (int) to condition on.

  • conds -- List of register names or IDs for multi-condition.

返回:

Self, for method chaining.

conditioned_by_bit(*args, **kwargs)

Overloaded function.

  1. conditioned_by_bit(self: pysparq._core.ShiftRight_InPlace, cond: str, pos: typing.SupportsInt | typing.SupportsIndex) -> pysparq._core.ShiftRight_InPlace

Condition this operation on a specific bit position.

Calling this method replaces prior bit conditions. Pass the list-of-pairs overload to require several bits simultaneously; conditions of different kinds are combined with logical AND.

参数:
  • cond -- Register name (str) or ID (int).

  • pos -- Bit position to check (0-indexed).

  • conds -- List of (register, position) pairs.

返回:

Self, for method chaining.

  1. conditioned_by_bit(self: pysparq._core.ShiftRight_InPlace, conds: collections.abc.Sequence[tuple[str, typing.SupportsInt | typing.SupportsIndex]]) -> pysparq._core.ShiftRight_InPlace

Condition this operation on a specific bit position.

Calling this method replaces prior bit conditions. Pass the list-of-pairs overload to require several bits simultaneously; conditions of different kinds are combined with logical AND.

参数:
  • cond -- Register name (str) or ID (int).

  • pos -- Bit position to check (0-indexed).

  • conds -- List of (register, position) pairs.

返回:

Self, for method chaining.

  1. conditioned_by_bit(self: pysparq._core.ShiftRight_InPlace, cond: typing.SupportsInt | typing.SupportsIndex, pos: typing.SupportsInt | typing.SupportsIndex) -> pysparq._core.ShiftRight_InPlace

Condition this operation on a specific bit position.

Calling this method replaces prior bit conditions. Pass the list-of-pairs overload to require several bits simultaneously; conditions of different kinds are combined with logical AND.

参数:
  • cond -- Register name (str) or ID (int).

  • pos -- Bit position to check (0-indexed).

  • conds -- List of (register, position) pairs.

返回:

Self, for method chaining.

  1. conditioned_by_bit(self: pysparq._core.ShiftRight_InPlace, conds: collections.abc.Sequence[tuple[typing.SupportsInt | typing.SupportsIndex, typing.SupportsInt | typing.SupportsIndex]]) -> pysparq._core.ShiftRight_InPlace

Condition this operation on a specific bit position.

Calling this method replaces prior bit conditions. Pass the list-of-pairs overload to require several bits simultaneously; conditions of different kinds are combined with logical AND.

参数:
  • cond -- Register name (str) or ID (int).

  • pos -- Bit position to check (0-indexed).

  • conds -- List of (register, position) pairs.

返回:

Self, for method chaining.

conditioned_by_nonzeros(*args, **kwargs)

Overloaded function.

  1. conditioned_by_nonzeros(self: pysparq._core.ShiftRight_InPlace, cond: str) -> pysparq._core.ShiftRight_InPlace

Condition this operation on registers with nonzero values.

Calling this method replaces prior nonzero-register conditions. Pass the list overload to require several registers simultaneously; conditions of different kinds are combined with logical AND.

参数:
  • cond -- Register name (str) or ID (int) to condition on.

  • conds -- List of register names or IDs for multi-condition.

返回:

Self, for method chaining.

示例

op.conditioned_by_nonzeros('control_reg')(state)

  1. conditioned_by_nonzeros(self: pysparq._core.ShiftRight_InPlace, conds: collections.abc.Sequence[str]) -> pysparq._core.ShiftRight_InPlace

Condition this operation on registers with nonzero values.

Calling this method replaces prior nonzero-register conditions. Pass the list overload to require several registers simultaneously; conditions of different kinds are combined with logical AND.

参数:
  • cond -- Register name (str) or ID (int) to condition on.

  • conds -- List of register names or IDs for multi-condition.

返回:

Self, for method chaining.

示例

op.conditioned_by_nonzeros('control_reg')(state)

  1. conditioned_by_nonzeros(self: pysparq._core.ShiftRight_InPlace, cond: typing.SupportsInt | typing.SupportsIndex) -> pysparq._core.ShiftRight_InPlace

Condition this operation on registers with nonzero values.

Calling this method replaces prior nonzero-register conditions. Pass the list overload to require several registers simultaneously; conditions of different kinds are combined with logical AND.

参数:
  • cond -- Register name (str) or ID (int) to condition on.

  • conds -- List of register names or IDs for multi-condition.

返回:

Self, for method chaining.

示例

op.conditioned_by_nonzeros('control_reg')(state)

  1. conditioned_by_nonzeros(self: pysparq._core.ShiftRight_InPlace, conds: collections.abc.Sequence[typing.SupportsInt | typing.SupportsIndex]) -> pysparq._core.ShiftRight_InPlace

Condition this operation on registers with nonzero values.

Calling this method replaces prior nonzero-register conditions. Pass the list overload to require several registers simultaneously; conditions of different kinds are combined with logical AND.

参数:
  • cond -- Register name (str) or ID (int) to condition on.

  • conds -- List of register names or IDs for multi-condition.

返回:

Self, for method chaining.

示例

op.conditioned_by_nonzeros('control_reg')(state)

conditioned_by_value(*args, **kwargs)

Overloaded function.

  1. conditioned_by_value(self: pysparq._core.ShiftRight_InPlace, cond: str, pos: typing.SupportsInt | typing.SupportsIndex) -> pysparq._core.ShiftRight_InPlace

Condition this operation on registers holding a specific value.

Calling this method replaces prior value conditions. Pass the list-of-pairs overload to require several values simultaneously; conditions of different kinds are combined with logical AND.

参数:
  • cond -- Register name (str) or ID (int).

  • pos -- Value to match.

  • conds -- List of (register, value) pairs.

返回:

Self, for method chaining.

  1. conditioned_by_value(self: pysparq._core.ShiftRight_InPlace, conds: collections.abc.Sequence[tuple[str, typing.SupportsInt | typing.SupportsIndex]]) -> pysparq._core.ShiftRight_InPlace

Condition this operation on registers holding a specific value.

Calling this method replaces prior value conditions. Pass the list-of-pairs overload to require several values simultaneously; conditions of different kinds are combined with logical AND.

参数:
  • cond -- Register name (str) or ID (int).

  • pos -- Value to match.

  • conds -- List of (register, value) pairs.

返回:

Self, for method chaining.

  1. conditioned_by_value(self: pysparq._core.ShiftRight_InPlace, cond: typing.SupportsInt | typing.SupportsIndex, pos: typing.SupportsInt | typing.SupportsIndex) -> pysparq._core.ShiftRight_InPlace

Condition this operation on registers holding a specific value.

Calling this method replaces prior value conditions. Pass the list-of-pairs overload to require several values simultaneously; conditions of different kinds are combined with logical AND.

参数:
  • cond -- Register name (str) or ID (int).

  • pos -- Value to match.

  • conds -- List of (register, value) pairs.

返回:

Self, for method chaining.

  1. conditioned_by_value(self: pysparq._core.ShiftRight_InPlace, conds: collections.abc.Sequence[tuple[typing.SupportsInt | typing.SupportsIndex, typing.SupportsInt | typing.SupportsIndex]]) -> pysparq._core.ShiftRight_InPlace

Condition this operation on registers holding a specific value.

Calling this method replaces prior value conditions. Pass the list-of-pairs overload to require several values simultaneously; conditions of different kinds are combined with logical AND.

参数:
  • cond -- Register name (str) or ID (int).

  • pos -- Value to match.

  • conds -- List of (register, value) pairs.

返回:

Self, for method chaining.

dag(self: pysparq._core.ShiftRight_InPlace, state: pysparq._core.SparseState) → None

Apply the adjoint (inverse) of this operation.

参数:

state -- The quantum state to operate on.

Note: Only available for self-adjoint operators.

操作: 循环右移 digit 位

Dagger: ShiftLeft_InPlace(reg, digit)

ps.Init_Unsafe("reg", 0b1010)(state)  # 10

ps.ShiftRight_InPlace("reg", 1)(state)
# reg = 0b0101 = 5

# ShiftLeft_InPlace 和 ShiftRight_InPlace 互为逆
ps.ShiftLeft_InPlace("reg", 1)(state)
# reg = 0b1010 = 10

---

比较算子

Compare_UInt_UInt(比较)

class pysparq.Compare_UInt_UInt
clear_control_all_ones(self: pysparq._core.Compare_UInt_UInt) → None

Clear all control conditions of the specified type.

clear_control_by_bit(self: pysparq._core.Compare_UInt_UInt) → None

Clear all control conditions of the specified type.

clear_control_by_value(self: pysparq._core.Compare_UInt_UInt) → None

Clear all control conditions of the specified type.

clear_control_nonzeros(self: pysparq._core.Compare_UInt_UInt) → None

Clear all control conditions of the specified type.

property condition_variable_all_ones
property condition_variable_by_bit
property condition_variable_by_value
property condition_variable_nonzeros
conditioned_by_all_ones(*args, **kwargs)

Overloaded function.

  1. conditioned_by_all_ones(self: pysparq._core.Compare_UInt_UInt, cond: str) -> pysparq._core.Compare_UInt_UInt

Condition this operation on registers where all bits are 1.

Calling this method replaces prior all-ones conditions. Pass the list overload to require several registers simultaneously; conditions of different kinds are combined with logical AND.

参数:
  • cond -- Register name (str) or ID (int) to condition on.

  • conds -- List of register names or IDs for multi-condition.

返回:

Self, for method chaining.

  1. conditioned_by_all_ones(self: pysparq._core.Compare_UInt_UInt, conds: collections.abc.Sequence[str]) -> pysparq._core.Compare_UInt_UInt

Condition this operation on registers where all bits are 1.

Calling this method replaces prior all-ones conditions. Pass the list overload to require several registers simultaneously; conditions of different kinds are combined with logical AND.

参数:
  • cond -- Register name (str) or ID (int) to condition on.

  • conds -- List of register names or IDs for multi-condition.

返回:

Self, for method chaining.

  1. conditioned_by_all_ones(self: pysparq._core.Compare_UInt_UInt, cond: typing.SupportsInt | typing.SupportsIndex) -> pysparq._core.Compare_UInt_UInt

Condition this operation on registers where all bits are 1.

Calling this method replaces prior all-ones conditions. Pass the list overload to require several registers simultaneously; conditions of different kinds are combined with logical AND.

参数:
  • cond -- Register name (str) or ID (int) to condition on.

  • conds -- List of register names or IDs for multi-condition.

返回:

Self, for method chaining.

  1. conditioned_by_all_ones(self: pysparq._core.Compare_UInt_UInt, conds: collections.abc.Sequence[typing.SupportsInt | typing.SupportsIndex]) -> pysparq._core.Compare_UInt_UInt

Condition this operation on registers where all bits are 1.

Calling this method replaces prior all-ones conditions. Pass the list overload to require several registers simultaneously; conditions of different kinds are combined with logical AND.

参数:
  • cond -- Register name (str) or ID (int) to condition on.

  • conds -- List of register names or IDs for multi-condition.

返回:

Self, for method chaining.

conditioned_by_bit(*args, **kwargs)

Overloaded function.

  1. conditioned_by_bit(self: pysparq._core.Compare_UInt_UInt, cond: str, pos: typing.SupportsInt | typing.SupportsIndex) -> pysparq._core.Compare_UInt_UInt

Condition this operation on a specific bit position.

Calling this method replaces prior bit conditions. Pass the list-of-pairs overload to require several bits simultaneously; conditions of different kinds are combined with logical AND.

参数:
  • cond -- Register name (str) or ID (int).

  • pos -- Bit position to check (0-indexed).

  • conds -- List of (register, position) pairs.

返回:

Self, for method chaining.

  1. conditioned_by_bit(self: pysparq._core.Compare_UInt_UInt, conds: collections.abc.Sequence[tuple[str, typing.SupportsInt | typing.SupportsIndex]]) -> pysparq._core.Compare_UInt_UInt

Condition this operation on a specific bit position.

Calling this method replaces prior bit conditions. Pass the list-of-pairs overload to require several bits simultaneously; conditions of different kinds are combined with logical AND.

参数:
  • cond -- Register name (str) or ID (int).

  • pos -- Bit position to check (0-indexed).

  • conds -- List of (register, position) pairs.

返回:

Self, for method chaining.

  1. conditioned_by_bit(self: pysparq._core.Compare_UInt_UInt, cond: typing.SupportsInt | typing.SupportsIndex, pos: typing.SupportsInt | typing.SupportsIndex) -> pysparq._core.Compare_UInt_UInt

Condition this operation on a specific bit position.

Calling this method replaces prior bit conditions. Pass the list-of-pairs overload to require several bits simultaneously; conditions of different kinds are combined with logical AND.

参数:
  • cond -- Register name (str) or ID (int).

  • pos -- Bit position to check (0-indexed).

  • conds -- List of (register, position) pairs.

返回:

Self, for method chaining.

  1. conditioned_by_bit(self: pysparq._core.Compare_UInt_UInt, conds: collections.abc.Sequence[tuple[typing.SupportsInt | typing.SupportsIndex, typing.SupportsInt | typing.SupportsIndex]]) -> pysparq._core.Compare_UInt_UInt

Condition this operation on a specific bit position.

Calling this method replaces prior bit conditions. Pass the list-of-pairs overload to require several bits simultaneously; conditions of different kinds are combined with logical AND.

参数:
  • cond -- Register name (str) or ID (int).

  • pos -- Bit position to check (0-indexed).

  • conds -- List of (register, position) pairs.

返回:

Self, for method chaining.

conditioned_by_nonzeros(*args, **kwargs)

Overloaded function.

  1. conditioned_by_nonzeros(self: pysparq._core.Compare_UInt_UInt, cond: str) -> pysparq._core.Compare_UInt_UInt

Condition this operation on registers with nonzero values.

Calling this method replaces prior nonzero-register conditions. Pass the list overload to require several registers simultaneously; conditions of different kinds are combined with logical AND.

参数:
  • cond -- Register name (str) or ID (int) to condition on.

  • conds -- List of register names or IDs for multi-condition.

返回:

Self, for method chaining.

示例

op.conditioned_by_nonzeros('control_reg')(state)

  1. conditioned_by_nonzeros(self: pysparq._core.Compare_UInt_UInt, conds: collections.abc.Sequence[str]) -> pysparq._core.Compare_UInt_UInt

Condition this operation on registers with nonzero values.

Calling this method replaces prior nonzero-register conditions. Pass the list overload to require several registers simultaneously; conditions of different kinds are combined with logical AND.

参数:
  • cond -- Register name (str) or ID (int) to condition on.

  • conds -- List of register names or IDs for multi-condition.

返回:

Self, for method chaining.

示例

op.conditioned_by_nonzeros('control_reg')(state)

  1. conditioned_by_nonzeros(self: pysparq._core.Compare_UInt_UInt, cond: typing.SupportsInt | typing.SupportsIndex) -> pysparq._core.Compare_UInt_UInt

Condition this operation on registers with nonzero values.

Calling this method replaces prior nonzero-register conditions. Pass the list overload to require several registers simultaneously; conditions of different kinds are combined with logical AND.

参数:
  • cond -- Register name (str) or ID (int) to condition on.

  • conds -- List of register names or IDs for multi-condition.

返回:

Self, for method chaining.

示例

op.conditioned_by_nonzeros('control_reg')(state)

  1. conditioned_by_nonzeros(self: pysparq._core.Compare_UInt_UInt, conds: collections.abc.Sequence[typing.SupportsInt | typing.SupportsIndex]) -> pysparq._core.Compare_UInt_UInt

Condition this operation on registers with nonzero values.

Calling this method replaces prior nonzero-register conditions. Pass the list overload to require several registers simultaneously; conditions of different kinds are combined with logical AND.

参数:
  • cond -- Register name (str) or ID (int) to condition on.

  • conds -- List of register names or IDs for multi-condition.

返回:

Self, for method chaining.

示例

op.conditioned_by_nonzeros('control_reg')(state)

conditioned_by_value(*args, **kwargs)

Overloaded function.

  1. conditioned_by_value(self: pysparq._core.Compare_UInt_UInt, cond: str, pos: typing.SupportsInt | typing.SupportsIndex) -> pysparq._core.Compare_UInt_UInt

Condition this operation on registers holding a specific value.

Calling this method replaces prior value conditions. Pass the list-of-pairs overload to require several values simultaneously; conditions of different kinds are combined with logical AND.

参数:
  • cond -- Register name (str) or ID (int).

  • pos -- Value to match.

  • conds -- List of (register, value) pairs.

返回:

Self, for method chaining.

  1. conditioned_by_value(self: pysparq._core.Compare_UInt_UInt, conds: collections.abc.Sequence[tuple[str, typing.SupportsInt | typing.SupportsIndex]]) -> pysparq._core.Compare_UInt_UInt

Condition this operation on registers holding a specific value.

Calling this method replaces prior value conditions. Pass the list-of-pairs overload to require several values simultaneously; conditions of different kinds are combined with logical AND.

参数:
  • cond -- Register name (str) or ID (int).

  • pos -- Value to match.

  • conds -- List of (register, value) pairs.

返回:

Self, for method chaining.

  1. conditioned_by_value(self: pysparq._core.Compare_UInt_UInt, cond: typing.SupportsInt | typing.SupportsIndex, pos: typing.SupportsInt | typing.SupportsIndex) -> pysparq._core.Compare_UInt_UInt

Condition this operation on registers holding a specific value.

Calling this method replaces prior value conditions. Pass the list-of-pairs overload to require several values simultaneously; conditions of different kinds are combined with logical AND.

参数:
  • cond -- Register name (str) or ID (int).

  • pos -- Value to match.

  • conds -- List of (register, value) pairs.

返回:

Self, for method chaining.

  1. conditioned_by_value(self: pysparq._core.Compare_UInt_UInt, conds: collections.abc.Sequence[tuple[typing.SupportsInt | typing.SupportsIndex, typing.SupportsInt | typing.SupportsIndex]]) -> pysparq._core.Compare_UInt_UInt

Condition this operation on registers holding a specific value.

Calling this method replaces prior value conditions. Pass the list-of-pairs overload to require several values simultaneously; conditions of different kinds are combined with logical AND.

参数:
  • cond -- Register name (str) or ID (int).

  • pos -- Value to match.

  • conds -- List of (register, value) pairs.

返回:

Self, for method chaining.

操作: 设置 less_flag 和 equal_flag 基于 lhs < rhs 和 lhs == rhs。

类型约束: 输入 UnsignedInteger,输出 Boolean。

ps.System.clear()

ps.System.add_register("lhs", ps.UnsignedInteger, 4)
ps.System.add_register("rhs", ps.UnsignedInteger, 4)
ps.System.add_register("less", ps.Boolean, 1)
ps.System.add_register("equal", ps.Boolean, 1)

state = ps.SparseState()
ps.Init_Unsafe("lhs", 3)(state)
ps.Init_Unsafe("rhs", 5)(state)

ps.Compare_UInt_UInt("lhs", "rhs", "less", "equal")(state)
# less = 1 (3 < 5), equal = 0

Less_UInt_UInt(小于比较)

class pysparq.Less_UInt_UInt
clear_control_all_ones(self: pysparq._core.Less_UInt_UInt) → None

Clear all control conditions of the specified type.

clear_control_by_bit(self: pysparq._core.Less_UInt_UInt) → None

Clear all control conditions of the specified type.

clear_control_by_value(self: pysparq._core.Less_UInt_UInt) → None

Clear all control conditions of the specified type.

clear_control_nonzeros(self: pysparq._core.Less_UInt_UInt) → None

Clear all control conditions of the specified type.

property condition_variable_all_ones
property condition_variable_by_bit
property condition_variable_by_value
property condition_variable_nonzeros
conditioned_by_all_ones(*args, **kwargs)

Overloaded function.

  1. conditioned_by_all_ones(self: pysparq._core.Less_UInt_UInt, cond: str) -> pysparq._core.Less_UInt_UInt

Condition this operation on registers where all bits are 1.

Calling this method replaces prior all-ones conditions. Pass the list overload to require several registers simultaneously; conditions of different kinds are combined with logical AND.

参数:
  • cond -- Register name (str) or ID (int) to condition on.

  • conds -- List of register names or IDs for multi-condition.

返回:

Self, for method chaining.

  1. conditioned_by_all_ones(self: pysparq._core.Less_UInt_UInt, conds: collections.abc.Sequence[str]) -> pysparq._core.Less_UInt_UInt

Condition this operation on registers where all bits are 1.

Calling this method replaces prior all-ones conditions. Pass the list overload to require several registers simultaneously; conditions of different kinds are combined with logical AND.

参数:
  • cond -- Register name (str) or ID (int) to condition on.

  • conds -- List of register names or IDs for multi-condition.

返回:

Self, for method chaining.

  1. conditioned_by_all_ones(self: pysparq._core.Less_UInt_UInt, cond: typing.SupportsInt | typing.SupportsIndex) -> pysparq._core.Less_UInt_UInt

Condition this operation on registers where all bits are 1.

Calling this method replaces prior all-ones conditions. Pass the list overload to require several registers simultaneously; conditions of different kinds are combined with logical AND.

参数:
  • cond -- Register name (str) or ID (int) to condition on.

  • conds -- List of register names or IDs for multi-condition.

返回:

Self, for method chaining.

  1. conditioned_by_all_ones(self: pysparq._core.Less_UInt_UInt, conds: collections.abc.Sequence[typing.SupportsInt | typing.SupportsIndex]) -> pysparq._core.Less_UInt_UInt

Condition this operation on registers where all bits are 1.

Calling this method replaces prior all-ones conditions. Pass the list overload to require several registers simultaneously; conditions of different kinds are combined with logical AND.

参数:
  • cond -- Register name (str) or ID (int) to condition on.

  • conds -- List of register names or IDs for multi-condition.

返回:

Self, for method chaining.

conditioned_by_bit(*args, **kwargs)

Overloaded function.

  1. conditioned_by_bit(self: pysparq._core.Less_UInt_UInt, cond: str, pos: typing.SupportsInt | typing.SupportsIndex) -> pysparq._core.Less_UInt_UInt

Condition this operation on a specific bit position.

Calling this method replaces prior bit conditions. Pass the list-of-pairs overload to require several bits simultaneously; conditions of different kinds are combined with logical AND.

参数:
  • cond -- Register name (str) or ID (int).

  • pos -- Bit position to check (0-indexed).

  • conds -- List of (register, position) pairs.

返回:

Self, for method chaining.

  1. conditioned_by_bit(self: pysparq._core.Less_UInt_UInt, conds: collections.abc.Sequence[tuple[str, typing.SupportsInt | typing.SupportsIndex]]) -> pysparq._core.Less_UInt_UInt

Condition this operation on a specific bit position.

Calling this method replaces prior bit conditions. Pass the list-of-pairs overload to require several bits simultaneously; conditions of different kinds are combined with logical AND.

参数:
  • cond -- Register name (str) or ID (int).

  • pos -- Bit position to check (0-indexed).

  • conds -- List of (register, position) pairs.

返回:

Self, for method chaining.

  1. conditioned_by_bit(self: pysparq._core.Less_UInt_UInt, cond: typing.SupportsInt | typing.SupportsIndex, pos: typing.SupportsInt | typing.SupportsIndex) -> pysparq._core.Less_UInt_UInt

Condition this operation on a specific bit position.

Calling this method replaces prior bit conditions. Pass the list-of-pairs overload to require several bits simultaneously; conditions of different kinds are combined with logical AND.

参数:
  • cond -- Register name (str) or ID (int).

  • pos -- Bit position to check (0-indexed).

  • conds -- List of (register, position) pairs.

返回:

Self, for method chaining.

  1. conditioned_by_bit(self: pysparq._core.Less_UInt_UInt, conds: collections.abc.Sequence[tuple[typing.SupportsInt | typing.SupportsIndex, typing.SupportsInt | typing.SupportsIndex]]) -> pysparq._core.Less_UInt_UInt

Condition this operation on a specific bit position.

Calling this method replaces prior bit conditions. Pass the list-of-pairs overload to require several bits simultaneously; conditions of different kinds are combined with logical AND.

参数:
  • cond -- Register name (str) or ID (int).

  • pos -- Bit position to check (0-indexed).

  • conds -- List of (register, position) pairs.

返回:

Self, for method chaining.

conditioned_by_nonzeros(*args, **kwargs)

Overloaded function.

  1. conditioned_by_nonzeros(self: pysparq._core.Less_UInt_UInt, cond: str) -> pysparq._core.Less_UInt_UInt

Condition this operation on registers with nonzero values.

Calling this method replaces prior nonzero-register conditions. Pass the list overload to require several registers simultaneously; conditions of different kinds are combined with logical AND.

参数:
  • cond -- Register name (str) or ID (int) to condition on.

  • conds -- List of register names or IDs for multi-condition.

返回:

Self, for method chaining.

示例

op.conditioned_by_nonzeros('control_reg')(state)

  1. conditioned_by_nonzeros(self: pysparq._core.Less_UInt_UInt, conds: collections.abc.Sequence[str]) -> pysparq._core.Less_UInt_UInt

Condition this operation on registers with nonzero values.

Calling this method replaces prior nonzero-register conditions. Pass the list overload to require several registers simultaneously; conditions of different kinds are combined with logical AND.

参数:
  • cond -- Register name (str) or ID (int) to condition on.

  • conds -- List of register names or IDs for multi-condition.

返回:

Self, for method chaining.

示例

op.conditioned_by_nonzeros('control_reg')(state)

  1. conditioned_by_nonzeros(self: pysparq._core.Less_UInt_UInt, cond: typing.SupportsInt | typing.SupportsIndex) -> pysparq._core.Less_UInt_UInt

Condition this operation on registers with nonzero values.

Calling this method replaces prior nonzero-register conditions. Pass the list overload to require several registers simultaneously; conditions of different kinds are combined with logical AND.

参数:
  • cond -- Register name (str) or ID (int) to condition on.

  • conds -- List of register names or IDs for multi-condition.

返回:

Self, for method chaining.

示例

op.conditioned_by_nonzeros('control_reg')(state)

  1. conditioned_by_nonzeros(self: pysparq._core.Less_UInt_UInt, conds: collections.abc.Sequence[typing.SupportsInt | typing.SupportsIndex]) -> pysparq._core.Less_UInt_UInt

Condition this operation on registers with nonzero values.

Calling this method replaces prior nonzero-register conditions. Pass the list overload to require several registers simultaneously; conditions of different kinds are combined with logical AND.

参数:
  • cond -- Register name (str) or ID (int) to condition on.

  • conds -- List of register names or IDs for multi-condition.

返回:

Self, for method chaining.

示例

op.conditioned_by_nonzeros('control_reg')(state)

conditioned_by_value(*args, **kwargs)

Overloaded function.

  1. conditioned_by_value(self: pysparq._core.Less_UInt_UInt, cond: str, pos: typing.SupportsInt | typing.SupportsIndex) -> pysparq._core.Less_UInt_UInt

Condition this operation on registers holding a specific value.

Calling this method replaces prior value conditions. Pass the list-of-pairs overload to require several values simultaneously; conditions of different kinds are combined with logical AND.

参数:
  • cond -- Register name (str) or ID (int).

  • pos -- Value to match.

  • conds -- List of (register, value) pairs.

返回:

Self, for method chaining.

  1. conditioned_by_value(self: pysparq._core.Less_UInt_UInt, conds: collections.abc.Sequence[tuple[str, typing.SupportsInt | typing.SupportsIndex]]) -> pysparq._core.Less_UInt_UInt

Condition this operation on registers holding a specific value.

Calling this method replaces prior value conditions. Pass the list-of-pairs overload to require several values simultaneously; conditions of different kinds are combined with logical AND.

参数:
  • cond -- Register name (str) or ID (int).

  • pos -- Value to match.

  • conds -- List of (register, value) pairs.

返回:

Self, for method chaining.

  1. conditioned_by_value(self: pysparq._core.Less_UInt_UInt, cond: typing.SupportsInt | typing.SupportsIndex, pos: typing.SupportsInt | typing.SupportsIndex) -> pysparq._core.Less_UInt_UInt

Condition this operation on registers holding a specific value.

Calling this method replaces prior value conditions. Pass the list-of-pairs overload to require several values simultaneously; conditions of different kinds are combined with logical AND.

参数:
  • cond -- Register name (str) or ID (int).

  • pos -- Value to match.

  • conds -- List of (register, value) pairs.

返回:

Self, for method chaining.

  1. conditioned_by_value(self: pysparq._core.Less_UInt_UInt, conds: collections.abc.Sequence[tuple[typing.SupportsInt | typing.SupportsIndex, typing.SupportsInt | typing.SupportsIndex]]) -> pysparq._core.Less_UInt_UInt

Condition this operation on registers holding a specific value.

Calling this method replaces prior value conditions. Pass the list-of-pairs overload to require several values simultaneously; conditions of different kinds are combined with logical AND.

参数:
  • cond -- Register name (str) or ID (int).

  • pos -- Value to match.

  • conds -- List of (register, value) pairs.

返回:

Self, for method chaining.

操作: 仅设置 less_flag。

---

其他算子

Assign(赋值)

class pysparq.Assign
clear_control_all_ones(self: pysparq._core.Assign) → None

Clear all control conditions of the specified type.

clear_control_by_bit(self: pysparq._core.Assign) → None

Clear all control conditions of the specified type.

clear_control_by_value(self: pysparq._core.Assign) → None

Clear all control conditions of the specified type.

clear_control_nonzeros(self: pysparq._core.Assign) → None

Clear all control conditions of the specified type.

property condition_variable_all_ones
property condition_variable_by_bit
property condition_variable_by_value
property condition_variable_nonzeros
conditioned_by_all_ones(*args, **kwargs)

Overloaded function.

  1. conditioned_by_all_ones(self: pysparq._core.Assign, cond: str) -> pysparq._core.Assign

Condition this operation on registers where all bits are 1.

Calling this method replaces prior all-ones conditions. Pass the list overload to require several registers simultaneously; conditions of different kinds are combined with logical AND.

参数:
  • cond -- Register name (str) or ID (int) to condition on.

  • conds -- List of register names or IDs for multi-condition.

返回:

Self, for method chaining.

  1. conditioned_by_all_ones(self: pysparq._core.Assign, conds: collections.abc.Sequence[str]) -> pysparq._core.Assign

Condition this operation on registers where all bits are 1.

Calling this method replaces prior all-ones conditions. Pass the list overload to require several registers simultaneously; conditions of different kinds are combined with logical AND.

参数:
  • cond -- Register name (str) or ID (int) to condition on.

  • conds -- List of register names or IDs for multi-condition.

返回:

Self, for method chaining.

  1. conditioned_by_all_ones(self: pysparq._core.Assign, cond: typing.SupportsInt | typing.SupportsIndex) -> pysparq._core.Assign

Condition this operation on registers where all bits are 1.

Calling this method replaces prior all-ones conditions. Pass the list overload to require several registers simultaneously; conditions of different kinds are combined with logical AND.

参数:
  • cond -- Register name (str) or ID (int) to condition on.

  • conds -- List of register names or IDs for multi-condition.

返回:

Self, for method chaining.

  1. conditioned_by_all_ones(self: pysparq._core.Assign, conds: collections.abc.Sequence[typing.SupportsInt | typing.SupportsIndex]) -> pysparq._core.Assign

Condition this operation on registers where all bits are 1.

Calling this method replaces prior all-ones conditions. Pass the list overload to require several registers simultaneously; conditions of different kinds are combined with logical AND.

参数:
  • cond -- Register name (str) or ID (int) to condition on.

  • conds -- List of register names or IDs for multi-condition.

返回:

Self, for method chaining.

conditioned_by_bit(*args, **kwargs)

Overloaded function.

  1. conditioned_by_bit(self: pysparq._core.Assign, cond: str, pos: typing.SupportsInt | typing.SupportsIndex) -> pysparq._core.Assign

Condition this operation on a specific bit position.

Calling this method replaces prior bit conditions. Pass the list-of-pairs overload to require several bits simultaneously; conditions of different kinds are combined with logical AND.

参数:
  • cond -- Register name (str) or ID (int).

  • pos -- Bit position to check (0-indexed).

  • conds -- List of (register, position) pairs.

返回:

Self, for method chaining.

  1. conditioned_by_bit(self: pysparq._core.Assign, conds: collections.abc.Sequence[tuple[str, typing.SupportsInt | typing.SupportsIndex]]) -> pysparq._core.Assign

Condition this operation on a specific bit position.

Calling this method replaces prior bit conditions. Pass the list-of-pairs overload to require several bits simultaneously; conditions of different kinds are combined with logical AND.

参数:
  • cond -- Register name (str) or ID (int).

  • pos -- Bit position to check (0-indexed).

  • conds -- List of (register, position) pairs.

返回:

Self, for method chaining.

  1. conditioned_by_bit(self: pysparq._core.Assign, cond: typing.SupportsInt | typing.SupportsIndex, pos: typing.SupportsInt | typing.SupportsIndex) -> pysparq._core.Assign

Condition this operation on a specific bit position.

Calling this method replaces prior bit conditions. Pass the list-of-pairs overload to require several bits simultaneously; conditions of different kinds are combined with logical AND.

参数:
  • cond -- Register name (str) or ID (int).

  • pos -- Bit position to check (0-indexed).

  • conds -- List of (register, position) pairs.

返回:

Self, for method chaining.

  1. conditioned_by_bit(self: pysparq._core.Assign, conds: collections.abc.Sequence[tuple[typing.SupportsInt | typing.SupportsIndex, typing.SupportsInt | typing.SupportsIndex]]) -> pysparq._core.Assign

Condition this operation on a specific bit position.

Calling this method replaces prior bit conditions. Pass the list-of-pairs overload to require several bits simultaneously; conditions of different kinds are combined with logical AND.

参数:
  • cond -- Register name (str) or ID (int).

  • pos -- Bit position to check (0-indexed).

  • conds -- List of (register, position) pairs.

返回:

Self, for method chaining.

conditioned_by_nonzeros(*args, **kwargs)

Overloaded function.

  1. conditioned_by_nonzeros(self: pysparq._core.Assign, cond: str) -> pysparq._core.Assign

Condition this operation on registers with nonzero values.

Calling this method replaces prior nonzero-register conditions. Pass the list overload to require several registers simultaneously; conditions of different kinds are combined with logical AND.

参数:
  • cond -- Register name (str) or ID (int) to condition on.

  • conds -- List of register names or IDs for multi-condition.

返回:

Self, for method chaining.

示例

op.conditioned_by_nonzeros('control_reg')(state)

  1. conditioned_by_nonzeros(self: pysparq._core.Assign, conds: collections.abc.Sequence[str]) -> pysparq._core.Assign

Condition this operation on registers with nonzero values.

Calling this method replaces prior nonzero-register conditions. Pass the list overload to require several registers simultaneously; conditions of different kinds are combined with logical AND.

参数:
  • cond -- Register name (str) or ID (int) to condition on.

  • conds -- List of register names or IDs for multi-condition.

返回:

Self, for method chaining.

示例

op.conditioned_by_nonzeros('control_reg')(state)

  1. conditioned_by_nonzeros(self: pysparq._core.Assign, cond: typing.SupportsInt | typing.SupportsIndex) -> pysparq._core.Assign

Condition this operation on registers with nonzero values.

Calling this method replaces prior nonzero-register conditions. Pass the list overload to require several registers simultaneously; conditions of different kinds are combined with logical AND.

参数:
  • cond -- Register name (str) or ID (int) to condition on.

  • conds -- List of register names or IDs for multi-condition.

返回:

Self, for method chaining.

示例

op.conditioned_by_nonzeros('control_reg')(state)

  1. conditioned_by_nonzeros(self: pysparq._core.Assign, conds: collections.abc.Sequence[typing.SupportsInt | typing.SupportsIndex]) -> pysparq._core.Assign

Condition this operation on registers with nonzero values.

Calling this method replaces prior nonzero-register conditions. Pass the list overload to require several registers simultaneously; conditions of different kinds are combined with logical AND.

参数:
  • cond -- Register name (str) or ID (int) to condition on.

  • conds -- List of register names or IDs for multi-condition.

返回:

Self, for method chaining.

示例

op.conditioned_by_nonzeros('control_reg')(state)

conditioned_by_value(*args, **kwargs)

Overloaded function.

  1. conditioned_by_value(self: pysparq._core.Assign, cond: str, pos: typing.SupportsInt | typing.SupportsIndex) -> pysparq._core.Assign

Condition this operation on registers holding a specific value.

Calling this method replaces prior value conditions. Pass the list-of-pairs overload to require several values simultaneously; conditions of different kinds are combined with logical AND.

参数:
  • cond -- Register name (str) or ID (int).

  • pos -- Value to match.

  • conds -- List of (register, value) pairs.

返回:

Self, for method chaining.

  1. conditioned_by_value(self: pysparq._core.Assign, conds: collections.abc.Sequence[tuple[str, typing.SupportsInt | typing.SupportsIndex]]) -> pysparq._core.Assign

Condition this operation on registers holding a specific value.

Calling this method replaces prior value conditions. Pass the list-of-pairs overload to require several values simultaneously; conditions of different kinds are combined with logical AND.

参数:
  • cond -- Register name (str) or ID (int).

  • pos -- Value to match.

  • conds -- List of (register, value) pairs.

返回:

Self, for method chaining.

  1. conditioned_by_value(self: pysparq._core.Assign, cond: typing.SupportsInt | typing.SupportsIndex, pos: typing.SupportsInt | typing.SupportsIndex) -> pysparq._core.Assign

Condition this operation on registers holding a specific value.

Calling this method replaces prior value conditions. Pass the list-of-pairs overload to require several values simultaneously; conditions of different kinds are combined with logical AND.

参数:
  • cond -- Register name (str) or ID (int).

  • pos -- Value to match.

  • conds -- List of (register, value) pairs.

返回:

Self, for method chaining.

  1. conditioned_by_value(self: pysparq._core.Assign, conds: collections.abc.Sequence[tuple[typing.SupportsInt | typing.SupportsIndex, typing.SupportsInt | typing.SupportsIndex]]) -> pysparq._core.Assign

Condition this operation on registers holding a specific value.

Calling this method replaces prior value conditions. Pass the list-of-pairs overload to require several values simultaneously; conditions of different kinds are combined with logical AND.

参数:
  • cond -- Register name (str) or ID (int).

  • pos -- Value to match.

  • conds -- List of (register, value) pairs.

返回:

Self, for method chaining.

操作: dst ^= src

幺正保证: XOR 机制。

ps.System.clear()

ps.System.add_register("src", ps.UnsignedInteger, 4)
ps.System.add_register("dst", ps.UnsignedInteger, 4)

state = ps.SparseState()
ps.Init_Unsafe("src", 5)(state)

# dst = 0 ^ 5 = 5
ps.Assign("src", "dst")(state)

FlipBools(按位取反)

class pysparq.FlipBools
clear_control_all_ones(self: pysparq._core.FlipBools) → None

Clear all control conditions of the specified type.

clear_control_by_bit(self: pysparq._core.FlipBools) → None

Clear all control conditions of the specified type.

clear_control_by_value(self: pysparq._core.FlipBools) → None

Clear all control conditions of the specified type.

clear_control_nonzeros(self: pysparq._core.FlipBools) → None

Clear all control conditions of the specified type.

property condition_variable_all_ones
property condition_variable_by_bit
property condition_variable_by_value
property condition_variable_nonzeros
conditioned_by_all_ones(*args, **kwargs)

Overloaded function.

  1. conditioned_by_all_ones(self: pysparq._core.FlipBools, cond: str) -> pysparq._core.FlipBools

Condition this operation on registers where all bits are 1.

Calling this method replaces prior all-ones conditions. Pass the list overload to require several registers simultaneously; conditions of different kinds are combined with logical AND.

参数:
  • cond -- Register name (str) or ID (int) to condition on.

  • conds -- List of register names or IDs for multi-condition.

返回:

Self, for method chaining.

  1. conditioned_by_all_ones(self: pysparq._core.FlipBools, conds: collections.abc.Sequence[str]) -> pysparq._core.FlipBools

Condition this operation on registers where all bits are 1.

Calling this method replaces prior all-ones conditions. Pass the list overload to require several registers simultaneously; conditions of different kinds are combined with logical AND.

参数:
  • cond -- Register name (str) or ID (int) to condition on.

  • conds -- List of register names or IDs for multi-condition.

返回:

Self, for method chaining.

  1. conditioned_by_all_ones(self: pysparq._core.FlipBools, cond: typing.SupportsInt | typing.SupportsIndex) -> pysparq._core.FlipBools

Condition this operation on registers where all bits are 1.

Calling this method replaces prior all-ones conditions. Pass the list overload to require several registers simultaneously; conditions of different kinds are combined with logical AND.

参数:
  • cond -- Register name (str) or ID (int) to condition on.

  • conds -- List of register names or IDs for multi-condition.

返回:

Self, for method chaining.

  1. conditioned_by_all_ones(self: pysparq._core.FlipBools, conds: collections.abc.Sequence[typing.SupportsInt | typing.SupportsIndex]) -> pysparq._core.FlipBools

Condition this operation on registers where all bits are 1.

Calling this method replaces prior all-ones conditions. Pass the list overload to require several registers simultaneously; conditions of different kinds are combined with logical AND.

参数:
  • cond -- Register name (str) or ID (int) to condition on.

  • conds -- List of register names or IDs for multi-condition.

返回:

Self, for method chaining.

conditioned_by_bit(*args, **kwargs)

Overloaded function.

  1. conditioned_by_bit(self: pysparq._core.FlipBools, cond: str, pos: typing.SupportsInt | typing.SupportsIndex) -> pysparq._core.FlipBools

Condition this operation on a specific bit position.

Calling this method replaces prior bit conditions. Pass the list-of-pairs overload to require several bits simultaneously; conditions of different kinds are combined with logical AND.

参数:
  • cond -- Register name (str) or ID (int).

  • pos -- Bit position to check (0-indexed).

  • conds -- List of (register, position) pairs.

返回:

Self, for method chaining.

  1. conditioned_by_bit(self: pysparq._core.FlipBools, conds: collections.abc.Sequence[tuple[str, typing.SupportsInt | typing.SupportsIndex]]) -> pysparq._core.FlipBools

Condition this operation on a specific bit position.

Calling this method replaces prior bit conditions. Pass the list-of-pairs overload to require several bits simultaneously; conditions of different kinds are combined with logical AND.

参数:
  • cond -- Register name (str) or ID (int).

  • pos -- Bit position to check (0-indexed).

  • conds -- List of (register, position) pairs.

返回:

Self, for method chaining.

  1. conditioned_by_bit(self: pysparq._core.FlipBools, cond: typing.SupportsInt | typing.SupportsIndex, pos: typing.SupportsInt | typing.SupportsIndex) -> pysparq._core.FlipBools

Condition this operation on a specific bit position.

Calling this method replaces prior bit conditions. Pass the list-of-pairs overload to require several bits simultaneously; conditions of different kinds are combined with logical AND.

参数:
  • cond -- Register name (str) or ID (int).

  • pos -- Bit position to check (0-indexed).

  • conds -- List of (register, position) pairs.

返回:

Self, for method chaining.

  1. conditioned_by_bit(self: pysparq._core.FlipBools, conds: collections.abc.Sequence[tuple[typing.SupportsInt | typing.SupportsIndex, typing.SupportsInt | typing.SupportsIndex]]) -> pysparq._core.FlipBools

Condition this operation on a specific bit position.

Calling this method replaces prior bit conditions. Pass the list-of-pairs overload to require several bits simultaneously; conditions of different kinds are combined with logical AND.

参数:
  • cond -- Register name (str) or ID (int).

  • pos -- Bit position to check (0-indexed).

  • conds -- List of (register, position) pairs.

返回:

Self, for method chaining.

conditioned_by_nonzeros(*args, **kwargs)

Overloaded function.

  1. conditioned_by_nonzeros(self: pysparq._core.FlipBools, cond: str) -> pysparq._core.FlipBools

Condition this operation on registers with nonzero values.

Calling this method replaces prior nonzero-register conditions. Pass the list overload to require several registers simultaneously; conditions of different kinds are combined with logical AND.

参数:
  • cond -- Register name (str) or ID (int) to condition on.

  • conds -- List of register names or IDs for multi-condition.

返回:

Self, for method chaining.

示例

op.conditioned_by_nonzeros('control_reg')(state)

  1. conditioned_by_nonzeros(self: pysparq._core.FlipBools, conds: collections.abc.Sequence[str]) -> pysparq._core.FlipBools

Condition this operation on registers with nonzero values.

Calling this method replaces prior nonzero-register conditions. Pass the list overload to require several registers simultaneously; conditions of different kinds are combined with logical AND.

参数:
  • cond -- Register name (str) or ID (int) to condition on.

  • conds -- List of register names or IDs for multi-condition.

返回:

Self, for method chaining.

示例

op.conditioned_by_nonzeros('control_reg')(state)

  1. conditioned_by_nonzeros(self: pysparq._core.FlipBools, cond: typing.SupportsInt | typing.SupportsIndex) -> pysparq._core.FlipBools

Condition this operation on registers with nonzero values.

Calling this method replaces prior nonzero-register conditions. Pass the list overload to require several registers simultaneously; conditions of different kinds are combined with logical AND.

参数:
  • cond -- Register name (str) or ID (int) to condition on.

  • conds -- List of register names or IDs for multi-condition.

返回:

Self, for method chaining.

示例

op.conditioned_by_nonzeros('control_reg')(state)

  1. conditioned_by_nonzeros(self: pysparq._core.FlipBools, conds: collections.abc.Sequence[typing.SupportsInt | typing.SupportsIndex]) -> pysparq._core.FlipBools

Condition this operation on registers with nonzero values.

Calling this method replaces prior nonzero-register conditions. Pass the list overload to require several registers simultaneously; conditions of different kinds are combined with logical AND.

参数:
  • cond -- Register name (str) or ID (int) to condition on.

  • conds -- List of register names or IDs for multi-condition.

返回:

Self, for method chaining.

示例

op.conditioned_by_nonzeros('control_reg')(state)

conditioned_by_value(*args, **kwargs)

Overloaded function.

  1. conditioned_by_value(self: pysparq._core.FlipBools, cond: str, pos: typing.SupportsInt | typing.SupportsIndex) -> pysparq._core.FlipBools

Condition this operation on registers holding a specific value.

Calling this method replaces prior value conditions. Pass the list-of-pairs overload to require several values simultaneously; conditions of different kinds are combined with logical AND.

参数:
  • cond -- Register name (str) or ID (int).

  • pos -- Value to match.

  • conds -- List of (register, value) pairs.

返回:

Self, for method chaining.

  1. conditioned_by_value(self: pysparq._core.FlipBools, conds: collections.abc.Sequence[tuple[str, typing.SupportsInt | typing.SupportsIndex]]) -> pysparq._core.FlipBools

Condition this operation on registers holding a specific value.

Calling this method replaces prior value conditions. Pass the list-of-pairs overload to require several values simultaneously; conditions of different kinds are combined with logical AND.

参数:
  • cond -- Register name (str) or ID (int).

  • pos -- Value to match.

  • conds -- List of (register, value) pairs.

返回:

Self, for method chaining.

  1. conditioned_by_value(self: pysparq._core.FlipBools, cond: typing.SupportsInt | typing.SupportsIndex, pos: typing.SupportsInt | typing.SupportsIndex) -> pysparq._core.FlipBools

Condition this operation on registers holding a specific value.

Calling this method replaces prior value conditions. Pass the list-of-pairs overload to require several values simultaneously; conditions of different kinds are combined with logical AND.

参数:
  • cond -- Register name (str) or ID (int).

  • pos -- Value to match.

  • conds -- List of (register, value) pairs.

返回:

Self, for method chaining.

  1. conditioned_by_value(self: pysparq._core.FlipBools, conds: collections.abc.Sequence[tuple[typing.SupportsInt | typing.SupportsIndex, typing.SupportsInt | typing.SupportsIndex]]) -> pysparq._core.FlipBools

Condition this operation on registers holding a specific value.

Calling this method replaces prior value conditions. Pass the list-of-pairs overload to require several values simultaneously; conditions of different kinds are combined with logical AND.

参数:
  • cond -- Register name (str) or ID (int).

  • pos -- Value to match.

  • conds -- List of (register, value) pairs.

返回:

Self, for method chaining.

操作: reg = ~reg

类型约束: 任意整数类型。

ps.System.clear()

ps.System.add_register("reg", ps.UnsignedInteger, 4)

state = ps.SparseState()
ps.Init_Unsafe("reg", 0b1010)(state)  # 10

ps.FlipBools("reg")(state)
# reg = 0b0101 = 5

Swap_General_General(交换)

class pysparq.Swap_General_General
clear_control_all_ones(self: pysparq._core.Swap_General_General) → None

Clear all control conditions of the specified type.

clear_control_by_bit(self: pysparq._core.Swap_General_General) → None

Clear all control conditions of the specified type.

clear_control_by_value(self: pysparq._core.Swap_General_General) → None

Clear all control conditions of the specified type.

clear_control_nonzeros(self: pysparq._core.Swap_General_General) → None

Clear all control conditions of the specified type.

property condition_variable_all_ones
property condition_variable_by_bit
property condition_variable_by_value
property condition_variable_nonzeros
conditioned_by_all_ones(*args, **kwargs)

Overloaded function.

  1. conditioned_by_all_ones(self: pysparq._core.Swap_General_General, cond: str) -> pysparq._core.Swap_General_General

Condition this operation on registers where all bits are 1.

Calling this method replaces prior all-ones conditions. Pass the list overload to require several registers simultaneously; conditions of different kinds are combined with logical AND.

参数:
  • cond -- Register name (str) or ID (int) to condition on.

  • conds -- List of register names or IDs for multi-condition.

返回:

Self, for method chaining.

  1. conditioned_by_all_ones(self: pysparq._core.Swap_General_General, conds: collections.abc.Sequence[str]) -> pysparq._core.Swap_General_General

Condition this operation on registers where all bits are 1.

Calling this method replaces prior all-ones conditions. Pass the list overload to require several registers simultaneously; conditions of different kinds are combined with logical AND.

参数:
  • cond -- Register name (str) or ID (int) to condition on.

  • conds -- List of register names or IDs for multi-condition.

返回:

Self, for method chaining.

  1. conditioned_by_all_ones(self: pysparq._core.Swap_General_General, cond: typing.SupportsInt | typing.SupportsIndex) -> pysparq._core.Swap_General_General

Condition this operation on registers where all bits are 1.

Calling this method replaces prior all-ones conditions. Pass the list overload to require several registers simultaneously; conditions of different kinds are combined with logical AND.

参数:
  • cond -- Register name (str) or ID (int) to condition on.

  • conds -- List of register names or IDs for multi-condition.

返回:

Self, for method chaining.

  1. conditioned_by_all_ones(self: pysparq._core.Swap_General_General, conds: collections.abc.Sequence[typing.SupportsInt | typing.SupportsIndex]) -> pysparq._core.Swap_General_General

Condition this operation on registers where all bits are 1.

Calling this method replaces prior all-ones conditions. Pass the list overload to require several registers simultaneously; conditions of different kinds are combined with logical AND.

参数:
  • cond -- Register name (str) or ID (int) to condition on.

  • conds -- List of register names or IDs for multi-condition.

返回:

Self, for method chaining.

conditioned_by_bit(*args, **kwargs)

Overloaded function.

  1. conditioned_by_bit(self: pysparq._core.Swap_General_General, cond: str, pos: typing.SupportsInt | typing.SupportsIndex) -> pysparq._core.Swap_General_General

Condition this operation on a specific bit position.

Calling this method replaces prior bit conditions. Pass the list-of-pairs overload to require several bits simultaneously; conditions of different kinds are combined with logical AND.

参数:
  • cond -- Register name (str) or ID (int).

  • pos -- Bit position to check (0-indexed).

  • conds -- List of (register, position) pairs.

返回:

Self, for method chaining.

  1. conditioned_by_bit(self: pysparq._core.Swap_General_General, conds: collections.abc.Sequence[tuple[str, typing.SupportsInt | typing.SupportsIndex]]) -> pysparq._core.Swap_General_General

Condition this operation on a specific bit position.

Calling this method replaces prior bit conditions. Pass the list-of-pairs overload to require several bits simultaneously; conditions of different kinds are combined with logical AND.

参数:
  • cond -- Register name (str) or ID (int).

  • pos -- Bit position to check (0-indexed).

  • conds -- List of (register, position) pairs.

返回:

Self, for method chaining.

  1. conditioned_by_bit(self: pysparq._core.Swap_General_General, cond: typing.SupportsInt | typing.SupportsIndex, pos: typing.SupportsInt | typing.SupportsIndex) -> pysparq._core.Swap_General_General

Condition this operation on a specific bit position.

Calling this method replaces prior bit conditions. Pass the list-of-pairs overload to require several bits simultaneously; conditions of different kinds are combined with logical AND.

参数:
  • cond -- Register name (str) or ID (int).

  • pos -- Bit position to check (0-indexed).

  • conds -- List of (register, position) pairs.

返回:

Self, for method chaining.

  1. conditioned_by_bit(self: pysparq._core.Swap_General_General, conds: collections.abc.Sequence[tuple[typing.SupportsInt | typing.SupportsIndex, typing.SupportsInt | typing.SupportsIndex]]) -> pysparq._core.Swap_General_General

Condition this operation on a specific bit position.

Calling this method replaces prior bit conditions. Pass the list-of-pairs overload to require several bits simultaneously; conditions of different kinds are combined with logical AND.

参数:
  • cond -- Register name (str) or ID (int).

  • pos -- Bit position to check (0-indexed).

  • conds -- List of (register, position) pairs.

返回:

Self, for method chaining.

conditioned_by_nonzeros(*args, **kwargs)

Overloaded function.

  1. conditioned_by_nonzeros(self: pysparq._core.Swap_General_General, cond: str) -> pysparq._core.Swap_General_General

Condition this operation on registers with nonzero values.

Calling this method replaces prior nonzero-register conditions. Pass the list overload to require several registers simultaneously; conditions of different kinds are combined with logical AND.

参数:
  • cond -- Register name (str) or ID (int) to condition on.

  • conds -- List of register names or IDs for multi-condition.

返回:

Self, for method chaining.

示例

op.conditioned_by_nonzeros('control_reg')(state)

  1. conditioned_by_nonzeros(self: pysparq._core.Swap_General_General, conds: collections.abc.Sequence[str]) -> pysparq._core.Swap_General_General

Condition this operation on registers with nonzero values.

Calling this method replaces prior nonzero-register conditions. Pass the list overload to require several registers simultaneously; conditions of different kinds are combined with logical AND.

参数:
  • cond -- Register name (str) or ID (int) to condition on.

  • conds -- List of register names or IDs for multi-condition.

返回:

Self, for method chaining.

示例

op.conditioned_by_nonzeros('control_reg')(state)

  1. conditioned_by_nonzeros(self: pysparq._core.Swap_General_General, cond: typing.SupportsInt | typing.SupportsIndex) -> pysparq._core.Swap_General_General

Condition this operation on registers with nonzero values.

Calling this method replaces prior nonzero-register conditions. Pass the list overload to require several registers simultaneously; conditions of different kinds are combined with logical AND.

参数:
  • cond -- Register name (str) or ID (int) to condition on.

  • conds -- List of register names or IDs for multi-condition.

返回:

Self, for method chaining.

示例

op.conditioned_by_nonzeros('control_reg')(state)

  1. conditioned_by_nonzeros(self: pysparq._core.Swap_General_General, conds: collections.abc.Sequence[typing.SupportsInt | typing.SupportsIndex]) -> pysparq._core.Swap_General_General

Condition this operation on registers with nonzero values.

Calling this method replaces prior nonzero-register conditions. Pass the list overload to require several registers simultaneously; conditions of different kinds are combined with logical AND.

参数:
  • cond -- Register name (str) or ID (int) to condition on.

  • conds -- List of register names or IDs for multi-condition.

返回:

Self, for method chaining.

示例

op.conditioned_by_nonzeros('control_reg')(state)

conditioned_by_value(*args, **kwargs)

Overloaded function.

  1. conditioned_by_value(self: pysparq._core.Swap_General_General, cond: str, pos: typing.SupportsInt | typing.SupportsIndex) -> pysparq._core.Swap_General_General

Condition this operation on registers holding a specific value.

Calling this method replaces prior value conditions. Pass the list-of-pairs overload to require several values simultaneously; conditions of different kinds are combined with logical AND.

参数:
  • cond -- Register name (str) or ID (int).

  • pos -- Value to match.

  • conds -- List of (register, value) pairs.

返回:

Self, for method chaining.

  1. conditioned_by_value(self: pysparq._core.Swap_General_General, conds: collections.abc.Sequence[tuple[str, typing.SupportsInt | typing.SupportsIndex]]) -> pysparq._core.Swap_General_General

Condition this operation on registers holding a specific value.

Calling this method replaces prior value conditions. Pass the list-of-pairs overload to require several values simultaneously; conditions of different kinds are combined with logical AND.

参数:
  • cond -- Register name (str) or ID (int).

  • pos -- Value to match.

  • conds -- List of (register, value) pairs.

返回:

Self, for method chaining.

  1. conditioned_by_value(self: pysparq._core.Swap_General_General, cond: typing.SupportsInt | typing.SupportsIndex, pos: typing.SupportsInt | typing.SupportsIndex) -> pysparq._core.Swap_General_General

Condition this operation on registers holding a specific value.

Calling this method replaces prior value conditions. Pass the list-of-pairs overload to require several values simultaneously; conditions of different kinds are combined with logical AND.

参数:
  • cond -- Register name (str) or ID (int).

  • pos -- Value to match.

  • conds -- List of (register, value) pairs.

返回:

Self, for method chaining.

  1. conditioned_by_value(self: pysparq._core.Swap_General_General, conds: collections.abc.Sequence[tuple[typing.SupportsInt | typing.SupportsIndex, typing.SupportsInt | typing.SupportsIndex]]) -> pysparq._core.Swap_General_General

Condition this operation on registers holding a specific value.

Calling this method replaces prior value conditions. Pass the list-of-pairs overload to require several values simultaneously; conditions of different kinds are combined with logical AND.

参数:
  • cond -- Register name (str) or ID (int).

  • pos -- Value to match.

  • conds -- List of (register, value) pairs.

返回:

Self, for method chaining.

操作: 交换两个寄存器的值。

ps.System.clear()

ps.System.add_register("a", ps.UnsignedInteger, 4)
ps.System.add_register("b", ps.UnsignedInteger, 4)

state = ps.SparseState()
ps.Init_Unsafe("a", 3)(state)
ps.Init_Unsafe("b", 5)(state)

ps.Swap_General_General("a", "b")(state)
# a = 5, b = 3

GetMid_UInt_UInt(中点计算)

class pysparq.GetMid_UInt_UInt
clear_control_all_ones(self: pysparq._core.GetMid_UInt_UInt) → None

Clear all control conditions of the specified type.

clear_control_by_bit(self: pysparq._core.GetMid_UInt_UInt) → None

Clear all control conditions of the specified type.

clear_control_by_value(self: pysparq._core.GetMid_UInt_UInt) → None

Clear all control conditions of the specified type.

clear_control_nonzeros(self: pysparq._core.GetMid_UInt_UInt) → None

Clear all control conditions of the specified type.

property condition_variable_all_ones
property condition_variable_by_bit
property condition_variable_by_value
property condition_variable_nonzeros
conditioned_by_all_ones(*args, **kwargs)

Overloaded function.

  1. conditioned_by_all_ones(self: pysparq._core.GetMid_UInt_UInt, cond: str) -> pysparq._core.GetMid_UInt_UInt

Condition this operation on registers where all bits are 1.

Calling this method replaces prior all-ones conditions. Pass the list overload to require several registers simultaneously; conditions of different kinds are combined with logical AND.

参数:
  • cond -- Register name (str) or ID (int) to condition on.

  • conds -- List of register names or IDs for multi-condition.

返回:

Self, for method chaining.

  1. conditioned_by_all_ones(self: pysparq._core.GetMid_UInt_UInt, conds: collections.abc.Sequence[str]) -> pysparq._core.GetMid_UInt_UInt

Condition this operation on registers where all bits are 1.

Calling this method replaces prior all-ones conditions. Pass the list overload to require several registers simultaneously; conditions of different kinds are combined with logical AND.

参数:
  • cond -- Register name (str) or ID (int) to condition on.

  • conds -- List of register names or IDs for multi-condition.

返回:

Self, for method chaining.

  1. conditioned_by_all_ones(self: pysparq._core.GetMid_UInt_UInt, cond: typing.SupportsInt | typing.SupportsIndex) -> pysparq._core.GetMid_UInt_UInt

Condition this operation on registers where all bits are 1.

Calling this method replaces prior all-ones conditions. Pass the list overload to require several registers simultaneously; conditions of different kinds are combined with logical AND.

参数:
  • cond -- Register name (str) or ID (int) to condition on.

  • conds -- List of register names or IDs for multi-condition.

返回:

Self, for method chaining.

  1. conditioned_by_all_ones(self: pysparq._core.GetMid_UInt_UInt, conds: collections.abc.Sequence[typing.SupportsInt | typing.SupportsIndex]) -> pysparq._core.GetMid_UInt_UInt

Condition this operation on registers where all bits are 1.

Calling this method replaces prior all-ones conditions. Pass the list overload to require several registers simultaneously; conditions of different kinds are combined with logical AND.

参数:
  • cond -- Register name (str) or ID (int) to condition on.

  • conds -- List of register names or IDs for multi-condition.

返回:

Self, for method chaining.

conditioned_by_bit(*args, **kwargs)

Overloaded function.

  1. conditioned_by_bit(self: pysparq._core.GetMid_UInt_UInt, cond: str, pos: typing.SupportsInt | typing.SupportsIndex) -> pysparq._core.GetMid_UInt_UInt

Condition this operation on a specific bit position.

Calling this method replaces prior bit conditions. Pass the list-of-pairs overload to require several bits simultaneously; conditions of different kinds are combined with logical AND.

参数:
  • cond -- Register name (str) or ID (int).

  • pos -- Bit position to check (0-indexed).

  • conds -- List of (register, position) pairs.

返回:

Self, for method chaining.

  1. conditioned_by_bit(self: pysparq._core.GetMid_UInt_UInt, conds: collections.abc.Sequence[tuple[str, typing.SupportsInt | typing.SupportsIndex]]) -> pysparq._core.GetMid_UInt_UInt

Condition this operation on a specific bit position.

Calling this method replaces prior bit conditions. Pass the list-of-pairs overload to require several bits simultaneously; conditions of different kinds are combined with logical AND.

参数:
  • cond -- Register name (str) or ID (int).

  • pos -- Bit position to check (0-indexed).

  • conds -- List of (register, position) pairs.

返回:

Self, for method chaining.

  1. conditioned_by_bit(self: pysparq._core.GetMid_UInt_UInt, cond: typing.SupportsInt | typing.SupportsIndex, pos: typing.SupportsInt | typing.SupportsIndex) -> pysparq._core.GetMid_UInt_UInt

Condition this operation on a specific bit position.

Calling this method replaces prior bit conditions. Pass the list-of-pairs overload to require several bits simultaneously; conditions of different kinds are combined with logical AND.

参数:
  • cond -- Register name (str) or ID (int).

  • pos -- Bit position to check (0-indexed).

  • conds -- List of (register, position) pairs.

返回:

Self, for method chaining.

  1. conditioned_by_bit(self: pysparq._core.GetMid_UInt_UInt, conds: collections.abc.Sequence[tuple[typing.SupportsInt | typing.SupportsIndex, typing.SupportsInt | typing.SupportsIndex]]) -> pysparq._core.GetMid_UInt_UInt

Condition this operation on a specific bit position.

Calling this method replaces prior bit conditions. Pass the list-of-pairs overload to require several bits simultaneously; conditions of different kinds are combined with logical AND.

参数:
  • cond -- Register name (str) or ID (int).

  • pos -- Bit position to check (0-indexed).

  • conds -- List of (register, position) pairs.

返回:

Self, for method chaining.

conditioned_by_nonzeros(*args, **kwargs)

Overloaded function.

  1. conditioned_by_nonzeros(self: pysparq._core.GetMid_UInt_UInt, cond: str) -> pysparq._core.GetMid_UInt_UInt

Condition this operation on registers with nonzero values.

Calling this method replaces prior nonzero-register conditions. Pass the list overload to require several registers simultaneously; conditions of different kinds are combined with logical AND.

参数:
  • cond -- Register name (str) or ID (int) to condition on.

  • conds -- List of register names or IDs for multi-condition.

返回:

Self, for method chaining.

示例

op.conditioned_by_nonzeros('control_reg')(state)

  1. conditioned_by_nonzeros(self: pysparq._core.GetMid_UInt_UInt, conds: collections.abc.Sequence[str]) -> pysparq._core.GetMid_UInt_UInt

Condition this operation on registers with nonzero values.

Calling this method replaces prior nonzero-register conditions. Pass the list overload to require several registers simultaneously; conditions of different kinds are combined with logical AND.

参数:
  • cond -- Register name (str) or ID (int) to condition on.

  • conds -- List of register names or IDs for multi-condition.

返回:

Self, for method chaining.

示例

op.conditioned_by_nonzeros('control_reg')(state)

  1. conditioned_by_nonzeros(self: pysparq._core.GetMid_UInt_UInt, cond: typing.SupportsInt | typing.SupportsIndex) -> pysparq._core.GetMid_UInt_UInt

Condition this operation on registers with nonzero values.

Calling this method replaces prior nonzero-register conditions. Pass the list overload to require several registers simultaneously; conditions of different kinds are combined with logical AND.

参数:
  • cond -- Register name (str) or ID (int) to condition on.

  • conds -- List of register names or IDs for multi-condition.

返回:

Self, for method chaining.

示例

op.conditioned_by_nonzeros('control_reg')(state)

  1. conditioned_by_nonzeros(self: pysparq._core.GetMid_UInt_UInt, conds: collections.abc.Sequence[typing.SupportsInt | typing.SupportsIndex]) -> pysparq._core.GetMid_UInt_UInt

Condition this operation on registers with nonzero values.

Calling this method replaces prior nonzero-register conditions. Pass the list overload to require several registers simultaneously; conditions of different kinds are combined with logical AND.

参数:
  • cond -- Register name (str) or ID (int) to condition on.

  • conds -- List of register names or IDs for multi-condition.

返回:

Self, for method chaining.

示例

op.conditioned_by_nonzeros('control_reg')(state)

conditioned_by_value(*args, **kwargs)

Overloaded function.

  1. conditioned_by_value(self: pysparq._core.GetMid_UInt_UInt, cond: str, pos: typing.SupportsInt | typing.SupportsIndex) -> pysparq._core.GetMid_UInt_UInt

Condition this operation on registers holding a specific value.

Calling this method replaces prior value conditions. Pass the list-of-pairs overload to require several values simultaneously; conditions of different kinds are combined with logical AND.

参数:
  • cond -- Register name (str) or ID (int).

  • pos -- Value to match.

  • conds -- List of (register, value) pairs.

返回:

Self, for method chaining.

  1. conditioned_by_value(self: pysparq._core.GetMid_UInt_UInt, conds: collections.abc.Sequence[tuple[str, typing.SupportsInt | typing.SupportsIndex]]) -> pysparq._core.GetMid_UInt_UInt

Condition this operation on registers holding a specific value.

Calling this method replaces prior value conditions. Pass the list-of-pairs overload to require several values simultaneously; conditions of different kinds are combined with logical AND.

参数:
  • cond -- Register name (str) or ID (int).

  • pos -- Value to match.

  • conds -- List of (register, value) pairs.

返回:

Self, for method chaining.

  1. conditioned_by_value(self: pysparq._core.GetMid_UInt_UInt, cond: typing.SupportsInt | typing.SupportsIndex, pos: typing.SupportsInt | typing.SupportsIndex) -> pysparq._core.GetMid_UInt_UInt

Condition this operation on registers holding a specific value.

Calling this method replaces prior value conditions. Pass the list-of-pairs overload to require several values simultaneously; conditions of different kinds are combined with logical AND.

参数:
  • cond -- Register name (str) or ID (int).

  • pos -- Value to match.

  • conds -- List of (register, value) pairs.

返回:

Self, for method chaining.

  1. conditioned_by_value(self: pysparq._core.GetMid_UInt_UInt, conds: collections.abc.Sequence[tuple[typing.SupportsInt | typing.SupportsIndex, typing.SupportsInt | typing.SupportsIndex]]) -> pysparq._core.GetMid_UInt_UInt

Condition this operation on registers holding a specific value.

Calling this method replaces prior value conditions. Pass the list-of-pairs overload to require several values simultaneously; conditions of different kinds are combined with logical AND.

参数:
  • cond -- Register name (str) or ID (int).

  • pos -- Value to match.

  • conds -- List of (register, value) pairs.

返回:

Self, for method chaining.

操作: mid ^= (left + right) // 2

用途: 二分搜索算法。

ps.System.clear()

ps.System.add_register("left", ps.UnsignedInteger, 4)
ps.System.add_register("right", ps.UnsignedInteger, 4)
ps.System.add_register("mid", ps.UnsignedInteger, 4)

state = ps.SparseState()
ps.Init_Unsafe("left", 2)(state)
ps.Init_Unsafe("right", 8)(state)

ps.GetMid_UInt_UInt("left", "right", "mid")(state)
# mid = (2 + 8) // 2 = 5

Additional Arithmetic Operators

上述算子之外的扩展整数运算:带符号整数运算、位逻辑、除法与开方、溢出感知加法以及选择算子。它们均作用于整个寄存器(SignedInteger 与 UnsignedInteger 的存储语义见 寄存器类型)。

class pysparq.Sub_UInt_UInt

Subtract two unsigned integer registers.

Computes: res ^= lhs - rhs, evaluated on the unsigned 64-bit wraparound domain, then truncated to mod 2^res_width before being XORed into res.

参数:
  • lhs -- Name/ID of the minuend register.

  • rhs -- Name/ID of the subtrahend register.

  • res -- Name/ID of the output register (result is XORed in).

示例

Sub_UInt_UInt("a", "b", "result")(state) # result ^= a - b

clear_control_all_ones(self: pysparq._core.Sub_UInt_UInt) → None

Clear all control conditions of the specified type.

clear_control_by_bit(self: pysparq._core.Sub_UInt_UInt) → None

Clear all control conditions of the specified type.

clear_control_by_value(self: pysparq._core.Sub_UInt_UInt) → None

Clear all control conditions of the specified type.

clear_control_nonzeros(self: pysparq._core.Sub_UInt_UInt) → None

Clear all control conditions of the specified type.

property condition_variable_all_ones
property condition_variable_by_bit
property condition_variable_by_value
property condition_variable_nonzeros
conditioned_by_all_ones(*args, **kwargs)

Overloaded function.

  1. conditioned_by_all_ones(self: pysparq._core.Sub_UInt_UInt, cond: str) -> pysparq._core.Sub_UInt_UInt

Condition this operation on registers where all bits are 1.

Calling this method replaces prior all-ones conditions. Pass the list overload to require several registers simultaneously; conditions of different kinds are combined with logical AND.

参数:
  • cond -- Register name (str) or ID (int) to condition on.

  • conds -- List of register names or IDs for multi-condition.

返回:

Self, for method chaining.

  1. conditioned_by_all_ones(self: pysparq._core.Sub_UInt_UInt, conds: collections.abc.Sequence[str]) -> pysparq._core.Sub_UInt_UInt

Condition this operation on registers where all bits are 1.

Calling this method replaces prior all-ones conditions. Pass the list overload to require several registers simultaneously; conditions of different kinds are combined with logical AND.

参数:
  • cond -- Register name (str) or ID (int) to condition on.

  • conds -- List of register names or IDs for multi-condition.

返回:

Self, for method chaining.

  1. conditioned_by_all_ones(self: pysparq._core.Sub_UInt_UInt, cond: typing.SupportsInt | typing.SupportsIndex) -> pysparq._core.Sub_UInt_UInt

Condition this operation on registers where all bits are 1.

Calling this method replaces prior all-ones conditions. Pass the list overload to require several registers simultaneously; conditions of different kinds are combined with logical AND.

参数:
  • cond -- Register name (str) or ID (int) to condition on.

  • conds -- List of register names or IDs for multi-condition.

返回:

Self, for method chaining.

  1. conditioned_by_all_ones(self: pysparq._core.Sub_UInt_UInt, conds: collections.abc.Sequence[typing.SupportsInt | typing.SupportsIndex]) -> pysparq._core.Sub_UInt_UInt

Condition this operation on registers where all bits are 1.

Calling this method replaces prior all-ones conditions. Pass the list overload to require several registers simultaneously; conditions of different kinds are combined with logical AND.

参数:
  • cond -- Register name (str) or ID (int) to condition on.

  • conds -- List of register names or IDs for multi-condition.

返回:

Self, for method chaining.

conditioned_by_bit(*args, **kwargs)

Overloaded function.

  1. conditioned_by_bit(self: pysparq._core.Sub_UInt_UInt, cond: str, pos: typing.SupportsInt | typing.SupportsIndex) -> pysparq._core.Sub_UInt_UInt

Condition this operation on a specific bit position.

Calling this method replaces prior bit conditions. Pass the list-of-pairs overload to require several bits simultaneously; conditions of different kinds are combined with logical AND.

参数:
  • cond -- Register name (str) or ID (int).

  • pos -- Bit position to check (0-indexed).

  • conds -- List of (register, position) pairs.

返回:

Self, for method chaining.

  1. conditioned_by_bit(self: pysparq._core.Sub_UInt_UInt, conds: collections.abc.Sequence[tuple[str, typing.SupportsInt | typing.SupportsIndex]]) -> pysparq._core.Sub_UInt_UInt

Condition this operation on a specific bit position.

Calling this method replaces prior bit conditions. Pass the list-of-pairs overload to require several bits simultaneously; conditions of different kinds are combined with logical AND.

参数:
  • cond -- Register name (str) or ID (int).

  • pos -- Bit position to check (0-indexed).

  • conds -- List of (register, position) pairs.

返回:

Self, for method chaining.

  1. conditioned_by_bit(self: pysparq._core.Sub_UInt_UInt, cond: typing.SupportsInt | typing.SupportsIndex, pos: typing.SupportsInt | typing.SupportsIndex) -> pysparq._core.Sub_UInt_UInt

Condition this operation on a specific bit position.

Calling this method replaces prior bit conditions. Pass the list-of-pairs overload to require several bits simultaneously; conditions of different kinds are combined with logical AND.

参数:
  • cond -- Register name (str) or ID (int).

  • pos -- Bit position to check (0-indexed).

  • conds -- List of (register, position) pairs.

返回:

Self, for method chaining.

  1. conditioned_by_bit(self: pysparq._core.Sub_UInt_UInt, conds: collections.abc.Sequence[tuple[typing.SupportsInt | typing.SupportsIndex, typing.SupportsInt | typing.SupportsIndex]]) -> pysparq._core.Sub_UInt_UInt

Condition this operation on a specific bit position.

Calling this method replaces prior bit conditions. Pass the list-of-pairs overload to require several bits simultaneously; conditions of different kinds are combined with logical AND.

参数:
  • cond -- Register name (str) or ID (int).

  • pos -- Bit position to check (0-indexed).

  • conds -- List of (register, position) pairs.

返回:

Self, for method chaining.

conditioned_by_nonzeros(*args, **kwargs)

Overloaded function.

  1. conditioned_by_nonzeros(self: pysparq._core.Sub_UInt_UInt, cond: str) -> pysparq._core.Sub_UInt_UInt

Condition this operation on registers with nonzero values.

Calling this method replaces prior nonzero-register conditions. Pass the list overload to require several registers simultaneously; conditions of different kinds are combined with logical AND.

参数:
  • cond -- Register name (str) or ID (int) to condition on.

  • conds -- List of register names or IDs for multi-condition.

返回:

Self, for method chaining.

示例

op.conditioned_by_nonzeros('control_reg')(state)

  1. conditioned_by_nonzeros(self: pysparq._core.Sub_UInt_UInt, conds: collections.abc.Sequence[str]) -> pysparq._core.Sub_UInt_UInt

Condition this operation on registers with nonzero values.

Calling this method replaces prior nonzero-register conditions. Pass the list overload to require several registers simultaneously; conditions of different kinds are combined with logical AND.

参数:
  • cond -- Register name (str) or ID (int) to condition on.

  • conds -- List of register names or IDs for multi-condition.

返回:

Self, for method chaining.

示例

op.conditioned_by_nonzeros('control_reg')(state)

  1. conditioned_by_nonzeros(self: pysparq._core.Sub_UInt_UInt, cond: typing.SupportsInt | typing.SupportsIndex) -> pysparq._core.Sub_UInt_UInt

Condition this operation on registers with nonzero values.

Calling this method replaces prior nonzero-register conditions. Pass the list overload to require several registers simultaneously; conditions of different kinds are combined with logical AND.

参数:
  • cond -- Register name (str) or ID (int) to condition on.

  • conds -- List of register names or IDs for multi-condition.

返回:

Self, for method chaining.

示例

op.conditioned_by_nonzeros('control_reg')(state)

  1. conditioned_by_nonzeros(self: pysparq._core.Sub_UInt_UInt, conds: collections.abc.Sequence[typing.SupportsInt | typing.SupportsIndex]) -> pysparq._core.Sub_UInt_UInt

Condition this operation on registers with nonzero values.

Calling this method replaces prior nonzero-register conditions. Pass the list overload to require several registers simultaneously; conditions of different kinds are combined with logical AND.

参数:
  • cond -- Register name (str) or ID (int) to condition on.

  • conds -- List of register names or IDs for multi-condition.

返回:

Self, for method chaining.

示例

op.conditioned_by_nonzeros('control_reg')(state)

conditioned_by_value(*args, **kwargs)

Overloaded function.

  1. conditioned_by_value(self: pysparq._core.Sub_UInt_UInt, cond: str, pos: typing.SupportsInt | typing.SupportsIndex) -> pysparq._core.Sub_UInt_UInt

Condition this operation on registers holding a specific value.

Calling this method replaces prior value conditions. Pass the list-of-pairs overload to require several values simultaneously; conditions of different kinds are combined with logical AND.

参数:
  • cond -- Register name (str) or ID (int).

  • pos -- Value to match.

  • conds -- List of (register, value) pairs.

返回:

Self, for method chaining.

  1. conditioned_by_value(self: pysparq._core.Sub_UInt_UInt, conds: collections.abc.Sequence[tuple[str, typing.SupportsInt | typing.SupportsIndex]]) -> pysparq._core.Sub_UInt_UInt

Condition this operation on registers holding a specific value.

Calling this method replaces prior value conditions. Pass the list-of-pairs overload to require several values simultaneously; conditions of different kinds are combined with logical AND.

参数:
  • cond -- Register name (str) or ID (int).

  • pos -- Value to match.

  • conds -- List of (register, value) pairs.

返回:

Self, for method chaining.

  1. conditioned_by_value(self: pysparq._core.Sub_UInt_UInt, cond: typing.SupportsInt | typing.SupportsIndex, pos: typing.SupportsInt | typing.SupportsIndex) -> pysparq._core.Sub_UInt_UInt

Condition this operation on registers holding a specific value.

Calling this method replaces prior value conditions. Pass the list-of-pairs overload to require several values simultaneously; conditions of different kinds are combined with logical AND.

参数:
  • cond -- Register name (str) or ID (int).

  • pos -- Value to match.

  • conds -- List of (register, value) pairs.

返回:

Self, for method chaining.

  1. conditioned_by_value(self: pysparq._core.Sub_UInt_UInt, conds: collections.abc.Sequence[tuple[typing.SupportsInt | typing.SupportsIndex, typing.SupportsInt | typing.SupportsIndex]]) -> pysparq._core.Sub_UInt_UInt

Condition this operation on registers holding a specific value.

Calling this method replaces prior value conditions. Pass the list-of-pairs overload to require several values simultaneously; conditions of different kinds are combined with logical AND.

参数:
  • cond -- Register name (str) or ID (int).

  • pos -- Value to match.

  • conds -- List of (register, value) pairs.

返回:

Self, for method chaining.

class pysparq.Add_AnyInt_AnyInt_InPlace
clear_control_all_ones(self: pysparq._core.Add_AnyInt_AnyInt_InPlace) → None

Clear all control conditions of the specified type.

clear_control_by_bit(self: pysparq._core.Add_AnyInt_AnyInt_InPlace) → None

Clear all control conditions of the specified type.

clear_control_by_value(self: pysparq._core.Add_AnyInt_AnyInt_InPlace) → None

Clear all control conditions of the specified type.

clear_control_nonzeros(self: pysparq._core.Add_AnyInt_AnyInt_InPlace) → None

Clear all control conditions of the specified type.

property condition_variable_all_ones
property condition_variable_by_bit
property condition_variable_by_value
property condition_variable_nonzeros
conditioned_by_all_ones(*args, **kwargs)

Overloaded function.

  1. conditioned_by_all_ones(self: pysparq._core.Add_AnyInt_AnyInt_InPlace, cond: str) -> pysparq._core.Add_AnyInt_AnyInt_InPlace

Condition this operation on registers where all bits are 1.

Calling this method replaces prior all-ones conditions. Pass the list overload to require several registers simultaneously; conditions of different kinds are combined with logical AND.

参数:
  • cond -- Register name (str) or ID (int) to condition on.

  • conds -- List of register names or IDs for multi-condition.

返回:

Self, for method chaining.

  1. conditioned_by_all_ones(self: pysparq._core.Add_AnyInt_AnyInt_InPlace, conds: collections.abc.Sequence[str]) -> pysparq._core.Add_AnyInt_AnyInt_InPlace

Condition this operation on registers where all bits are 1.

Calling this method replaces prior all-ones conditions. Pass the list overload to require several registers simultaneously; conditions of different kinds are combined with logical AND.

参数:
  • cond -- Register name (str) or ID (int) to condition on.

  • conds -- List of register names or IDs for multi-condition.

返回:

Self, for method chaining.

  1. conditioned_by_all_ones(self: pysparq._core.Add_AnyInt_AnyInt_InPlace, cond: typing.SupportsInt | typing.SupportsIndex) -> pysparq._core.Add_AnyInt_AnyInt_InPlace

Condition this operation on registers where all bits are 1.

Calling this method replaces prior all-ones conditions. Pass the list overload to require several registers simultaneously; conditions of different kinds are combined with logical AND.

参数:
  • cond -- Register name (str) or ID (int) to condition on.

  • conds -- List of register names or IDs for multi-condition.

返回:

Self, for method chaining.

  1. conditioned_by_all_ones(self: pysparq._core.Add_AnyInt_AnyInt_InPlace, conds: collections.abc.Sequence[typing.SupportsInt | typing.SupportsIndex]) -> pysparq._core.Add_AnyInt_AnyInt_InPlace

Condition this operation on registers where all bits are 1.

Calling this method replaces prior all-ones conditions. Pass the list overload to require several registers simultaneously; conditions of different kinds are combined with logical AND.

参数:
  • cond -- Register name (str) or ID (int) to condition on.

  • conds -- List of register names or IDs for multi-condition.

返回:

Self, for method chaining.

conditioned_by_bit(*args, **kwargs)

Overloaded function.

  1. conditioned_by_bit(self: pysparq._core.Add_AnyInt_AnyInt_InPlace, cond: str, pos: typing.SupportsInt | typing.SupportsIndex) -> pysparq._core.Add_AnyInt_AnyInt_InPlace

Condition this operation on a specific bit position.

Calling this method replaces prior bit conditions. Pass the list-of-pairs overload to require several bits simultaneously; conditions of different kinds are combined with logical AND.

参数:
  • cond -- Register name (str) or ID (int).

  • pos -- Bit position to check (0-indexed).

  • conds -- List of (register, position) pairs.

返回:

Self, for method chaining.

  1. conditioned_by_bit(self: pysparq._core.Add_AnyInt_AnyInt_InPlace, conds: collections.abc.Sequence[tuple[str, typing.SupportsInt | typing.SupportsIndex]]) -> pysparq._core.Add_AnyInt_AnyInt_InPlace

Condition this operation on a specific bit position.

Calling this method replaces prior bit conditions. Pass the list-of-pairs overload to require several bits simultaneously; conditions of different kinds are combined with logical AND.

参数:
  • cond -- Register name (str) or ID (int).

  • pos -- Bit position to check (0-indexed).

  • conds -- List of (register, position) pairs.

返回:

Self, for method chaining.

  1. conditioned_by_bit(self: pysparq._core.Add_AnyInt_AnyInt_InPlace, cond: typing.SupportsInt | typing.SupportsIndex, pos: typing.SupportsInt | typing.SupportsIndex) -> pysparq._core.Add_AnyInt_AnyInt_InPlace

Condition this operation on a specific bit position.

Calling this method replaces prior bit conditions. Pass the list-of-pairs overload to require several bits simultaneously; conditions of different kinds are combined with logical AND.

参数:
  • cond -- Register name (str) or ID (int).

  • pos -- Bit position to check (0-indexed).

  • conds -- List of (register, position) pairs.

返回:

Self, for method chaining.

  1. conditioned_by_bit(self: pysparq._core.Add_AnyInt_AnyInt_InPlace, conds: collections.abc.Sequence[tuple[typing.SupportsInt | typing.SupportsIndex, typing.SupportsInt | typing.SupportsIndex]]) -> pysparq._core.Add_AnyInt_AnyInt_InPlace

Condition this operation on a specific bit position.

Calling this method replaces prior bit conditions. Pass the list-of-pairs overload to require several bits simultaneously; conditions of different kinds are combined with logical AND.

参数:
  • cond -- Register name (str) or ID (int).

  • pos -- Bit position to check (0-indexed).

  • conds -- List of (register, position) pairs.

返回:

Self, for method chaining.

conditioned_by_nonzeros(*args, **kwargs)

Overloaded function.

  1. conditioned_by_nonzeros(self: pysparq._core.Add_AnyInt_AnyInt_InPlace, cond: str) -> pysparq._core.Add_AnyInt_AnyInt_InPlace

Condition this operation on registers with nonzero values.

Calling this method replaces prior nonzero-register conditions. Pass the list overload to require several registers simultaneously; conditions of different kinds are combined with logical AND.

参数:
  • cond -- Register name (str) or ID (int) to condition on.

  • conds -- List of register names or IDs for multi-condition.

返回:

Self, for method chaining.

示例

op.conditioned_by_nonzeros('control_reg')(state)

  1. conditioned_by_nonzeros(self: pysparq._core.Add_AnyInt_AnyInt_InPlace, conds: collections.abc.Sequence[str]) -> pysparq._core.Add_AnyInt_AnyInt_InPlace

Condition this operation on registers with nonzero values.

Calling this method replaces prior nonzero-register conditions. Pass the list overload to require several registers simultaneously; conditions of different kinds are combined with logical AND.

参数:
  • cond -- Register name (str) or ID (int) to condition on.

  • conds -- List of register names or IDs for multi-condition.

返回:

Self, for method chaining.

示例

op.conditioned_by_nonzeros('control_reg')(state)

  1. conditioned_by_nonzeros(self: pysparq._core.Add_AnyInt_AnyInt_InPlace, cond: typing.SupportsInt | typing.SupportsIndex) -> pysparq._core.Add_AnyInt_AnyInt_InPlace

Condition this operation on registers with nonzero values.

Calling this method replaces prior nonzero-register conditions. Pass the list overload to require several registers simultaneously; conditions of different kinds are combined with logical AND.

参数:
  • cond -- Register name (str) or ID (int) to condition on.

  • conds -- List of register names or IDs for multi-condition.

返回:

Self, for method chaining.

示例

op.conditioned_by_nonzeros('control_reg')(state)

  1. conditioned_by_nonzeros(self: pysparq._core.Add_AnyInt_AnyInt_InPlace, conds: collections.abc.Sequence[typing.SupportsInt | typing.SupportsIndex]) -> pysparq._core.Add_AnyInt_AnyInt_InPlace

Condition this operation on registers with nonzero values.

Calling this method replaces prior nonzero-register conditions. Pass the list overload to require several registers simultaneously; conditions of different kinds are combined with logical AND.

参数:
  • cond -- Register name (str) or ID (int) to condition on.

  • conds -- List of register names or IDs for multi-condition.

返回:

Self, for method chaining.

示例

op.conditioned_by_nonzeros('control_reg')(state)

conditioned_by_value(*args, **kwargs)

Overloaded function.

  1. conditioned_by_value(self: pysparq._core.Add_AnyInt_AnyInt_InPlace, cond: str, pos: typing.SupportsInt | typing.SupportsIndex) -> pysparq._core.Add_AnyInt_AnyInt_InPlace

Condition this operation on registers holding a specific value.

Calling this method replaces prior value conditions. Pass the list-of-pairs overload to require several values simultaneously; conditions of different kinds are combined with logical AND.

参数:
  • cond -- Register name (str) or ID (int).

  • pos -- Value to match.

  • conds -- List of (register, value) pairs.

返回:

Self, for method chaining.

  1. conditioned_by_value(self: pysparq._core.Add_AnyInt_AnyInt_InPlace, conds: collections.abc.Sequence[tuple[str, typing.SupportsInt | typing.SupportsIndex]]) -> pysparq._core.Add_AnyInt_AnyInt_InPlace

Condition this operation on registers holding a specific value.

Calling this method replaces prior value conditions. Pass the list-of-pairs overload to require several values simultaneously; conditions of different kinds are combined with logical AND.

参数:
  • cond -- Register name (str) or ID (int).

  • pos -- Value to match.

  • conds -- List of (register, value) pairs.

返回:

Self, for method chaining.

  1. conditioned_by_value(self: pysparq._core.Add_AnyInt_AnyInt_InPlace, cond: typing.SupportsInt | typing.SupportsIndex, pos: typing.SupportsInt | typing.SupportsIndex) -> pysparq._core.Add_AnyInt_AnyInt_InPlace

Condition this operation on registers holding a specific value.

Calling this method replaces prior value conditions. Pass the list-of-pairs overload to require several values simultaneously; conditions of different kinds are combined with logical AND.

参数:
  • cond -- Register name (str) or ID (int).

  • pos -- Value to match.

  • conds -- List of (register, value) pairs.

返回:

Self, for method chaining.

  1. conditioned_by_value(self: pysparq._core.Add_AnyInt_AnyInt_InPlace, conds: collections.abc.Sequence[tuple[typing.SupportsInt | typing.SupportsIndex, typing.SupportsInt | typing.SupportsIndex]]) -> pysparq._core.Add_AnyInt_AnyInt_InPlace

Condition this operation on registers holding a specific value.

Calling this method replaces prior value conditions. Pass the list-of-pairs overload to require several values simultaneously; conditions of different kinds are combined with logical AND.

参数:
  • cond -- Register name (str) or ID (int).

  • pos -- Value to match.

  • conds -- List of (register, value) pairs.

返回:

Self, for method chaining.

dag(self: pysparq._core.Add_AnyInt_AnyInt_InPlace, state: pysparq._core.SparseState) → None

Apply the adjoint (inverse) of this operation.

参数:

state -- The quantum state to operate on.

Note: Only available for self-adjoint operators.

class pysparq.Neg_UInt

Negate an unsigned integer register.

Computes: res ^= 0 - reg (two's complement negation on the unsigned 64-bit wraparound domain), truncated to mod 2^res_width before being XORed into res.

参数:
  • reg -- Name/ID of the input register.

  • res -- Name/ID of the output register (result is XORed in).

示例

Neg_UInt("a", "result")(state) # result ^= -a

clear_control_all_ones(self: pysparq._core.Neg_UInt) → None

Clear all control conditions of the specified type.

clear_control_by_bit(self: pysparq._core.Neg_UInt) → None

Clear all control conditions of the specified type.

clear_control_by_value(self: pysparq._core.Neg_UInt) → None

Clear all control conditions of the specified type.

clear_control_nonzeros(self: pysparq._core.Neg_UInt) → None

Clear all control conditions of the specified type.

property condition_variable_all_ones
property condition_variable_by_bit
property condition_variable_by_value
property condition_variable_nonzeros
conditioned_by_all_ones(*args, **kwargs)

Overloaded function.

  1. conditioned_by_all_ones(self: pysparq._core.Neg_UInt, cond: str) -> pysparq._core.Neg_UInt

Condition this operation on registers where all bits are 1.

Calling this method replaces prior all-ones conditions. Pass the list overload to require several registers simultaneously; conditions of different kinds are combined with logical AND.

参数:
  • cond -- Register name (str) or ID (int) to condition on.

  • conds -- List of register names or IDs for multi-condition.

返回:

Self, for method chaining.

  1. conditioned_by_all_ones(self: pysparq._core.Neg_UInt, conds: collections.abc.Sequence[str]) -> pysparq._core.Neg_UInt

Condition this operation on registers where all bits are 1.

Calling this method replaces prior all-ones conditions. Pass the list overload to require several registers simultaneously; conditions of different kinds are combined with logical AND.

参数:
  • cond -- Register name (str) or ID (int) to condition on.

  • conds -- List of register names or IDs for multi-condition.

返回:

Self, for method chaining.

  1. conditioned_by_all_ones(self: pysparq._core.Neg_UInt, cond: typing.SupportsInt | typing.SupportsIndex) -> pysparq._core.Neg_UInt

Condition this operation on registers where all bits are 1.

Calling this method replaces prior all-ones conditions. Pass the list overload to require several registers simultaneously; conditions of different kinds are combined with logical AND.

参数:
  • cond -- Register name (str) or ID (int) to condition on.

  • conds -- List of register names or IDs for multi-condition.

返回:

Self, for method chaining.

  1. conditioned_by_all_ones(self: pysparq._core.Neg_UInt, conds: collections.abc.Sequence[typing.SupportsInt | typing.SupportsIndex]) -> pysparq._core.Neg_UInt

Condition this operation on registers where all bits are 1.

Calling this method replaces prior all-ones conditions. Pass the list overload to require several registers simultaneously; conditions of different kinds are combined with logical AND.

参数:
  • cond -- Register name (str) or ID (int) to condition on.

  • conds -- List of register names or IDs for multi-condition.

返回:

Self, for method chaining.

conditioned_by_bit(*args, **kwargs)

Overloaded function.

  1. conditioned_by_bit(self: pysparq._core.Neg_UInt, cond: str, pos: typing.SupportsInt | typing.SupportsIndex) -> pysparq._core.Neg_UInt

Condition this operation on a specific bit position.

Calling this method replaces prior bit conditions. Pass the list-of-pairs overload to require several bits simultaneously; conditions of different kinds are combined with logical AND.

参数:
  • cond -- Register name (str) or ID (int).

  • pos -- Bit position to check (0-indexed).

  • conds -- List of (register, position) pairs.

返回:

Self, for method chaining.

  1. conditioned_by_bit(self: pysparq._core.Neg_UInt, conds: collections.abc.Sequence[tuple[str, typing.SupportsInt | typing.SupportsIndex]]) -> pysparq._core.Neg_UInt

Condition this operation on a specific bit position.

Calling this method replaces prior bit conditions. Pass the list-of-pairs overload to require several bits simultaneously; conditions of different kinds are combined with logical AND.

参数:
  • cond -- Register name (str) or ID (int).

  • pos -- Bit position to check (0-indexed).

  • conds -- List of (register, position) pairs.

返回:

Self, for method chaining.

  1. conditioned_by_bit(self: pysparq._core.Neg_UInt, cond: typing.SupportsInt | typing.SupportsIndex, pos: typing.SupportsInt | typing.SupportsIndex) -> pysparq._core.Neg_UInt

Condition this operation on a specific bit position.

Calling this method replaces prior bit conditions. Pass the list-of-pairs overload to require several bits simultaneously; conditions of different kinds are combined with logical AND.

参数:
  • cond -- Register name (str) or ID (int).

  • pos -- Bit position to check (0-indexed).

  • conds -- List of (register, position) pairs.

返回:

Self, for method chaining.

  1. conditioned_by_bit(self: pysparq._core.Neg_UInt, conds: collections.abc.Sequence[tuple[typing.SupportsInt | typing.SupportsIndex, typing.SupportsInt | typing.SupportsIndex]]) -> pysparq._core.Neg_UInt

Condition this operation on a specific bit position.

Calling this method replaces prior bit conditions. Pass the list-of-pairs overload to require several bits simultaneously; conditions of different kinds are combined with logical AND.

参数:
  • cond -- Register name (str) or ID (int).

  • pos -- Bit position to check (0-indexed).

  • conds -- List of (register, position) pairs.

返回:

Self, for method chaining.

conditioned_by_nonzeros(*args, **kwargs)

Overloaded function.

  1. conditioned_by_nonzeros(self: pysparq._core.Neg_UInt, cond: str) -> pysparq._core.Neg_UInt

Condition this operation on registers with nonzero values.

Calling this method replaces prior nonzero-register conditions. Pass the list overload to require several registers simultaneously; conditions of different kinds are combined with logical AND.

参数:
  • cond -- Register name (str) or ID (int) to condition on.

  • conds -- List of register names or IDs for multi-condition.

返回:

Self, for method chaining.

示例

op.conditioned_by_nonzeros('control_reg')(state)

  1. conditioned_by_nonzeros(self: pysparq._core.Neg_UInt, conds: collections.abc.Sequence[str]) -> pysparq._core.Neg_UInt

Condition this operation on registers with nonzero values.

Calling this method replaces prior nonzero-register conditions. Pass the list overload to require several registers simultaneously; conditions of different kinds are combined with logical AND.

参数:
  • cond -- Register name (str) or ID (int) to condition on.

  • conds -- List of register names or IDs for multi-condition.

返回:

Self, for method chaining.

示例

op.conditioned_by_nonzeros('control_reg')(state)

  1. conditioned_by_nonzeros(self: pysparq._core.Neg_UInt, cond: typing.SupportsInt | typing.SupportsIndex) -> pysparq._core.Neg_UInt

Condition this operation on registers with nonzero values.

Calling this method replaces prior nonzero-register conditions. Pass the list overload to require several registers simultaneously; conditions of different kinds are combined with logical AND.

参数:
  • cond -- Register name (str) or ID (int) to condition on.

  • conds -- List of register names or IDs for multi-condition.

返回:

Self, for method chaining.

示例

op.conditioned_by_nonzeros('control_reg')(state)

  1. conditioned_by_nonzeros(self: pysparq._core.Neg_UInt, conds: collections.abc.Sequence[typing.SupportsInt | typing.SupportsIndex]) -> pysparq._core.Neg_UInt

Condition this operation on registers with nonzero values.

Calling this method replaces prior nonzero-register conditions. Pass the list overload to require several registers simultaneously; conditions of different kinds are combined with logical AND.

参数:
  • cond -- Register name (str) or ID (int) to condition on.

  • conds -- List of register names or IDs for multi-condition.

返回:

Self, for method chaining.

示例

op.conditioned_by_nonzeros('control_reg')(state)

conditioned_by_value(*args, **kwargs)

Overloaded function.

  1. conditioned_by_value(self: pysparq._core.Neg_UInt, cond: str, pos: typing.SupportsInt | typing.SupportsIndex) -> pysparq._core.Neg_UInt

Condition this operation on registers holding a specific value.

Calling this method replaces prior value conditions. Pass the list-of-pairs overload to require several values simultaneously; conditions of different kinds are combined with logical AND.

参数:
  • cond -- Register name (str) or ID (int).

  • pos -- Value to match.

  • conds -- List of (register, value) pairs.

返回:

Self, for method chaining.

  1. conditioned_by_value(self: pysparq._core.Neg_UInt, conds: collections.abc.Sequence[tuple[str, typing.SupportsInt | typing.SupportsIndex]]) -> pysparq._core.Neg_UInt

Condition this operation on registers holding a specific value.

Calling this method replaces prior value conditions. Pass the list-of-pairs overload to require several values simultaneously; conditions of different kinds are combined with logical AND.

参数:
  • cond -- Register name (str) or ID (int).

  • pos -- Value to match.

  • conds -- List of (register, value) pairs.

返回:

Self, for method chaining.

  1. conditioned_by_value(self: pysparq._core.Neg_UInt, cond: typing.SupportsInt | typing.SupportsIndex, pos: typing.SupportsInt | typing.SupportsIndex) -> pysparq._core.Neg_UInt

Condition this operation on registers holding a specific value.

Calling this method replaces prior value conditions. Pass the list-of-pairs overload to require several values simultaneously; conditions of different kinds are combined with logical AND.

参数:
  • cond -- Register name (str) or ID (int).

  • pos -- Value to match.

  • conds -- List of (register, value) pairs.

返回:

Self, for method chaining.

  1. conditioned_by_value(self: pysparq._core.Neg_UInt, conds: collections.abc.Sequence[tuple[typing.SupportsInt | typing.SupportsIndex, typing.SupportsInt | typing.SupportsIndex]]) -> pysparq._core.Neg_UInt

Condition this operation on registers holding a specific value.

Calling this method replaces prior value conditions. Pass the list-of-pairs overload to require several values simultaneously; conditions of different kinds are combined with logical AND.

参数:
  • cond -- Register name (str) or ID (int).

  • pos -- Value to match.

  • conds -- List of (register, value) pairs.

返回:

Self, for method chaining.

class pysparq.Abs_SInt

Absolute value of a signed integer register.

Computes: res ^= |reg|, where reg is sign-extended from its two's complement bit pattern, truncated to mod 2^res_width before being XORed into res (SInt in, UInt out).

参数:
  • reg -- Name/ID of the SignedInteger input register.

  • res -- Name/ID of the UnsignedInteger output register (result is XORed in).

示例

Abs_SInt("a", "result")(state) # result ^= |a|

clear_control_all_ones(self: pysparq._core.Abs_SInt) → None

Clear all control conditions of the specified type.

clear_control_by_bit(self: pysparq._core.Abs_SInt) → None

Clear all control conditions of the specified type.

clear_control_by_value(self: pysparq._core.Abs_SInt) → None

Clear all control conditions of the specified type.

clear_control_nonzeros(self: pysparq._core.Abs_SInt) → None

Clear all control conditions of the specified type.

property condition_variable_all_ones
property condition_variable_by_bit
property condition_variable_by_value
property condition_variable_nonzeros
conditioned_by_all_ones(*args, **kwargs)

Overloaded function.

  1. conditioned_by_all_ones(self: pysparq._core.Abs_SInt, cond: str) -> pysparq._core.Abs_SInt

Condition this operation on registers where all bits are 1.

Calling this method replaces prior all-ones conditions. Pass the list overload to require several registers simultaneously; conditions of different kinds are combined with logical AND.

参数:
  • cond -- Register name (str) or ID (int) to condition on.

  • conds -- List of register names or IDs for multi-condition.

返回:

Self, for method chaining.

  1. conditioned_by_all_ones(self: pysparq._core.Abs_SInt, conds: collections.abc.Sequence[str]) -> pysparq._core.Abs_SInt

Condition this operation on registers where all bits are 1.

Calling this method replaces prior all-ones conditions. Pass the list overload to require several registers simultaneously; conditions of different kinds are combined with logical AND.

参数:
  • cond -- Register name (str) or ID (int) to condition on.

  • conds -- List of register names or IDs for multi-condition.

返回:

Self, for method chaining.

  1. conditioned_by_all_ones(self: pysparq._core.Abs_SInt, cond: typing.SupportsInt | typing.SupportsIndex) -> pysparq._core.Abs_SInt

Condition this operation on registers where all bits are 1.

Calling this method replaces prior all-ones conditions. Pass the list overload to require several registers simultaneously; conditions of different kinds are combined with logical AND.

参数:
  • cond -- Register name (str) or ID (int) to condition on.

  • conds -- List of register names or IDs for multi-condition.

返回:

Self, for method chaining.

  1. conditioned_by_all_ones(self: pysparq._core.Abs_SInt, conds: collections.abc.Sequence[typing.SupportsInt | typing.SupportsIndex]) -> pysparq._core.Abs_SInt

Condition this operation on registers where all bits are 1.

Calling this method replaces prior all-ones conditions. Pass the list overload to require several registers simultaneously; conditions of different kinds are combined with logical AND.

参数:
  • cond -- Register name (str) or ID (int) to condition on.

  • conds -- List of register names or IDs for multi-condition.

返回:

Self, for method chaining.

conditioned_by_bit(*args, **kwargs)

Overloaded function.

  1. conditioned_by_bit(self: pysparq._core.Abs_SInt, cond: str, pos: typing.SupportsInt | typing.SupportsIndex) -> pysparq._core.Abs_SInt

Condition this operation on a specific bit position.

Calling this method replaces prior bit conditions. Pass the list-of-pairs overload to require several bits simultaneously; conditions of different kinds are combined with logical AND.

参数:
  • cond -- Register name (str) or ID (int).

  • pos -- Bit position to check (0-indexed).

  • conds -- List of (register, position) pairs.

返回:

Self, for method chaining.

  1. conditioned_by_bit(self: pysparq._core.Abs_SInt, conds: collections.abc.Sequence[tuple[str, typing.SupportsInt | typing.SupportsIndex]]) -> pysparq._core.Abs_SInt

Condition this operation on a specific bit position.

Calling this method replaces prior bit conditions. Pass the list-of-pairs overload to require several bits simultaneously; conditions of different kinds are combined with logical AND.

参数:
  • cond -- Register name (str) or ID (int).

  • pos -- Bit position to check (0-indexed).

  • conds -- List of (register, position) pairs.

返回:

Self, for method chaining.

  1. conditioned_by_bit(self: pysparq._core.Abs_SInt, cond: typing.SupportsInt | typing.SupportsIndex, pos: typing.SupportsInt | typing.SupportsIndex) -> pysparq._core.Abs_SInt

Condition this operation on a specific bit position.

Calling this method replaces prior bit conditions. Pass the list-of-pairs overload to require several bits simultaneously; conditions of different kinds are combined with logical AND.

参数:
  • cond -- Register name (str) or ID (int).

  • pos -- Bit position to check (0-indexed).

  • conds -- List of (register, position) pairs.

返回:

Self, for method chaining.

  1. conditioned_by_bit(self: pysparq._core.Abs_SInt, conds: collections.abc.Sequence[tuple[typing.SupportsInt | typing.SupportsIndex, typing.SupportsInt | typing.SupportsIndex]]) -> pysparq._core.Abs_SInt

Condition this operation on a specific bit position.

Calling this method replaces prior bit conditions. Pass the list-of-pairs overload to require several bits simultaneously; conditions of different kinds are combined with logical AND.

参数:
  • cond -- Register name (str) or ID (int).

  • pos -- Bit position to check (0-indexed).

  • conds -- List of (register, position) pairs.

返回:

Self, for method chaining.

conditioned_by_nonzeros(*args, **kwargs)

Overloaded function.

  1. conditioned_by_nonzeros(self: pysparq._core.Abs_SInt, cond: str) -> pysparq._core.Abs_SInt

Condition this operation on registers with nonzero values.

Calling this method replaces prior nonzero-register conditions. Pass the list overload to require several registers simultaneously; conditions of different kinds are combined with logical AND.

参数:
  • cond -- Register name (str) or ID (int) to condition on.

  • conds -- List of register names or IDs for multi-condition.

返回:

Self, for method chaining.

示例

op.conditioned_by_nonzeros('control_reg')(state)

  1. conditioned_by_nonzeros(self: pysparq._core.Abs_SInt, conds: collections.abc.Sequence[str]) -> pysparq._core.Abs_SInt

Condition this operation on registers with nonzero values.

Calling this method replaces prior nonzero-register conditions. Pass the list overload to require several registers simultaneously; conditions of different kinds are combined with logical AND.

参数:
  • cond -- Register name (str) or ID (int) to condition on.

  • conds -- List of register names or IDs for multi-condition.

返回:

Self, for method chaining.

示例

op.conditioned_by_nonzeros('control_reg')(state)

  1. conditioned_by_nonzeros(self: pysparq._core.Abs_SInt, cond: typing.SupportsInt | typing.SupportsIndex) -> pysparq._core.Abs_SInt

Condition this operation on registers with nonzero values.

Calling this method replaces prior nonzero-register conditions. Pass the list overload to require several registers simultaneously; conditions of different kinds are combined with logical AND.

参数:
  • cond -- Register name (str) or ID (int) to condition on.

  • conds -- List of register names or IDs for multi-condition.

返回:

Self, for method chaining.

示例

op.conditioned_by_nonzeros('control_reg')(state)

  1. conditioned_by_nonzeros(self: pysparq._core.Abs_SInt, conds: collections.abc.Sequence[typing.SupportsInt | typing.SupportsIndex]) -> pysparq._core.Abs_SInt

Condition this operation on registers with nonzero values.

Calling this method replaces prior nonzero-register conditions. Pass the list overload to require several registers simultaneously; conditions of different kinds are combined with logical AND.

参数:
  • cond -- Register name (str) or ID (int) to condition on.

  • conds -- List of register names or IDs for multi-condition.

返回:

Self, for method chaining.

示例

op.conditioned_by_nonzeros('control_reg')(state)

conditioned_by_value(*args, **kwargs)

Overloaded function.

  1. conditioned_by_value(self: pysparq._core.Abs_SInt, cond: str, pos: typing.SupportsInt | typing.SupportsIndex) -> pysparq._core.Abs_SInt

Condition this operation on registers holding a specific value.

Calling this method replaces prior value conditions. Pass the list-of-pairs overload to require several values simultaneously; conditions of different kinds are combined with logical AND.

参数:
  • cond -- Register name (str) or ID (int).

  • pos -- Value to match.

  • conds -- List of (register, value) pairs.

返回:

Self, for method chaining.

  1. conditioned_by_value(self: pysparq._core.Abs_SInt, conds: collections.abc.Sequence[tuple[str, typing.SupportsInt | typing.SupportsIndex]]) -> pysparq._core.Abs_SInt

Condition this operation on registers holding a specific value.

Calling this method replaces prior value conditions. Pass the list-of-pairs overload to require several values simultaneously; conditions of different kinds are combined with logical AND.

参数:
  • cond -- Register name (str) or ID (int).

  • pos -- Value to match.

  • conds -- List of (register, value) pairs.

返回:

Self, for method chaining.

  1. conditioned_by_value(self: pysparq._core.Abs_SInt, cond: typing.SupportsInt | typing.SupportsIndex, pos: typing.SupportsInt | typing.SupportsIndex) -> pysparq._core.Abs_SInt

Condition this operation on registers holding a specific value.

Calling this method replaces prior value conditions. Pass the list-of-pairs overload to require several values simultaneously; conditions of different kinds are combined with logical AND.

参数:
  • cond -- Register name (str) or ID (int).

  • pos -- Value to match.

  • conds -- List of (register, value) pairs.

返回:

Self, for method chaining.

  1. conditioned_by_value(self: pysparq._core.Abs_SInt, conds: collections.abc.Sequence[tuple[typing.SupportsInt | typing.SupportsIndex, typing.SupportsInt | typing.SupportsIndex]]) -> pysparq._core.Abs_SInt

Condition this operation on registers holding a specific value.

Calling this method replaces prior value conditions. Pass the list-of-pairs overload to require several values simultaneously; conditions of different kinds are combined with logical AND.

参数:
  • cond -- Register name (str) or ID (int).

  • pos -- Value to match.

  • conds -- List of (register, value) pairs.

返回:

Self, for method chaining.

class pysparq.Mul_UInt_UInt

Multiply two unsigned integer registers.

Computes: res ^= lhs * rhs, taking the low 64 bits of the full-precision (128-bit) product, truncated to mod 2^res_width before being XORed into res.

参数:
  • lhs -- Name/ID of the first input register.

  • rhs -- Name/ID of the second input register.

  • res -- Name/ID of the output register (result is XORed in).

示例

Mul_UInt_UInt("a", "b", "result")(state) # result ^= a * b

clear_control_all_ones(self: pysparq._core.Mul_UInt_UInt) → None

Clear all control conditions of the specified type.

clear_control_by_bit(self: pysparq._core.Mul_UInt_UInt) → None

Clear all control conditions of the specified type.

clear_control_by_value(self: pysparq._core.Mul_UInt_UInt) → None

Clear all control conditions of the specified type.

clear_control_nonzeros(self: pysparq._core.Mul_UInt_UInt) → None

Clear all control conditions of the specified type.

property condition_variable_all_ones
property condition_variable_by_bit
property condition_variable_by_value
property condition_variable_nonzeros
conditioned_by_all_ones(*args, **kwargs)

Overloaded function.

  1. conditioned_by_all_ones(self: pysparq._core.Mul_UInt_UInt, cond: str) -> pysparq._core.Mul_UInt_UInt

Condition this operation on registers where all bits are 1.

Calling this method replaces prior all-ones conditions. Pass the list overload to require several registers simultaneously; conditions of different kinds are combined with logical AND.

参数:
  • cond -- Register name (str) or ID (int) to condition on.

  • conds -- List of register names or IDs for multi-condition.

返回:

Self, for method chaining.

  1. conditioned_by_all_ones(self: pysparq._core.Mul_UInt_UInt, conds: collections.abc.Sequence[str]) -> pysparq._core.Mul_UInt_UInt

Condition this operation on registers where all bits are 1.

Calling this method replaces prior all-ones conditions. Pass the list overload to require several registers simultaneously; conditions of different kinds are combined with logical AND.

参数:
  • cond -- Register name (str) or ID (int) to condition on.

  • conds -- List of register names or IDs for multi-condition.

返回:

Self, for method chaining.

  1. conditioned_by_all_ones(self: pysparq._core.Mul_UInt_UInt, cond: typing.SupportsInt | typing.SupportsIndex) -> pysparq._core.Mul_UInt_UInt

Condition this operation on registers where all bits are 1.

Calling this method replaces prior all-ones conditions. Pass the list overload to require several registers simultaneously; conditions of different kinds are combined with logical AND.

参数:
  • cond -- Register name (str) or ID (int) to condition on.

  • conds -- List of register names or IDs for multi-condition.

返回:

Self, for method chaining.

  1. conditioned_by_all_ones(self: pysparq._core.Mul_UInt_UInt, conds: collections.abc.Sequence[typing.SupportsInt | typing.SupportsIndex]) -> pysparq._core.Mul_UInt_UInt

Condition this operation on registers where all bits are 1.

Calling this method replaces prior all-ones conditions. Pass the list overload to require several registers simultaneously; conditions of different kinds are combined with logical AND.

参数:
  • cond -- Register name (str) or ID (int) to condition on.

  • conds -- List of register names or IDs for multi-condition.

返回:

Self, for method chaining.

conditioned_by_bit(*args, **kwargs)

Overloaded function.

  1. conditioned_by_bit(self: pysparq._core.Mul_UInt_UInt, cond: str, pos: typing.SupportsInt | typing.SupportsIndex) -> pysparq._core.Mul_UInt_UInt

Condition this operation on a specific bit position.

Calling this method replaces prior bit conditions. Pass the list-of-pairs overload to require several bits simultaneously; conditions of different kinds are combined with logical AND.

参数:
  • cond -- Register name (str) or ID (int).

  • pos -- Bit position to check (0-indexed).

  • conds -- List of (register, position) pairs.

返回:

Self, for method chaining.

  1. conditioned_by_bit(self: pysparq._core.Mul_UInt_UInt, conds: collections.abc.Sequence[tuple[str, typing.SupportsInt | typing.SupportsIndex]]) -> pysparq._core.Mul_UInt_UInt

Condition this operation on a specific bit position.

Calling this method replaces prior bit conditions. Pass the list-of-pairs overload to require several bits simultaneously; conditions of different kinds are combined with logical AND.

参数:
  • cond -- Register name (str) or ID (int).

  • pos -- Bit position to check (0-indexed).

  • conds -- List of (register, position) pairs.

返回:

Self, for method chaining.

  1. conditioned_by_bit(self: pysparq._core.Mul_UInt_UInt, cond: typing.SupportsInt | typing.SupportsIndex, pos: typing.SupportsInt | typing.SupportsIndex) -> pysparq._core.Mul_UInt_UInt

Condition this operation on a specific bit position.

Calling this method replaces prior bit conditions. Pass the list-of-pairs overload to require several bits simultaneously; conditions of different kinds are combined with logical AND.

参数:
  • cond -- Register name (str) or ID (int).

  • pos -- Bit position to check (0-indexed).

  • conds -- List of (register, position) pairs.

返回:

Self, for method chaining.

  1. conditioned_by_bit(self: pysparq._core.Mul_UInt_UInt, conds: collections.abc.Sequence[tuple[typing.SupportsInt | typing.SupportsIndex, typing.SupportsInt | typing.SupportsIndex]]) -> pysparq._core.Mul_UInt_UInt

Condition this operation on a specific bit position.

Calling this method replaces prior bit conditions. Pass the list-of-pairs overload to require several bits simultaneously; conditions of different kinds are combined with logical AND.

参数:
  • cond -- Register name (str) or ID (int).

  • pos -- Bit position to check (0-indexed).

  • conds -- List of (register, position) pairs.

返回:

Self, for method chaining.

conditioned_by_nonzeros(*args, **kwargs)

Overloaded function.

  1. conditioned_by_nonzeros(self: pysparq._core.Mul_UInt_UInt, cond: str) -> pysparq._core.Mul_UInt_UInt

Condition this operation on registers with nonzero values.

Calling this method replaces prior nonzero-register conditions. Pass the list overload to require several registers simultaneously; conditions of different kinds are combined with logical AND.

参数:
  • cond -- Register name (str) or ID (int) to condition on.

  • conds -- List of register names or IDs for multi-condition.

返回:

Self, for method chaining.

示例

op.conditioned_by_nonzeros('control_reg')(state)

  1. conditioned_by_nonzeros(self: pysparq._core.Mul_UInt_UInt, conds: collections.abc.Sequence[str]) -> pysparq._core.Mul_UInt_UInt

Condition this operation on registers with nonzero values.

Calling this method replaces prior nonzero-register conditions. Pass the list overload to require several registers simultaneously; conditions of different kinds are combined with logical AND.

参数:
  • cond -- Register name (str) or ID (int) to condition on.

  • conds -- List of register names or IDs for multi-condition.

返回:

Self, for method chaining.

示例

op.conditioned_by_nonzeros('control_reg')(state)

  1. conditioned_by_nonzeros(self: pysparq._core.Mul_UInt_UInt, cond: typing.SupportsInt | typing.SupportsIndex) -> pysparq._core.Mul_UInt_UInt

Condition this operation on registers with nonzero values.

Calling this method replaces prior nonzero-register conditions. Pass the list overload to require several registers simultaneously; conditions of different kinds are combined with logical AND.

参数:
  • cond -- Register name (str) or ID (int) to condition on.

  • conds -- List of register names or IDs for multi-condition.

返回:

Self, for method chaining.

示例

op.conditioned_by_nonzeros('control_reg')(state)

  1. conditioned_by_nonzeros(self: pysparq._core.Mul_UInt_UInt, conds: collections.abc.Sequence[typing.SupportsInt | typing.SupportsIndex]) -> pysparq._core.Mul_UInt_UInt

Condition this operation on registers with nonzero values.

Calling this method replaces prior nonzero-register conditions. Pass the list overload to require several registers simultaneously; conditions of different kinds are combined with logical AND.

参数:
  • cond -- Register name (str) or ID (int) to condition on.

  • conds -- List of register names or IDs for multi-condition.

返回:

Self, for method chaining.

示例

op.conditioned_by_nonzeros('control_reg')(state)

conditioned_by_value(*args, **kwargs)

Overloaded function.

  1. conditioned_by_value(self: pysparq._core.Mul_UInt_UInt, cond: str, pos: typing.SupportsInt | typing.SupportsIndex) -> pysparq._core.Mul_UInt_UInt

Condition this operation on registers holding a specific value.

Calling this method replaces prior value conditions. Pass the list-of-pairs overload to require several values simultaneously; conditions of different kinds are combined with logical AND.

参数:
  • cond -- Register name (str) or ID (int).

  • pos -- Value to match.

  • conds -- List of (register, value) pairs.

返回:

Self, for method chaining.

  1. conditioned_by_value(self: pysparq._core.Mul_UInt_UInt, conds: collections.abc.Sequence[tuple[str, typing.SupportsInt | typing.SupportsIndex]]) -> pysparq._core.Mul_UInt_UInt

Condition this operation on registers holding a specific value.

Calling this method replaces prior value conditions. Pass the list-of-pairs overload to require several values simultaneously; conditions of different kinds are combined with logical AND.

参数:
  • cond -- Register name (str) or ID (int).

  • pos -- Value to match.

  • conds -- List of (register, value) pairs.

返回:

Self, for method chaining.

  1. conditioned_by_value(self: pysparq._core.Mul_UInt_UInt, cond: typing.SupportsInt | typing.SupportsIndex, pos: typing.SupportsInt | typing.SupportsIndex) -> pysparq._core.Mul_UInt_UInt

Condition this operation on registers holding a specific value.

Calling this method replaces prior value conditions. Pass the list-of-pairs overload to require several values simultaneously; conditions of different kinds are combined with logical AND.

参数:
  • cond -- Register name (str) or ID (int).

  • pos -- Value to match.

  • conds -- List of (register, value) pairs.

返回:

Self, for method chaining.

  1. conditioned_by_value(self: pysparq._core.Mul_UInt_UInt, conds: collections.abc.Sequence[tuple[typing.SupportsInt | typing.SupportsIndex, typing.SupportsInt | typing.SupportsIndex]]) -> pysparq._core.Mul_UInt_UInt

Condition this operation on registers holding a specific value.

Calling this method replaces prior value conditions. Pass the list-of-pairs overload to require several values simultaneously; conditions of different kinds are combined with logical AND.

参数:
  • cond -- Register name (str) or ID (int).

  • pos -- Value to match.

  • conds -- List of (register, value) pairs.

返回:

Self, for method chaining.

class pysparq.Div_UInt_UInt

Integer-divide two unsigned integer registers.

Computes: res ^= lhs / rhs (floor division). Total-domain convention: a zero divisor yields quotient 0 instead of raising (overflow/domain information is reported by dedicated flag operators); the quotient is truncated to mod 2^res_width before being XORed into res.

参数:
  • lhs -- Name/ID of the dividend register.

  • rhs -- Name/ID of the divisor register.

  • res -- Name/ID of the output register (result is XORed in).

示例

Div_UInt_UInt("a", "b", "result")(state) # result ^= a / b (0 if b == 0)

clear_control_all_ones(self: pysparq._core.Div_UInt_UInt) → None

Clear all control conditions of the specified type.

clear_control_by_bit(self: pysparq._core.Div_UInt_UInt) → None

Clear all control conditions of the specified type.

clear_control_by_value(self: pysparq._core.Div_UInt_UInt) → None

Clear all control conditions of the specified type.

clear_control_nonzeros(self: pysparq._core.Div_UInt_UInt) → None

Clear all control conditions of the specified type.

property condition_variable_all_ones
property condition_variable_by_bit
property condition_variable_by_value
property condition_variable_nonzeros
conditioned_by_all_ones(*args, **kwargs)

Overloaded function.

  1. conditioned_by_all_ones(self: pysparq._core.Div_UInt_UInt, cond: str) -> pysparq._core.Div_UInt_UInt

Condition this operation on registers where all bits are 1.

Calling this method replaces prior all-ones conditions. Pass the list overload to require several registers simultaneously; conditions of different kinds are combined with logical AND.

参数:
  • cond -- Register name (str) or ID (int) to condition on.

  • conds -- List of register names or IDs for multi-condition.

返回:

Self, for method chaining.

  1. conditioned_by_all_ones(self: pysparq._core.Div_UInt_UInt, conds: collections.abc.Sequence[str]) -> pysparq._core.Div_UInt_UInt

Condition this operation on registers where all bits are 1.

Calling this method replaces prior all-ones conditions. Pass the list overload to require several registers simultaneously; conditions of different kinds are combined with logical AND.

参数:
  • cond -- Register name (str) or ID (int) to condition on.

  • conds -- List of register names or IDs for multi-condition.

返回:

Self, for method chaining.

  1. conditioned_by_all_ones(self: pysparq._core.Div_UInt_UInt, cond: typing.SupportsInt | typing.SupportsIndex) -> pysparq._core.Div_UInt_UInt

Condition this operation on registers where all bits are 1.

Calling this method replaces prior all-ones conditions. Pass the list overload to require several registers simultaneously; conditions of different kinds are combined with logical AND.

参数:
  • cond -- Register name (str) or ID (int) to condition on.

  • conds -- List of register names or IDs for multi-condition.

返回:

Self, for method chaining.

  1. conditioned_by_all_ones(self: pysparq._core.Div_UInt_UInt, conds: collections.abc.Sequence[typing.SupportsInt | typing.SupportsIndex]) -> pysparq._core.Div_UInt_UInt

Condition this operation on registers where all bits are 1.

Calling this method replaces prior all-ones conditions. Pass the list overload to require several registers simultaneously; conditions of different kinds are combined with logical AND.

参数:
  • cond -- Register name (str) or ID (int) to condition on.

  • conds -- List of register names or IDs for multi-condition.

返回:

Self, for method chaining.

conditioned_by_bit(*args, **kwargs)

Overloaded function.

  1. conditioned_by_bit(self: pysparq._core.Div_UInt_UInt, cond: str, pos: typing.SupportsInt | typing.SupportsIndex) -> pysparq._core.Div_UInt_UInt

Condition this operation on a specific bit position.

Calling this method replaces prior bit conditions. Pass the list-of-pairs overload to require several bits simultaneously; conditions of different kinds are combined with logical AND.

参数:
  • cond -- Register name (str) or ID (int).

  • pos -- Bit position to check (0-indexed).

  • conds -- List of (register, position) pairs.

返回:

Self, for method chaining.

  1. conditioned_by_bit(self: pysparq._core.Div_UInt_UInt, conds: collections.abc.Sequence[tuple[str, typing.SupportsInt | typing.SupportsIndex]]) -> pysparq._core.Div_UInt_UInt

Condition this operation on a specific bit position.

Calling this method replaces prior bit conditions. Pass the list-of-pairs overload to require several bits simultaneously; conditions of different kinds are combined with logical AND.

参数:
  • cond -- Register name (str) or ID (int).

  • pos -- Bit position to check (0-indexed).

  • conds -- List of (register, position) pairs.

返回:

Self, for method chaining.

  1. conditioned_by_bit(self: pysparq._core.Div_UInt_UInt, cond: typing.SupportsInt | typing.SupportsIndex, pos: typing.SupportsInt | typing.SupportsIndex) -> pysparq._core.Div_UInt_UInt

Condition this operation on a specific bit position.

Calling this method replaces prior bit conditions. Pass the list-of-pairs overload to require several bits simultaneously; conditions of different kinds are combined with logical AND.

参数:
  • cond -- Register name (str) or ID (int).

  • pos -- Bit position to check (0-indexed).

  • conds -- List of (register, position) pairs.

返回:

Self, for method chaining.

  1. conditioned_by_bit(self: pysparq._core.Div_UInt_UInt, conds: collections.abc.Sequence[tuple[typing.SupportsInt | typing.SupportsIndex, typing.SupportsInt | typing.SupportsIndex]]) -> pysparq._core.Div_UInt_UInt

Condition this operation on a specific bit position.

Calling this method replaces prior bit conditions. Pass the list-of-pairs overload to require several bits simultaneously; conditions of different kinds are combined with logical AND.

参数:
  • cond -- Register name (str) or ID (int).

  • pos -- Bit position to check (0-indexed).

  • conds -- List of (register, position) pairs.

返回:

Self, for method chaining.

conditioned_by_nonzeros(*args, **kwargs)

Overloaded function.

  1. conditioned_by_nonzeros(self: pysparq._core.Div_UInt_UInt, cond: str) -> pysparq._core.Div_UInt_UInt

Condition this operation on registers with nonzero values.

Calling this method replaces prior nonzero-register conditions. Pass the list overload to require several registers simultaneously; conditions of different kinds are combined with logical AND.

参数:
  • cond -- Register name (str) or ID (int) to condition on.

  • conds -- List of register names or IDs for multi-condition.

返回:

Self, for method chaining.

示例

op.conditioned_by_nonzeros('control_reg')(state)

  1. conditioned_by_nonzeros(self: pysparq._core.Div_UInt_UInt, conds: collections.abc.Sequence[str]) -> pysparq._core.Div_UInt_UInt

Condition this operation on registers with nonzero values.

Calling this method replaces prior nonzero-register conditions. Pass the list overload to require several registers simultaneously; conditions of different kinds are combined with logical AND.

参数:
  • cond -- Register name (str) or ID (int) to condition on.

  • conds -- List of register names or IDs for multi-condition.

返回:

Self, for method chaining.

示例

op.conditioned_by_nonzeros('control_reg')(state)

  1. conditioned_by_nonzeros(self: pysparq._core.Div_UInt_UInt, cond: typing.SupportsInt | typing.SupportsIndex) -> pysparq._core.Div_UInt_UInt

Condition this operation on registers with nonzero values.

Calling this method replaces prior nonzero-register conditions. Pass the list overload to require several registers simultaneously; conditions of different kinds are combined with logical AND.

参数:
  • cond -- Register name (str) or ID (int) to condition on.

  • conds -- List of register names or IDs for multi-condition.

返回:

Self, for method chaining.

示例

op.conditioned_by_nonzeros('control_reg')(state)

  1. conditioned_by_nonzeros(self: pysparq._core.Div_UInt_UInt, conds: collections.abc.Sequence[typing.SupportsInt | typing.SupportsIndex]) -> pysparq._core.Div_UInt_UInt

Condition this operation on registers with nonzero values.

Calling this method replaces prior nonzero-register conditions. Pass the list overload to require several registers simultaneously; conditions of different kinds are combined with logical AND.

参数:
  • cond -- Register name (str) or ID (int) to condition on.

  • conds -- List of register names or IDs for multi-condition.

返回:

Self, for method chaining.

示例

op.conditioned_by_nonzeros('control_reg')(state)

conditioned_by_value(*args, **kwargs)

Overloaded function.

  1. conditioned_by_value(self: pysparq._core.Div_UInt_UInt, cond: str, pos: typing.SupportsInt | typing.SupportsIndex) -> pysparq._core.Div_UInt_UInt

Condition this operation on registers holding a specific value.

Calling this method replaces prior value conditions. Pass the list-of-pairs overload to require several values simultaneously; conditions of different kinds are combined with logical AND.

参数:
  • cond -- Register name (str) or ID (int).

  • pos -- Value to match.

  • conds -- List of (register, value) pairs.

返回:

Self, for method chaining.

  1. conditioned_by_value(self: pysparq._core.Div_UInt_UInt, conds: collections.abc.Sequence[tuple[str, typing.SupportsInt | typing.SupportsIndex]]) -> pysparq._core.Div_UInt_UInt

Condition this operation on registers holding a specific value.

Calling this method replaces prior value conditions. Pass the list-of-pairs overload to require several values simultaneously; conditions of different kinds are combined with logical AND.

参数:
  • cond -- Register name (str) or ID (int).

  • pos -- Value to match.

  • conds -- List of (register, value) pairs.

返回:

Self, for method chaining.

  1. conditioned_by_value(self: pysparq._core.Div_UInt_UInt, cond: typing.SupportsInt | typing.SupportsIndex, pos: typing.SupportsInt | typing.SupportsIndex) -> pysparq._core.Div_UInt_UInt

Condition this operation on registers holding a specific value.

Calling this method replaces prior value conditions. Pass the list-of-pairs overload to require several values simultaneously; conditions of different kinds are combined with logical AND.

参数:
  • cond -- Register name (str) or ID (int).

  • pos -- Value to match.

  • conds -- List of (register, value) pairs.

返回:

Self, for method chaining.

  1. conditioned_by_value(self: pysparq._core.Div_UInt_UInt, conds: collections.abc.Sequence[tuple[typing.SupportsInt | typing.SupportsIndex, typing.SupportsInt | typing.SupportsIndex]]) -> pysparq._core.Div_UInt_UInt

Condition this operation on registers holding a specific value.

Calling this method replaces prior value conditions. Pass the list-of-pairs overload to require several values simultaneously; conditions of different kinds are combined with logical AND.

参数:
  • cond -- Register name (str) or ID (int).

  • pos -- Value to match.

  • conds -- List of (register, value) pairs.

返回:

Self, for method chaining.

class pysparq.Sqrt_UInt

Integer square root of an unsigned integer register.

Computes: res ^= isqrt(reg) = floor(sqrt(reg)) via an integer-only bitwise algorithm (CPU and CUDA agree bit-for-bit), truncated to mod 2^res_width before being XORed into res.

参数:
  • reg -- Name/ID of the input register.

  • res -- Name/ID of the output register (result is XORed in).

示例

Sqrt_UInt("a", "result")(state) # result ^= floor(sqrt(a))

clear_control_all_ones(self: pysparq._core.Sqrt_UInt) → None

Clear all control conditions of the specified type.

clear_control_by_bit(self: pysparq._core.Sqrt_UInt) → None

Clear all control conditions of the specified type.

clear_control_by_value(self: pysparq._core.Sqrt_UInt) → None

Clear all control conditions of the specified type.

clear_control_nonzeros(self: pysparq._core.Sqrt_UInt) → None

Clear all control conditions of the specified type.

property condition_variable_all_ones
property condition_variable_by_bit
property condition_variable_by_value
property condition_variable_nonzeros
conditioned_by_all_ones(*args, **kwargs)

Overloaded function.

  1. conditioned_by_all_ones(self: pysparq._core.Sqrt_UInt, cond: str) -> pysparq._core.Sqrt_UInt

Condition this operation on registers where all bits are 1.

Calling this method replaces prior all-ones conditions. Pass the list overload to require several registers simultaneously; conditions of different kinds are combined with logical AND.

参数:
  • cond -- Register name (str) or ID (int) to condition on.

  • conds -- List of register names or IDs for multi-condition.

返回:

Self, for method chaining.

  1. conditioned_by_all_ones(self: pysparq._core.Sqrt_UInt, conds: collections.abc.Sequence[str]) -> pysparq._core.Sqrt_UInt

Condition this operation on registers where all bits are 1.

Calling this method replaces prior all-ones conditions. Pass the list overload to require several registers simultaneously; conditions of different kinds are combined with logical AND.

参数:
  • cond -- Register name (str) or ID (int) to condition on.

  • conds -- List of register names or IDs for multi-condition.

返回:

Self, for method chaining.

  1. conditioned_by_all_ones(self: pysparq._core.Sqrt_UInt, cond: typing.SupportsInt | typing.SupportsIndex) -> pysparq._core.Sqrt_UInt

Condition this operation on registers where all bits are 1.

Calling this method replaces prior all-ones conditions. Pass the list overload to require several registers simultaneously; conditions of different kinds are combined with logical AND.

参数:
  • cond -- Register name (str) or ID (int) to condition on.

  • conds -- List of register names or IDs for multi-condition.

返回:

Self, for method chaining.

  1. conditioned_by_all_ones(self: pysparq._core.Sqrt_UInt, conds: collections.abc.Sequence[typing.SupportsInt | typing.SupportsIndex]) -> pysparq._core.Sqrt_UInt

Condition this operation on registers where all bits are 1.

Calling this method replaces prior all-ones conditions. Pass the list overload to require several registers simultaneously; conditions of different kinds are combined with logical AND.

参数:
  • cond -- Register name (str) or ID (int) to condition on.

  • conds -- List of register names or IDs for multi-condition.

返回:

Self, for method chaining.

conditioned_by_bit(*args, **kwargs)

Overloaded function.

  1. conditioned_by_bit(self: pysparq._core.Sqrt_UInt, cond: str, pos: typing.SupportsInt | typing.SupportsIndex) -> pysparq._core.Sqrt_UInt

Condition this operation on a specific bit position.

Calling this method replaces prior bit conditions. Pass the list-of-pairs overload to require several bits simultaneously; conditions of different kinds are combined with logical AND.

参数:
  • cond -- Register name (str) or ID (int).

  • pos -- Bit position to check (0-indexed).

  • conds -- List of (register, position) pairs.

返回:

Self, for method chaining.

  1. conditioned_by_bit(self: pysparq._core.Sqrt_UInt, conds: collections.abc.Sequence[tuple[str, typing.SupportsInt | typing.SupportsIndex]]) -> pysparq._core.Sqrt_UInt

Condition this operation on a specific bit position.

Calling this method replaces prior bit conditions. Pass the list-of-pairs overload to require several bits simultaneously; conditions of different kinds are combined with logical AND.

参数:
  • cond -- Register name (str) or ID (int).

  • pos -- Bit position to check (0-indexed).

  • conds -- List of (register, position) pairs.

返回:

Self, for method chaining.

  1. conditioned_by_bit(self: pysparq._core.Sqrt_UInt, cond: typing.SupportsInt | typing.SupportsIndex, pos: typing.SupportsInt | typing.SupportsIndex) -> pysparq._core.Sqrt_UInt

Condition this operation on a specific bit position.

Calling this method replaces prior bit conditions. Pass the list-of-pairs overload to require several bits simultaneously; conditions of different kinds are combined with logical AND.

参数:
  • cond -- Register name (str) or ID (int).

  • pos -- Bit position to check (0-indexed).

  • conds -- List of (register, position) pairs.

返回:

Self, for method chaining.

  1. conditioned_by_bit(self: pysparq._core.Sqrt_UInt, conds: collections.abc.Sequence[tuple[typing.SupportsInt | typing.SupportsIndex, typing.SupportsInt | typing.SupportsIndex]]) -> pysparq._core.Sqrt_UInt

Condition this operation on a specific bit position.

Calling this method replaces prior bit conditions. Pass the list-of-pairs overload to require several bits simultaneously; conditions of different kinds are combined with logical AND.

参数:
  • cond -- Register name (str) or ID (int).

  • pos -- Bit position to check (0-indexed).

  • conds -- List of (register, position) pairs.

返回:

Self, for method chaining.

conditioned_by_nonzeros(*args, **kwargs)

Overloaded function.

  1. conditioned_by_nonzeros(self: pysparq._core.Sqrt_UInt, cond: str) -> pysparq._core.Sqrt_UInt

Condition this operation on registers with nonzero values.

Calling this method replaces prior nonzero-register conditions. Pass the list overload to require several registers simultaneously; conditions of different kinds are combined with logical AND.

参数:
  • cond -- Register name (str) or ID (int) to condition on.

  • conds -- List of register names or IDs for multi-condition.

返回:

Self, for method chaining.

示例

op.conditioned_by_nonzeros('control_reg')(state)

  1. conditioned_by_nonzeros(self: pysparq._core.Sqrt_UInt, conds: collections.abc.Sequence[str]) -> pysparq._core.Sqrt_UInt

Condition this operation on registers with nonzero values.

Calling this method replaces prior nonzero-register conditions. Pass the list overload to require several registers simultaneously; conditions of different kinds are combined with logical AND.

参数:
  • cond -- Register name (str) or ID (int) to condition on.

  • conds -- List of register names or IDs for multi-condition.

返回:

Self, for method chaining.

示例

op.conditioned_by_nonzeros('control_reg')(state)

  1. conditioned_by_nonzeros(self: pysparq._core.Sqrt_UInt, cond: typing.SupportsInt | typing.SupportsIndex) -> pysparq._core.Sqrt_UInt

Condition this operation on registers with nonzero values.

Calling this method replaces prior nonzero-register conditions. Pass the list overload to require several registers simultaneously; conditions of different kinds are combined with logical AND.

参数:
  • cond -- Register name (str) or ID (int) to condition on.

  • conds -- List of register names or IDs for multi-condition.

返回:

Self, for method chaining.

示例

op.conditioned_by_nonzeros('control_reg')(state)

  1. conditioned_by_nonzeros(self: pysparq._core.Sqrt_UInt, conds: collections.abc.Sequence[typing.SupportsInt | typing.SupportsIndex]) -> pysparq._core.Sqrt_UInt

Condition this operation on registers with nonzero values.

Calling this method replaces prior nonzero-register conditions. Pass the list overload to require several registers simultaneously; conditions of different kinds are combined with logical AND.

参数:
  • cond -- Register name (str) or ID (int) to condition on.

  • conds -- List of register names or IDs for multi-condition.

返回:

Self, for method chaining.

示例

op.conditioned_by_nonzeros('control_reg')(state)

conditioned_by_value(*args, **kwargs)

Overloaded function.

  1. conditioned_by_value(self: pysparq._core.Sqrt_UInt, cond: str, pos: typing.SupportsInt | typing.SupportsIndex) -> pysparq._core.Sqrt_UInt

Condition this operation on registers holding a specific value.

Calling this method replaces prior value conditions. Pass the list-of-pairs overload to require several values simultaneously; conditions of different kinds are combined with logical AND.

参数:
  • cond -- Register name (str) or ID (int).

  • pos -- Value to match.

  • conds -- List of (register, value) pairs.

返回:

Self, for method chaining.

  1. conditioned_by_value(self: pysparq._core.Sqrt_UInt, conds: collections.abc.Sequence[tuple[str, typing.SupportsInt | typing.SupportsIndex]]) -> pysparq._core.Sqrt_UInt

Condition this operation on registers holding a specific value.

Calling this method replaces prior value conditions. Pass the list-of-pairs overload to require several values simultaneously; conditions of different kinds are combined with logical AND.

参数:
  • cond -- Register name (str) or ID (int).

  • pos -- Value to match.

  • conds -- List of (register, value) pairs.

返回:

Self, for method chaining.

  1. conditioned_by_value(self: pysparq._core.Sqrt_UInt, cond: typing.SupportsInt | typing.SupportsIndex, pos: typing.SupportsInt | typing.SupportsIndex) -> pysparq._core.Sqrt_UInt

Condition this operation on registers holding a specific value.

Calling this method replaces prior value conditions. Pass the list-of-pairs overload to require several values simultaneously; conditions of different kinds are combined with logical AND.

参数:
  • cond -- Register name (str) or ID (int).

  • pos -- Value to match.

  • conds -- List of (register, value) pairs.

返回:

Self, for method chaining.

  1. conditioned_by_value(self: pysparq._core.Sqrt_UInt, conds: collections.abc.Sequence[tuple[typing.SupportsInt | typing.SupportsIndex, typing.SupportsInt | typing.SupportsIndex]]) -> pysparq._core.Sqrt_UInt

Condition this operation on registers holding a specific value.

Calling this method replaces prior value conditions. Pass the list-of-pairs overload to require several values simultaneously; conditions of different kinds are combined with logical AND.

参数:
  • cond -- Register name (str) or ID (int).

  • pos -- Value to match.

  • conds -- List of (register, value) pairs.

返回:

Self, for method chaining.

class pysparq.Select_Bool_UInt_UInt

Select between two unsigned integer registers by a Boolean condition.

Computes: res ^= (cond ? lhs : rhs), where cond is a width-1 Boolean register read at bit 0; the selected value is truncated to mod 2^res_width before being XORed into res.

参数:
  • cond -- Name/ID of the width-1 Boolean condition register.

  • lhs -- Name/ID of the register selected when cond == 1.

  • rhs -- Name/ID of the register selected when cond == 0.

  • res -- Name/ID of the output register (result is XORed in).

示例

Select_Bool_UInt_UInt("c", "a", "b", "result")(state) # result ^= a if c else b

clear_control_all_ones(self: pysparq._core.Select_Bool_UInt_UInt) → None

Clear all control conditions of the specified type.

clear_control_by_bit(self: pysparq._core.Select_Bool_UInt_UInt) → None

Clear all control conditions of the specified type.

clear_control_by_value(self: pysparq._core.Select_Bool_UInt_UInt) → None

Clear all control conditions of the specified type.

clear_control_nonzeros(self: pysparq._core.Select_Bool_UInt_UInt) → None

Clear all control conditions of the specified type.

property condition_variable_all_ones
property condition_variable_by_bit
property condition_variable_by_value
property condition_variable_nonzeros
conditioned_by_all_ones(*args, **kwargs)

Overloaded function.

  1. conditioned_by_all_ones(self: pysparq._core.Select_Bool_UInt_UInt, cond: str) -> pysparq._core.Select_Bool_UInt_UInt

Condition this operation on registers where all bits are 1.

Calling this method replaces prior all-ones conditions. Pass the list overload to require several registers simultaneously; conditions of different kinds are combined with logical AND.

参数:
  • cond -- Register name (str) or ID (int) to condition on.

  • conds -- List of register names or IDs for multi-condition.

返回:

Self, for method chaining.

  1. conditioned_by_all_ones(self: pysparq._core.Select_Bool_UInt_UInt, conds: collections.abc.Sequence[str]) -> pysparq._core.Select_Bool_UInt_UInt

Condition this operation on registers where all bits are 1.

Calling this method replaces prior all-ones conditions. Pass the list overload to require several registers simultaneously; conditions of different kinds are combined with logical AND.

参数:
  • cond -- Register name (str) or ID (int) to condition on.

  • conds -- List of register names or IDs for multi-condition.

返回:

Self, for method chaining.

  1. conditioned_by_all_ones(self: pysparq._core.Select_Bool_UInt_UInt, cond: typing.SupportsInt | typing.SupportsIndex) -> pysparq._core.Select_Bool_UInt_UInt

Condition this operation on registers where all bits are 1.

Calling this method replaces prior all-ones conditions. Pass the list overload to require several registers simultaneously; conditions of different kinds are combined with logical AND.

参数:
  • cond -- Register name (str) or ID (int) to condition on.

  • conds -- List of register names or IDs for multi-condition.

返回:

Self, for method chaining.

  1. conditioned_by_all_ones(self: pysparq._core.Select_Bool_UInt_UInt, conds: collections.abc.Sequence[typing.SupportsInt | typing.SupportsIndex]) -> pysparq._core.Select_Bool_UInt_UInt

Condition this operation on registers where all bits are 1.

Calling this method replaces prior all-ones conditions. Pass the list overload to require several registers simultaneously; conditions of different kinds are combined with logical AND.

参数:
  • cond -- Register name (str) or ID (int) to condition on.

  • conds -- List of register names or IDs for multi-condition.

返回:

Self, for method chaining.

conditioned_by_bit(*args, **kwargs)

Overloaded function.

  1. conditioned_by_bit(self: pysparq._core.Select_Bool_UInt_UInt, cond: str, pos: typing.SupportsInt | typing.SupportsIndex) -> pysparq._core.Select_Bool_UInt_UInt

Condition this operation on a specific bit position.

Calling this method replaces prior bit conditions. Pass the list-of-pairs overload to require several bits simultaneously; conditions of different kinds are combined with logical AND.

参数:
  • cond -- Register name (str) or ID (int).

  • pos -- Bit position to check (0-indexed).

  • conds -- List of (register, position) pairs.

返回:

Self, for method chaining.

  1. conditioned_by_bit(self: pysparq._core.Select_Bool_UInt_UInt, conds: collections.abc.Sequence[tuple[str, typing.SupportsInt | typing.SupportsIndex]]) -> pysparq._core.Select_Bool_UInt_UInt

Condition this operation on a specific bit position.

Calling this method replaces prior bit conditions. Pass the list-of-pairs overload to require several bits simultaneously; conditions of different kinds are combined with logical AND.

参数:
  • cond -- Register name (str) or ID (int).

  • pos -- Bit position to check (0-indexed).

  • conds -- List of (register, position) pairs.

返回:

Self, for method chaining.

  1. conditioned_by_bit(self: pysparq._core.Select_Bool_UInt_UInt, cond: typing.SupportsInt | typing.SupportsIndex, pos: typing.SupportsInt | typing.SupportsIndex) -> pysparq._core.Select_Bool_UInt_UInt

Condition this operation on a specific bit position.

Calling this method replaces prior bit conditions. Pass the list-of-pairs overload to require several bits simultaneously; conditions of different kinds are combined with logical AND.

参数:
  • cond -- Register name (str) or ID (int).

  • pos -- Bit position to check (0-indexed).

  • conds -- List of (register, position) pairs.

返回:

Self, for method chaining.

  1. conditioned_by_bit(self: pysparq._core.Select_Bool_UInt_UInt, conds: collections.abc.Sequence[tuple[typing.SupportsInt | typing.SupportsIndex, typing.SupportsInt | typing.SupportsIndex]]) -> pysparq._core.Select_Bool_UInt_UInt

Condition this operation on a specific bit position.

Calling this method replaces prior bit conditions. Pass the list-of-pairs overload to require several bits simultaneously; conditions of different kinds are combined with logical AND.

参数:
  • cond -- Register name (str) or ID (int).

  • pos -- Bit position to check (0-indexed).

  • conds -- List of (register, position) pairs.

返回:

Self, for method chaining.

conditioned_by_nonzeros(*args, **kwargs)

Overloaded function.

  1. conditioned_by_nonzeros(self: pysparq._core.Select_Bool_UInt_UInt, cond: str) -> pysparq._core.Select_Bool_UInt_UInt

Condition this operation on registers with nonzero values.

Calling this method replaces prior nonzero-register conditions. Pass the list overload to require several registers simultaneously; conditions of different kinds are combined with logical AND.

参数:
  • cond -- Register name (str) or ID (int) to condition on.

  • conds -- List of register names or IDs for multi-condition.

返回:

Self, for method chaining.

示例

op.conditioned_by_nonzeros('control_reg')(state)

  1. conditioned_by_nonzeros(self: pysparq._core.Select_Bool_UInt_UInt, conds: collections.abc.Sequence[str]) -> pysparq._core.Select_Bool_UInt_UInt

Condition this operation on registers with nonzero values.

Calling this method replaces prior nonzero-register conditions. Pass the list overload to require several registers simultaneously; conditions of different kinds are combined with logical AND.

参数:
  • cond -- Register name (str) or ID (int) to condition on.

  • conds -- List of register names or IDs for multi-condition.

返回:

Self, for method chaining.

示例

op.conditioned_by_nonzeros('control_reg')(state)

  1. conditioned_by_nonzeros(self: pysparq._core.Select_Bool_UInt_UInt, cond: typing.SupportsInt | typing.SupportsIndex) -> pysparq._core.Select_Bool_UInt_UInt

Condition this operation on registers with nonzero values.

Calling this method replaces prior nonzero-register conditions. Pass the list overload to require several registers simultaneously; conditions of different kinds are combined with logical AND.

参数:
  • cond -- Register name (str) or ID (int) to condition on.

  • conds -- List of register names or IDs for multi-condition.

返回:

Self, for method chaining.

示例

op.conditioned_by_nonzeros('control_reg')(state)

  1. conditioned_by_nonzeros(self: pysparq._core.Select_Bool_UInt_UInt, conds: collections.abc.Sequence[typing.SupportsInt | typing.SupportsIndex]) -> pysparq._core.Select_Bool_UInt_UInt

Condition this operation on registers with nonzero values.

Calling this method replaces prior nonzero-register conditions. Pass the list overload to require several registers simultaneously; conditions of different kinds are combined with logical AND.

参数:
  • cond -- Register name (str) or ID (int) to condition on.

  • conds -- List of register names or IDs for multi-condition.

返回:

Self, for method chaining.

示例

op.conditioned_by_nonzeros('control_reg')(state)

conditioned_by_value(*args, **kwargs)

Overloaded function.

  1. conditioned_by_value(self: pysparq._core.Select_Bool_UInt_UInt, cond: str, pos: typing.SupportsInt | typing.SupportsIndex) -> pysparq._core.Select_Bool_UInt_UInt

Condition this operation on registers holding a specific value.

Calling this method replaces prior value conditions. Pass the list-of-pairs overload to require several values simultaneously; conditions of different kinds are combined with logical AND.

参数:
  • cond -- Register name (str) or ID (int).

  • pos -- Value to match.

  • conds -- List of (register, value) pairs.

返回:

Self, for method chaining.

  1. conditioned_by_value(self: pysparq._core.Select_Bool_UInt_UInt, conds: collections.abc.Sequence[tuple[str, typing.SupportsInt | typing.SupportsIndex]]) -> pysparq._core.Select_Bool_UInt_UInt

Condition this operation on registers holding a specific value.

Calling this method replaces prior value conditions. Pass the list-of-pairs overload to require several values simultaneously; conditions of different kinds are combined with logical AND.

参数:
  • cond -- Register name (str) or ID (int).

  • pos -- Value to match.

  • conds -- List of (register, value) pairs.

返回:

Self, for method chaining.

  1. conditioned_by_value(self: pysparq._core.Select_Bool_UInt_UInt, cond: typing.SupportsInt | typing.SupportsIndex, pos: typing.SupportsInt | typing.SupportsIndex) -> pysparq._core.Select_Bool_UInt_UInt

Condition this operation on registers holding a specific value.

Calling this method replaces prior value conditions. Pass the list-of-pairs overload to require several values simultaneously; conditions of different kinds are combined with logical AND.

参数:
  • cond -- Register name (str) or ID (int).

  • pos -- Value to match.

  • conds -- List of (register, value) pairs.

返回:

Self, for method chaining.

  1. conditioned_by_value(self: pysparq._core.Select_Bool_UInt_UInt, conds: collections.abc.Sequence[tuple[typing.SupportsInt | typing.SupportsIndex, typing.SupportsInt | typing.SupportsIndex]]) -> pysparq._core.Select_Bool_UInt_UInt

Condition this operation on registers holding a specific value.

Calling this method replaces prior value conditions. Pass the list-of-pairs overload to require several values simultaneously; conditions of different kinds are combined with logical AND.

参数:
  • cond -- Register name (str) or ID (int).

  • pos -- Value to match.

  • conds -- List of (register, value) pairs.

返回:

Self, for method chaining.

class pysparq.And_UInt_UInt

Bitwise AND of two unsigned integer registers.

Computes: res ^= lhs & rhs, operands zero-extended, result truncated to mod 2^res_width before being XORed into res.

参数:
  • lhs -- Name/ID of the first input register.

  • rhs -- Name/ID of the second input register.

  • res -- Name/ID of the output register (result is XORed in).

示例

And_UInt_UInt("a", "b", "result")(state) # result ^= a & b

clear_control_all_ones(self: pysparq._core.And_UInt_UInt) → None

Clear all control conditions of the specified type.

clear_control_by_bit(self: pysparq._core.And_UInt_UInt) → None

Clear all control conditions of the specified type.

clear_control_by_value(self: pysparq._core.And_UInt_UInt) → None

Clear all control conditions of the specified type.

clear_control_nonzeros(self: pysparq._core.And_UInt_UInt) → None

Clear all control conditions of the specified type.

property condition_variable_all_ones
property condition_variable_by_bit
property condition_variable_by_value
property condition_variable_nonzeros
conditioned_by_all_ones(*args, **kwargs)

Overloaded function.

  1. conditioned_by_all_ones(self: pysparq._core.And_UInt_UInt, cond: str) -> pysparq._core.And_UInt_UInt

Condition this operation on registers where all bits are 1.

Calling this method replaces prior all-ones conditions. Pass the list overload to require several registers simultaneously; conditions of different kinds are combined with logical AND.

参数:
  • cond -- Register name (str) or ID (int) to condition on.

  • conds -- List of register names or IDs for multi-condition.

返回:

Self, for method chaining.

  1. conditioned_by_all_ones(self: pysparq._core.And_UInt_UInt, conds: collections.abc.Sequence[str]) -> pysparq._core.And_UInt_UInt

Condition this operation on registers where all bits are 1.

Calling this method replaces prior all-ones conditions. Pass the list overload to require several registers simultaneously; conditions of different kinds are combined with logical AND.

参数:
  • cond -- Register name (str) or ID (int) to condition on.

  • conds -- List of register names or IDs for multi-condition.

返回:

Self, for method chaining.

  1. conditioned_by_all_ones(self: pysparq._core.And_UInt_UInt, cond: typing.SupportsInt | typing.SupportsIndex) -> pysparq._core.And_UInt_UInt

Condition this operation on registers where all bits are 1.

Calling this method replaces prior all-ones conditions. Pass the list overload to require several registers simultaneously; conditions of different kinds are combined with logical AND.

参数:
  • cond -- Register name (str) or ID (int) to condition on.

  • conds -- List of register names or IDs for multi-condition.

返回:

Self, for method chaining.

  1. conditioned_by_all_ones(self: pysparq._core.And_UInt_UInt, conds: collections.abc.Sequence[typing.SupportsInt | typing.SupportsIndex]) -> pysparq._core.And_UInt_UInt

Condition this operation on registers where all bits are 1.

Calling this method replaces prior all-ones conditions. Pass the list overload to require several registers simultaneously; conditions of different kinds are combined with logical AND.

参数:
  • cond -- Register name (str) or ID (int) to condition on.

  • conds -- List of register names or IDs for multi-condition.

返回:

Self, for method chaining.

conditioned_by_bit(*args, **kwargs)

Overloaded function.

  1. conditioned_by_bit(self: pysparq._core.And_UInt_UInt, cond: str, pos: typing.SupportsInt | typing.SupportsIndex) -> pysparq._core.And_UInt_UInt

Condition this operation on a specific bit position.

Calling this method replaces prior bit conditions. Pass the list-of-pairs overload to require several bits simultaneously; conditions of different kinds are combined with logical AND.

参数:
  • cond -- Register name (str) or ID (int).

  • pos -- Bit position to check (0-indexed).

  • conds -- List of (register, position) pairs.

返回:

Self, for method chaining.

  1. conditioned_by_bit(self: pysparq._core.And_UInt_UInt, conds: collections.abc.Sequence[tuple[str, typing.SupportsInt | typing.SupportsIndex]]) -> pysparq._core.And_UInt_UInt

Condition this operation on a specific bit position.

Calling this method replaces prior bit conditions. Pass the list-of-pairs overload to require several bits simultaneously; conditions of different kinds are combined with logical AND.

参数:
  • cond -- Register name (str) or ID (int).

  • pos -- Bit position to check (0-indexed).

  • conds -- List of (register, position) pairs.

返回:

Self, for method chaining.

  1. conditioned_by_bit(self: pysparq._core.And_UInt_UInt, cond: typing.SupportsInt | typing.SupportsIndex, pos: typing.SupportsInt | typing.SupportsIndex) -> pysparq._core.And_UInt_UInt

Condition this operation on a specific bit position.

Calling this method replaces prior bit conditions. Pass the list-of-pairs overload to require several bits simultaneously; conditions of different kinds are combined with logical AND.

参数:
  • cond -- Register name (str) or ID (int).

  • pos -- Bit position to check (0-indexed).

  • conds -- List of (register, position) pairs.

返回:

Self, for method chaining.

  1. conditioned_by_bit(self: pysparq._core.And_UInt_UInt, conds: collections.abc.Sequence[tuple[typing.SupportsInt | typing.SupportsIndex, typing.SupportsInt | typing.SupportsIndex]]) -> pysparq._core.And_UInt_UInt

Condition this operation on a specific bit position.

Calling this method replaces prior bit conditions. Pass the list-of-pairs overload to require several bits simultaneously; conditions of different kinds are combined with logical AND.

参数:
  • cond -- Register name (str) or ID (int).

  • pos -- Bit position to check (0-indexed).

  • conds -- List of (register, position) pairs.

返回:

Self, for method chaining.

conditioned_by_nonzeros(*args, **kwargs)

Overloaded function.

  1. conditioned_by_nonzeros(self: pysparq._core.And_UInt_UInt, cond: str) -> pysparq._core.And_UInt_UInt

Condition this operation on registers with nonzero values.

Calling this method replaces prior nonzero-register conditions. Pass the list overload to require several registers simultaneously; conditions of different kinds are combined with logical AND.

参数:
  • cond -- Register name (str) or ID (int) to condition on.

  • conds -- List of register names or IDs for multi-condition.

返回:

Self, for method chaining.

示例

op.conditioned_by_nonzeros('control_reg')(state)

  1. conditioned_by_nonzeros(self: pysparq._core.And_UInt_UInt, conds: collections.abc.Sequence[str]) -> pysparq._core.And_UInt_UInt

Condition this operation on registers with nonzero values.

Calling this method replaces prior nonzero-register conditions. Pass the list overload to require several registers simultaneously; conditions of different kinds are combined with logical AND.

参数:
  • cond -- Register name (str) or ID (int) to condition on.

  • conds -- List of register names or IDs for multi-condition.

返回:

Self, for method chaining.

示例

op.conditioned_by_nonzeros('control_reg')(state)

  1. conditioned_by_nonzeros(self: pysparq._core.And_UInt_UInt, cond: typing.SupportsInt | typing.SupportsIndex) -> pysparq._core.And_UInt_UInt

Condition this operation on registers with nonzero values.

Calling this method replaces prior nonzero-register conditions. Pass the list overload to require several registers simultaneously; conditions of different kinds are combined with logical AND.

参数:
  • cond -- Register name (str) or ID (int) to condition on.

  • conds -- List of register names or IDs for multi-condition.

返回:

Self, for method chaining.

示例

op.conditioned_by_nonzeros('control_reg')(state)

  1. conditioned_by_nonzeros(self: pysparq._core.And_UInt_UInt, conds: collections.abc.Sequence[typing.SupportsInt | typing.SupportsIndex]) -> pysparq._core.And_UInt_UInt

Condition this operation on registers with nonzero values.

Calling this method replaces prior nonzero-register conditions. Pass the list overload to require several registers simultaneously; conditions of different kinds are combined with logical AND.

参数:
  • cond -- Register name (str) or ID (int) to condition on.

  • conds -- List of register names or IDs for multi-condition.

返回:

Self, for method chaining.

示例

op.conditioned_by_nonzeros('control_reg')(state)

conditioned_by_value(*args, **kwargs)

Overloaded function.

  1. conditioned_by_value(self: pysparq._core.And_UInt_UInt, cond: str, pos: typing.SupportsInt | typing.SupportsIndex) -> pysparq._core.And_UInt_UInt

Condition this operation on registers holding a specific value.

Calling this method replaces prior value conditions. Pass the list-of-pairs overload to require several values simultaneously; conditions of different kinds are combined with logical AND.

参数:
  • cond -- Register name (str) or ID (int).

  • pos -- Value to match.

  • conds -- List of (register, value) pairs.

返回:

Self, for method chaining.

  1. conditioned_by_value(self: pysparq._core.And_UInt_UInt, conds: collections.abc.Sequence[tuple[str, typing.SupportsInt | typing.SupportsIndex]]) -> pysparq._core.And_UInt_UInt

Condition this operation on registers holding a specific value.

Calling this method replaces prior value conditions. Pass the list-of-pairs overload to require several values simultaneously; conditions of different kinds are combined with logical AND.

参数:
  • cond -- Register name (str) or ID (int).

  • pos -- Value to match.

  • conds -- List of (register, value) pairs.

返回:

Self, for method chaining.

  1. conditioned_by_value(self: pysparq._core.And_UInt_UInt, cond: typing.SupportsInt | typing.SupportsIndex, pos: typing.SupportsInt | typing.SupportsIndex) -> pysparq._core.And_UInt_UInt

Condition this operation on registers holding a specific value.

Calling this method replaces prior value conditions. Pass the list-of-pairs overload to require several values simultaneously; conditions of different kinds are combined with logical AND.

参数:
  • cond -- Register name (str) or ID (int).

  • pos -- Value to match.

  • conds -- List of (register, value) pairs.

返回:

Self, for method chaining.

  1. conditioned_by_value(self: pysparq._core.And_UInt_UInt, conds: collections.abc.Sequence[tuple[typing.SupportsInt | typing.SupportsIndex, typing.SupportsInt | typing.SupportsIndex]]) -> pysparq._core.And_UInt_UInt

Condition this operation on registers holding a specific value.

Calling this method replaces prior value conditions. Pass the list-of-pairs overload to require several values simultaneously; conditions of different kinds are combined with logical AND.

参数:
  • cond -- Register name (str) or ID (int).

  • pos -- Value to match.

  • conds -- List of (register, value) pairs.

返回:

Self, for method chaining.

class pysparq.Or_UInt_UInt

Bitwise OR of two unsigned integer registers.

Computes: res ^= lhs | rhs, operands zero-extended, result truncated to mod 2^res_width before being XORed into res.

参数:
  • lhs -- Name/ID of the first input register.

  • rhs -- Name/ID of the second input register.

  • res -- Name/ID of the output register (result is XORed in).

示例

Or_UInt_UInt("a", "b", "result")(state) # result ^= a | b

clear_control_all_ones(self: pysparq._core.Or_UInt_UInt) → None

Clear all control conditions of the specified type.

clear_control_by_bit(self: pysparq._core.Or_UInt_UInt) → None

Clear all control conditions of the specified type.

clear_control_by_value(self: pysparq._core.Or_UInt_UInt) → None

Clear all control conditions of the specified type.

clear_control_nonzeros(self: pysparq._core.Or_UInt_UInt) → None

Clear all control conditions of the specified type.

property condition_variable_all_ones
property condition_variable_by_bit
property condition_variable_by_value
property condition_variable_nonzeros
conditioned_by_all_ones(*args, **kwargs)

Overloaded function.

  1. conditioned_by_all_ones(self: pysparq._core.Or_UInt_UInt, cond: str) -> pysparq._core.Or_UInt_UInt

Condition this operation on registers where all bits are 1.

Calling this method replaces prior all-ones conditions. Pass the list overload to require several registers simultaneously; conditions of different kinds are combined with logical AND.

参数:
  • cond -- Register name (str) or ID (int) to condition on.

  • conds -- List of register names or IDs for multi-condition.

返回:

Self, for method chaining.

  1. conditioned_by_all_ones(self: pysparq._core.Or_UInt_UInt, conds: collections.abc.Sequence[str]) -> pysparq._core.Or_UInt_UInt

Condition this operation on registers where all bits are 1.

Calling this method replaces prior all-ones conditions. Pass the list overload to require several registers simultaneously; conditions of different kinds are combined with logical AND.

参数:
  • cond -- Register name (str) or ID (int) to condition on.

  • conds -- List of register names or IDs for multi-condition.

返回:

Self, for method chaining.

  1. conditioned_by_all_ones(self: pysparq._core.Or_UInt_UInt, cond: typing.SupportsInt | typing.SupportsIndex) -> pysparq._core.Or_UInt_UInt

Condition this operation on registers where all bits are 1.

Calling this method replaces prior all-ones conditions. Pass the list overload to require several registers simultaneously; conditions of different kinds are combined with logical AND.

参数:
  • cond -- Register name (str) or ID (int) to condition on.

  • conds -- List of register names or IDs for multi-condition.

返回:

Self, for method chaining.

  1. conditioned_by_all_ones(self: pysparq._core.Or_UInt_UInt, conds: collections.abc.Sequence[typing.SupportsInt | typing.SupportsIndex]) -> pysparq._core.Or_UInt_UInt

Condition this operation on registers where all bits are 1.

Calling this method replaces prior all-ones conditions. Pass the list overload to require several registers simultaneously; conditions of different kinds are combined with logical AND.

参数:
  • cond -- Register name (str) or ID (int) to condition on.

  • conds -- List of register names or IDs for multi-condition.

返回:

Self, for method chaining.

conditioned_by_bit(*args, **kwargs)

Overloaded function.

  1. conditioned_by_bit(self: pysparq._core.Or_UInt_UInt, cond: str, pos: typing.SupportsInt | typing.SupportsIndex) -> pysparq._core.Or_UInt_UInt

Condition this operation on a specific bit position.

Calling this method replaces prior bit conditions. Pass the list-of-pairs overload to require several bits simultaneously; conditions of different kinds are combined with logical AND.

参数:
  • cond -- Register name (str) or ID (int).

  • pos -- Bit position to check (0-indexed).

  • conds -- List of (register, position) pairs.

返回:

Self, for method chaining.

  1. conditioned_by_bit(self: pysparq._core.Or_UInt_UInt, conds: collections.abc.Sequence[tuple[str, typing.SupportsInt | typing.SupportsIndex]]) -> pysparq._core.Or_UInt_UInt

Condition this operation on a specific bit position.

Calling this method replaces prior bit conditions. Pass the list-of-pairs overload to require several bits simultaneously; conditions of different kinds are combined with logical AND.

参数:
  • cond -- Register name (str) or ID (int).

  • pos -- Bit position to check (0-indexed).

  • conds -- List of (register, position) pairs.

返回:

Self, for method chaining.

  1. conditioned_by_bit(self: pysparq._core.Or_UInt_UInt, cond: typing.SupportsInt | typing.SupportsIndex, pos: typing.SupportsInt | typing.SupportsIndex) -> pysparq._core.Or_UInt_UInt

Condition this operation on a specific bit position.

Calling this method replaces prior bit conditions. Pass the list-of-pairs overload to require several bits simultaneously; conditions of different kinds are combined with logical AND.

参数:
  • cond -- Register name (str) or ID (int).

  • pos -- Bit position to check (0-indexed).

  • conds -- List of (register, position) pairs.

返回:

Self, for method chaining.

  1. conditioned_by_bit(self: pysparq._core.Or_UInt_UInt, conds: collections.abc.Sequence[tuple[typing.SupportsInt | typing.SupportsIndex, typing.SupportsInt | typing.SupportsIndex]]) -> pysparq._core.Or_UInt_UInt

Condition this operation on a specific bit position.

Calling this method replaces prior bit conditions. Pass the list-of-pairs overload to require several bits simultaneously; conditions of different kinds are combined with logical AND.

参数:
  • cond -- Register name (str) or ID (int).

  • pos -- Bit position to check (0-indexed).

  • conds -- List of (register, position) pairs.

返回:

Self, for method chaining.

conditioned_by_nonzeros(*args, **kwargs)

Overloaded function.

  1. conditioned_by_nonzeros(self: pysparq._core.Or_UInt_UInt, cond: str) -> pysparq._core.Or_UInt_UInt

Condition this operation on registers with nonzero values.

Calling this method replaces prior nonzero-register conditions. Pass the list overload to require several registers simultaneously; conditions of different kinds are combined with logical AND.

参数:
  • cond -- Register name (str) or ID (int) to condition on.

  • conds -- List of register names or IDs for multi-condition.

返回:

Self, for method chaining.

示例

op.conditioned_by_nonzeros('control_reg')(state)

  1. conditioned_by_nonzeros(self: pysparq._core.Or_UInt_UInt, conds: collections.abc.Sequence[str]) -> pysparq._core.Or_UInt_UInt

Condition this operation on registers with nonzero values.

Calling this method replaces prior nonzero-register conditions. Pass the list overload to require several registers simultaneously; conditions of different kinds are combined with logical AND.

参数:
  • cond -- Register name (str) or ID (int) to condition on.

  • conds -- List of register names or IDs for multi-condition.

返回:

Self, for method chaining.

示例

op.conditioned_by_nonzeros('control_reg')(state)

  1. conditioned_by_nonzeros(self: pysparq._core.Or_UInt_UInt, cond: typing.SupportsInt | typing.SupportsIndex) -> pysparq._core.Or_UInt_UInt

Condition this operation on registers with nonzero values.

Calling this method replaces prior nonzero-register conditions. Pass the list overload to require several registers simultaneously; conditions of different kinds are combined with logical AND.

参数:
  • cond -- Register name (str) or ID (int) to condition on.

  • conds -- List of register names or IDs for multi-condition.

返回:

Self, for method chaining.

示例

op.conditioned_by_nonzeros('control_reg')(state)

  1. conditioned_by_nonzeros(self: pysparq._core.Or_UInt_UInt, conds: collections.abc.Sequence[typing.SupportsInt | typing.SupportsIndex]) -> pysparq._core.Or_UInt_UInt

Condition this operation on registers with nonzero values.

Calling this method replaces prior nonzero-register conditions. Pass the list overload to require several registers simultaneously; conditions of different kinds are combined with logical AND.

参数:
  • cond -- Register name (str) or ID (int) to condition on.

  • conds -- List of register names or IDs for multi-condition.

返回:

Self, for method chaining.

示例

op.conditioned_by_nonzeros('control_reg')(state)

conditioned_by_value(*args, **kwargs)

Overloaded function.

  1. conditioned_by_value(self: pysparq._core.Or_UInt_UInt, cond: str, pos: typing.SupportsInt | typing.SupportsIndex) -> pysparq._core.Or_UInt_UInt

Condition this operation on registers holding a specific value.

Calling this method replaces prior value conditions. Pass the list-of-pairs overload to require several values simultaneously; conditions of different kinds are combined with logical AND.

参数:
  • cond -- Register name (str) or ID (int).

  • pos -- Value to match.

  • conds -- List of (register, value) pairs.

返回:

Self, for method chaining.

  1. conditioned_by_value(self: pysparq._core.Or_UInt_UInt, conds: collections.abc.Sequence[tuple[str, typing.SupportsInt | typing.SupportsIndex]]) -> pysparq._core.Or_UInt_UInt

Condition this operation on registers holding a specific value.

Calling this method replaces prior value conditions. Pass the list-of-pairs overload to require several values simultaneously; conditions of different kinds are combined with logical AND.

参数:
  • cond -- Register name (str) or ID (int).

  • pos -- Value to match.

  • conds -- List of (register, value) pairs.

返回:

Self, for method chaining.

  1. conditioned_by_value(self: pysparq._core.Or_UInt_UInt, cond: typing.SupportsInt | typing.SupportsIndex, pos: typing.SupportsInt | typing.SupportsIndex) -> pysparq._core.Or_UInt_UInt

Condition this operation on registers holding a specific value.

Calling this method replaces prior value conditions. Pass the list-of-pairs overload to require several values simultaneously; conditions of different kinds are combined with logical AND.

参数:
  • cond -- Register name (str) or ID (int).

  • pos -- Value to match.

  • conds -- List of (register, value) pairs.

返回:

Self, for method chaining.

  1. conditioned_by_value(self: pysparq._core.Or_UInt_UInt, conds: collections.abc.Sequence[tuple[typing.SupportsInt | typing.SupportsIndex, typing.SupportsInt | typing.SupportsIndex]]) -> pysparq._core.Or_UInt_UInt

Condition this operation on registers holding a specific value.

Calling this method replaces prior value conditions. Pass the list-of-pairs overload to require several values simultaneously; conditions of different kinds are combined with logical AND.

参数:
  • cond -- Register name (str) or ID (int).

  • pos -- Value to match.

  • conds -- List of (register, value) pairs.

返回:

Self, for method chaining.

class pysparq.Xor_UInt_UInt

Bitwise XOR of two unsigned integer registers.

Computes: res ^= lhs ^ rhs, operands zero-extended, result truncated to mod 2^res_width before being XORed into res.

参数:
  • lhs -- Name/ID of the first input register.

  • rhs -- Name/ID of the second input register.

  • res -- Name/ID of the output register (result is XORed in).

示例

Xor_UInt_UInt("a", "b", "result")(state) # result ^= a ^ b

clear_control_all_ones(self: pysparq._core.Xor_UInt_UInt) → None

Clear all control conditions of the specified type.

clear_control_by_bit(self: pysparq._core.Xor_UInt_UInt) → None

Clear all control conditions of the specified type.

clear_control_by_value(self: pysparq._core.Xor_UInt_UInt) → None

Clear all control conditions of the specified type.

clear_control_nonzeros(self: pysparq._core.Xor_UInt_UInt) → None

Clear all control conditions of the specified type.

property condition_variable_all_ones
property condition_variable_by_bit
property condition_variable_by_value
property condition_variable_nonzeros
conditioned_by_all_ones(*args, **kwargs)

Overloaded function.

  1. conditioned_by_all_ones(self: pysparq._core.Xor_UInt_UInt, cond: str) -> pysparq._core.Xor_UInt_UInt

Condition this operation on registers where all bits are 1.

Calling this method replaces prior all-ones conditions. Pass the list overload to require several registers simultaneously; conditions of different kinds are combined with logical AND.

参数:
  • cond -- Register name (str) or ID (int) to condition on.

  • conds -- List of register names or IDs for multi-condition.

返回:

Self, for method chaining.

  1. conditioned_by_all_ones(self: pysparq._core.Xor_UInt_UInt, conds: collections.abc.Sequence[str]) -> pysparq._core.Xor_UInt_UInt

Condition this operation on registers where all bits are 1.

Calling this method replaces prior all-ones conditions. Pass the list overload to require several registers simultaneously; conditions of different kinds are combined with logical AND.

参数:
  • cond -- Register name (str) or ID (int) to condition on.

  • conds -- List of register names or IDs for multi-condition.

返回:

Self, for method chaining.

  1. conditioned_by_all_ones(self: pysparq._core.Xor_UInt_UInt, cond: typing.SupportsInt | typing.SupportsIndex) -> pysparq._core.Xor_UInt_UInt

Condition this operation on registers where all bits are 1.

Calling this method replaces prior all-ones conditions. Pass the list overload to require several registers simultaneously; conditions of different kinds are combined with logical AND.

参数:
  • cond -- Register name (str) or ID (int) to condition on.

  • conds -- List of register names or IDs for multi-condition.

返回:

Self, for method chaining.

  1. conditioned_by_all_ones(self: pysparq._core.Xor_UInt_UInt, conds: collections.abc.Sequence[typing.SupportsInt | typing.SupportsIndex]) -> pysparq._core.Xor_UInt_UInt

Condition this operation on registers where all bits are 1.

Calling this method replaces prior all-ones conditions. Pass the list overload to require several registers simultaneously; conditions of different kinds are combined with logical AND.

参数:
  • cond -- Register name (str) or ID (int) to condition on.

  • conds -- List of register names or IDs for multi-condition.

返回:

Self, for method chaining.

conditioned_by_bit(*args, **kwargs)

Overloaded function.

  1. conditioned_by_bit(self: pysparq._core.Xor_UInt_UInt, cond: str, pos: typing.SupportsInt | typing.SupportsIndex) -> pysparq._core.Xor_UInt_UInt

Condition this operation on a specific bit position.

Calling this method replaces prior bit conditions. Pass the list-of-pairs overload to require several bits simultaneously; conditions of different kinds are combined with logical AND.

参数:
  • cond -- Register name (str) or ID (int).

  • pos -- Bit position to check (0-indexed).

  • conds -- List of (register, position) pairs.

返回:

Self, for method chaining.

  1. conditioned_by_bit(self: pysparq._core.Xor_UInt_UInt, conds: collections.abc.Sequence[tuple[str, typing.SupportsInt | typing.SupportsIndex]]) -> pysparq._core.Xor_UInt_UInt

Condition this operation on a specific bit position.

Calling this method replaces prior bit conditions. Pass the list-of-pairs overload to require several bits simultaneously; conditions of different kinds are combined with logical AND.

参数:
  • cond -- Register name (str) or ID (int).

  • pos -- Bit position to check (0-indexed).

  • conds -- List of (register, position) pairs.

返回:

Self, for method chaining.

  1. conditioned_by_bit(self: pysparq._core.Xor_UInt_UInt, cond: typing.SupportsInt | typing.SupportsIndex, pos: typing.SupportsInt | typing.SupportsIndex) -> pysparq._core.Xor_UInt_UInt

Condition this operation on a specific bit position.

Calling this method replaces prior bit conditions. Pass the list-of-pairs overload to require several bits simultaneously; conditions of different kinds are combined with logical AND.

参数:
  • cond -- Register name (str) or ID (int).

  • pos -- Bit position to check (0-indexed).

  • conds -- List of (register, position) pairs.

返回:

Self, for method chaining.

  1. conditioned_by_bit(self: pysparq._core.Xor_UInt_UInt, conds: collections.abc.Sequence[tuple[typing.SupportsInt | typing.SupportsIndex, typing.SupportsInt | typing.SupportsIndex]]) -> pysparq._core.Xor_UInt_UInt

Condition this operation on a specific bit position.

Calling this method replaces prior bit conditions. Pass the list-of-pairs overload to require several bits simultaneously; conditions of different kinds are combined with logical AND.

参数:
  • cond -- Register name (str) or ID (int).

  • pos -- Bit position to check (0-indexed).

  • conds -- List of (register, position) pairs.

返回:

Self, for method chaining.

conditioned_by_nonzeros(*args, **kwargs)

Overloaded function.

  1. conditioned_by_nonzeros(self: pysparq._core.Xor_UInt_UInt, cond: str) -> pysparq._core.Xor_UInt_UInt

Condition this operation on registers with nonzero values.

Calling this method replaces prior nonzero-register conditions. Pass the list overload to require several registers simultaneously; conditions of different kinds are combined with logical AND.

参数:
  • cond -- Register name (str) or ID (int) to condition on.

  • conds -- List of register names or IDs for multi-condition.

返回:

Self, for method chaining.

示例

op.conditioned_by_nonzeros('control_reg')(state)

  1. conditioned_by_nonzeros(self: pysparq._core.Xor_UInt_UInt, conds: collections.abc.Sequence[str]) -> pysparq._core.Xor_UInt_UInt

Condition this operation on registers with nonzero values.

Calling this method replaces prior nonzero-register conditions. Pass the list overload to require several registers simultaneously; conditions of different kinds are combined with logical AND.

参数:
  • cond -- Register name (str) or ID (int) to condition on.

  • conds -- List of register names or IDs for multi-condition.

返回:

Self, for method chaining.

示例

op.conditioned_by_nonzeros('control_reg')(state)

  1. conditioned_by_nonzeros(self: pysparq._core.Xor_UInt_UInt, cond: typing.SupportsInt | typing.SupportsIndex) -> pysparq._core.Xor_UInt_UInt

Condition this operation on registers with nonzero values.

Calling this method replaces prior nonzero-register conditions. Pass the list overload to require several registers simultaneously; conditions of different kinds are combined with logical AND.

参数:
  • cond -- Register name (str) or ID (int) to condition on.

  • conds -- List of register names or IDs for multi-condition.

返回:

Self, for method chaining.

示例

op.conditioned_by_nonzeros('control_reg')(state)

  1. conditioned_by_nonzeros(self: pysparq._core.Xor_UInt_UInt, conds: collections.abc.Sequence[typing.SupportsInt | typing.SupportsIndex]) -> pysparq._core.Xor_UInt_UInt

Condition this operation on registers with nonzero values.

Calling this method replaces prior nonzero-register conditions. Pass the list overload to require several registers simultaneously; conditions of different kinds are combined with logical AND.

参数:
  • cond -- Register name (str) or ID (int) to condition on.

  • conds -- List of register names or IDs for multi-condition.

返回:

Self, for method chaining.

示例

op.conditioned_by_nonzeros('control_reg')(state)

conditioned_by_value(*args, **kwargs)

Overloaded function.

  1. conditioned_by_value(self: pysparq._core.Xor_UInt_UInt, cond: str, pos: typing.SupportsInt | typing.SupportsIndex) -> pysparq._core.Xor_UInt_UInt

Condition this operation on registers holding a specific value.

Calling this method replaces prior value conditions. Pass the list-of-pairs overload to require several values simultaneously; conditions of different kinds are combined with logical AND.

参数:
  • cond -- Register name (str) or ID (int).

  • pos -- Value to match.

  • conds -- List of (register, value) pairs.

返回:

Self, for method chaining.

  1. conditioned_by_value(self: pysparq._core.Xor_UInt_UInt, conds: collections.abc.Sequence[tuple[str, typing.SupportsInt | typing.SupportsIndex]]) -> pysparq._core.Xor_UInt_UInt

Condition this operation on registers holding a specific value.

Calling this method replaces prior value conditions. Pass the list-of-pairs overload to require several values simultaneously; conditions of different kinds are combined with logical AND.

参数:
  • cond -- Register name (str) or ID (int).

  • pos -- Value to match.

  • conds -- List of (register, value) pairs.

返回:

Self, for method chaining.

  1. conditioned_by_value(self: pysparq._core.Xor_UInt_UInt, cond: typing.SupportsInt | typing.SupportsIndex, pos: typing.SupportsInt | typing.SupportsIndex) -> pysparq._core.Xor_UInt_UInt

Condition this operation on registers holding a specific value.

Calling this method replaces prior value conditions. Pass the list-of-pairs overload to require several values simultaneously; conditions of different kinds are combined with logical AND.

参数:
  • cond -- Register name (str) or ID (int).

  • pos -- Value to match.

  • conds -- List of (register, value) pairs.

返回:

Self, for method chaining.

  1. conditioned_by_value(self: pysparq._core.Xor_UInt_UInt, conds: collections.abc.Sequence[tuple[typing.SupportsInt | typing.SupportsIndex, typing.SupportsInt | typing.SupportsIndex]]) -> pysparq._core.Xor_UInt_UInt

Condition this operation on registers holding a specific value.

Calling this method replaces prior value conditions. Pass the list-of-pairs overload to require several values simultaneously; conditions of different kinds are combined with logical AND.

参数:
  • cond -- Register name (str) or ID (int).

  • pos -- Value to match.

  • conds -- List of (register, value) pairs.

返回:

Self, for method chaining.

class pysparq.Less_SInt_SInt

Signed less-than comparison of two signed integer registers.

Computes: flag ^= (lhs < rhs), where both operands are sign-extended to the full-precision comparison domain (64-bit) before comparing.

参数:
  • lhs -- Name/ID of the SignedInteger left operand register.

  • rhs -- Name/ID of the SignedInteger right operand register.

  • flag -- Name/ID of the width-1 Boolean flag register (result is XORed in).

示例

Less_SInt_SInt("a", "b", "flag")(state) # flag ^= (a < b)

clear_control_all_ones(self: pysparq._core.Less_SInt_SInt) → None

Clear all control conditions of the specified type.

clear_control_by_bit(self: pysparq._core.Less_SInt_SInt) → None

Clear all control conditions of the specified type.

clear_control_by_value(self: pysparq._core.Less_SInt_SInt) → None

Clear all control conditions of the specified type.

clear_control_nonzeros(self: pysparq._core.Less_SInt_SInt) → None

Clear all control conditions of the specified type.

property condition_variable_all_ones
property condition_variable_by_bit
property condition_variable_by_value
property condition_variable_nonzeros
conditioned_by_all_ones(*args, **kwargs)

Overloaded function.

  1. conditioned_by_all_ones(self: pysparq._core.Less_SInt_SInt, cond: str) -> pysparq._core.Less_SInt_SInt

Condition this operation on registers where all bits are 1.

Calling this method replaces prior all-ones conditions. Pass the list overload to require several registers simultaneously; conditions of different kinds are combined with logical AND.

参数:
  • cond -- Register name (str) or ID (int) to condition on.

  • conds -- List of register names or IDs for multi-condition.

返回:

Self, for method chaining.

  1. conditioned_by_all_ones(self: pysparq._core.Less_SInt_SInt, conds: collections.abc.Sequence[str]) -> pysparq._core.Less_SInt_SInt

Condition this operation on registers where all bits are 1.

Calling this method replaces prior all-ones conditions. Pass the list overload to require several registers simultaneously; conditions of different kinds are combined with logical AND.

参数:
  • cond -- Register name (str) or ID (int) to condition on.

  • conds -- List of register names or IDs for multi-condition.

返回:

Self, for method chaining.

  1. conditioned_by_all_ones(self: pysparq._core.Less_SInt_SInt, cond: typing.SupportsInt | typing.SupportsIndex) -> pysparq._core.Less_SInt_SInt

Condition this operation on registers where all bits are 1.

Calling this method replaces prior all-ones conditions. Pass the list overload to require several registers simultaneously; conditions of different kinds are combined with logical AND.

参数:
  • cond -- Register name (str) or ID (int) to condition on.

  • conds -- List of register names or IDs for multi-condition.

返回:

Self, for method chaining.

  1. conditioned_by_all_ones(self: pysparq._core.Less_SInt_SInt, conds: collections.abc.Sequence[typing.SupportsInt | typing.SupportsIndex]) -> pysparq._core.Less_SInt_SInt

Condition this operation on registers where all bits are 1.

Calling this method replaces prior all-ones conditions. Pass the list overload to require several registers simultaneously; conditions of different kinds are combined with logical AND.

参数:
  • cond -- Register name (str) or ID (int) to condition on.

  • conds -- List of register names or IDs for multi-condition.

返回:

Self, for method chaining.

conditioned_by_bit(*args, **kwargs)

Overloaded function.

  1. conditioned_by_bit(self: pysparq._core.Less_SInt_SInt, cond: str, pos: typing.SupportsInt | typing.SupportsIndex) -> pysparq._core.Less_SInt_SInt

Condition this operation on a specific bit position.

Calling this method replaces prior bit conditions. Pass the list-of-pairs overload to require several bits simultaneously; conditions of different kinds are combined with logical AND.

参数:
  • cond -- Register name (str) or ID (int).

  • pos -- Bit position to check (0-indexed).

  • conds -- List of (register, position) pairs.

返回:

Self, for method chaining.

  1. conditioned_by_bit(self: pysparq._core.Less_SInt_SInt, conds: collections.abc.Sequence[tuple[str, typing.SupportsInt | typing.SupportsIndex]]) -> pysparq._core.Less_SInt_SInt

Condition this operation on a specific bit position.

Calling this method replaces prior bit conditions. Pass the list-of-pairs overload to require several bits simultaneously; conditions of different kinds are combined with logical AND.

参数:
  • cond -- Register name (str) or ID (int).

  • pos -- Bit position to check (0-indexed).

  • conds -- List of (register, position) pairs.

返回:

Self, for method chaining.

  1. conditioned_by_bit(self: pysparq._core.Less_SInt_SInt, cond: typing.SupportsInt | typing.SupportsIndex, pos: typing.SupportsInt | typing.SupportsIndex) -> pysparq._core.Less_SInt_SInt

Condition this operation on a specific bit position.

Calling this method replaces prior bit conditions. Pass the list-of-pairs overload to require several bits simultaneously; conditions of different kinds are combined with logical AND.

参数:
  • cond -- Register name (str) or ID (int).

  • pos -- Bit position to check (0-indexed).

  • conds -- List of (register, position) pairs.

返回:

Self, for method chaining.

  1. conditioned_by_bit(self: pysparq._core.Less_SInt_SInt, conds: collections.abc.Sequence[tuple[typing.SupportsInt | typing.SupportsIndex, typing.SupportsInt | typing.SupportsIndex]]) -> pysparq._core.Less_SInt_SInt

Condition this operation on a specific bit position.

Calling this method replaces prior bit conditions. Pass the list-of-pairs overload to require several bits simultaneously; conditions of different kinds are combined with logical AND.

参数:
  • cond -- Register name (str) or ID (int).

  • pos -- Bit position to check (0-indexed).

  • conds -- List of (register, position) pairs.

返回:

Self, for method chaining.

conditioned_by_nonzeros(*args, **kwargs)

Overloaded function.

  1. conditioned_by_nonzeros(self: pysparq._core.Less_SInt_SInt, cond: str) -> pysparq._core.Less_SInt_SInt

Condition this operation on registers with nonzero values.

Calling this method replaces prior nonzero-register conditions. Pass the list overload to require several registers simultaneously; conditions of different kinds are combined with logical AND.

参数:
  • cond -- Register name (str) or ID (int) to condition on.

  • conds -- List of register names or IDs for multi-condition.

返回:

Self, for method chaining.

示例

op.conditioned_by_nonzeros('control_reg')(state)

  1. conditioned_by_nonzeros(self: pysparq._core.Less_SInt_SInt, conds: collections.abc.Sequence[str]) -> pysparq._core.Less_SInt_SInt

Condition this operation on registers with nonzero values.

Calling this method replaces prior nonzero-register conditions. Pass the list overload to require several registers simultaneously; conditions of different kinds are combined with logical AND.

参数:
  • cond -- Register name (str) or ID (int) to condition on.

  • conds -- List of register names or IDs for multi-condition.

返回:

Self, for method chaining.

示例

op.conditioned_by_nonzeros('control_reg')(state)

  1. conditioned_by_nonzeros(self: pysparq._core.Less_SInt_SInt, cond: typing.SupportsInt | typing.SupportsIndex) -> pysparq._core.Less_SInt_SInt

Condition this operation on registers with nonzero values.

Calling this method replaces prior nonzero-register conditions. Pass the list overload to require several registers simultaneously; conditions of different kinds are combined with logical AND.

参数:
  • cond -- Register name (str) or ID (int) to condition on.

  • conds -- List of register names or IDs for multi-condition.

返回:

Self, for method chaining.

示例

op.conditioned_by_nonzeros('control_reg')(state)

  1. conditioned_by_nonzeros(self: pysparq._core.Less_SInt_SInt, conds: collections.abc.Sequence[typing.SupportsInt | typing.SupportsIndex]) -> pysparq._core.Less_SInt_SInt

Condition this operation on registers with nonzero values.

Calling this method replaces prior nonzero-register conditions. Pass the list overload to require several registers simultaneously; conditions of different kinds are combined with logical AND.

参数:
  • cond -- Register name (str) or ID (int) to condition on.

  • conds -- List of register names or IDs for multi-condition.

返回:

Self, for method chaining.

示例

op.conditioned_by_nonzeros('control_reg')(state)

conditioned_by_value(*args, **kwargs)

Overloaded function.

  1. conditioned_by_value(self: pysparq._core.Less_SInt_SInt, cond: str, pos: typing.SupportsInt | typing.SupportsIndex) -> pysparq._core.Less_SInt_SInt

Condition this operation on registers holding a specific value.

Calling this method replaces prior value conditions. Pass the list-of-pairs overload to require several values simultaneously; conditions of different kinds are combined with logical AND.

参数:
  • cond -- Register name (str) or ID (int).

  • pos -- Value to match.

  • conds -- List of (register, value) pairs.

返回:

Self, for method chaining.

  1. conditioned_by_value(self: pysparq._core.Less_SInt_SInt, conds: collections.abc.Sequence[tuple[str, typing.SupportsInt | typing.SupportsIndex]]) -> pysparq._core.Less_SInt_SInt

Condition this operation on registers holding a specific value.

Calling this method replaces prior value conditions. Pass the list-of-pairs overload to require several values simultaneously; conditions of different kinds are combined with logical AND.

参数:
  • cond -- Register name (str) or ID (int).

  • pos -- Value to match.

  • conds -- List of (register, value) pairs.

返回:

Self, for method chaining.

  1. conditioned_by_value(self: pysparq._core.Less_SInt_SInt, cond: typing.SupportsInt | typing.SupportsIndex, pos: typing.SupportsInt | typing.SupportsIndex) -> pysparq._core.Less_SInt_SInt

Condition this operation on registers holding a specific value.

Calling this method replaces prior value conditions. Pass the list-of-pairs overload to require several values simultaneously; conditions of different kinds are combined with logical AND.

参数:
  • cond -- Register name (str) or ID (int).

  • pos -- Value to match.

  • conds -- List of (register, value) pairs.

返回:

Self, for method chaining.

  1. conditioned_by_value(self: pysparq._core.Less_SInt_SInt, conds: collections.abc.Sequence[tuple[typing.SupportsInt | typing.SupportsIndex, typing.SupportsInt | typing.SupportsIndex]]) -> pysparq._core.Less_SInt_SInt

Condition this operation on registers holding a specific value.

Calling this method replaces prior value conditions. Pass the list-of-pairs overload to require several values simultaneously; conditions of different kinds are combined with logical AND.

参数:
  • cond -- Register name (str) or ID (int).

  • pos -- Value to match.

  • conds -- List of (register, value) pairs.

返回:

Self, for method chaining.

class pysparq.Carry_UInt_UInt

Carry-out flag of an unsigned addition at the res width.

Computes: flag ^= carry_out(lhs + rhs) relative to the width w of res, i.e. whether the full-precision sum is >= 2^w (at w = 64 the predicate is 64-bit wraparound). The out/res parameters only provide the width; their values are not read.

参数:
  • lhs -- Name/ID of the first input register.

  • rhs -- Name/ID of the second input register.

  • res -- Name/ID of the register providing the target width w (not read).

  • flag -- Name/ID of the width-1 Boolean flag register (result is XORed in).

示例

Carry_UInt_UInt("a", "b", "result", "flag")(state) # flag ^= carry of a+b at result width

clear_control_all_ones(self: pysparq._core.Carry_UInt_UInt) → None

Clear all control conditions of the specified type.

clear_control_by_bit(self: pysparq._core.Carry_UInt_UInt) → None

Clear all control conditions of the specified type.

clear_control_by_value(self: pysparq._core.Carry_UInt_UInt) → None

Clear all control conditions of the specified type.

clear_control_nonzeros(self: pysparq._core.Carry_UInt_UInt) → None

Clear all control conditions of the specified type.

property condition_variable_all_ones
property condition_variable_by_bit
property condition_variable_by_value
property condition_variable_nonzeros
conditioned_by_all_ones(*args, **kwargs)

Overloaded function.

  1. conditioned_by_all_ones(self: pysparq._core.Carry_UInt_UInt, cond: str) -> pysparq._core.Carry_UInt_UInt

Condition this operation on registers where all bits are 1.

Calling this method replaces prior all-ones conditions. Pass the list overload to require several registers simultaneously; conditions of different kinds are combined with logical AND.

参数:
  • cond -- Register name (str) or ID (int) to condition on.

  • conds -- List of register names or IDs for multi-condition.

返回:

Self, for method chaining.

  1. conditioned_by_all_ones(self: pysparq._core.Carry_UInt_UInt, conds: collections.abc.Sequence[str]) -> pysparq._core.Carry_UInt_UInt

Condition this operation on registers where all bits are 1.

Calling this method replaces prior all-ones conditions. Pass the list overload to require several registers simultaneously; conditions of different kinds are combined with logical AND.

参数:
  • cond -- Register name (str) or ID (int) to condition on.

  • conds -- List of register names or IDs for multi-condition.

返回:

Self, for method chaining.

  1. conditioned_by_all_ones(self: pysparq._core.Carry_UInt_UInt, cond: typing.SupportsInt | typing.SupportsIndex) -> pysparq._core.Carry_UInt_UInt

Condition this operation on registers where all bits are 1.

Calling this method replaces prior all-ones conditions. Pass the list overload to require several registers simultaneously; conditions of different kinds are combined with logical AND.

参数:
  • cond -- Register name (str) or ID (int) to condition on.

  • conds -- List of register names or IDs for multi-condition.

返回:

Self, for method chaining.

  1. conditioned_by_all_ones(self: pysparq._core.Carry_UInt_UInt, conds: collections.abc.Sequence[typing.SupportsInt | typing.SupportsIndex]) -> pysparq._core.Carry_UInt_UInt

Condition this operation on registers where all bits are 1.

Calling this method replaces prior all-ones conditions. Pass the list overload to require several registers simultaneously; conditions of different kinds are combined with logical AND.

参数:
  • cond -- Register name (str) or ID (int) to condition on.

  • conds -- List of register names or IDs for multi-condition.

返回:

Self, for method chaining.

conditioned_by_bit(*args, **kwargs)

Overloaded function.

  1. conditioned_by_bit(self: pysparq._core.Carry_UInt_UInt, cond: str, pos: typing.SupportsInt | typing.SupportsIndex) -> pysparq._core.Carry_UInt_UInt

Condition this operation on a specific bit position.

Calling this method replaces prior bit conditions. Pass the list-of-pairs overload to require several bits simultaneously; conditions of different kinds are combined with logical AND.

参数:
  • cond -- Register name (str) or ID (int).

  • pos -- Bit position to check (0-indexed).

  • conds -- List of (register, position) pairs.

返回:

Self, for method chaining.

  1. conditioned_by_bit(self: pysparq._core.Carry_UInt_UInt, conds: collections.abc.Sequence[tuple[str, typing.SupportsInt | typing.SupportsIndex]]) -> pysparq._core.Carry_UInt_UInt

Condition this operation on a specific bit position.

Calling this method replaces prior bit conditions. Pass the list-of-pairs overload to require several bits simultaneously; conditions of different kinds are combined with logical AND.

参数:
  • cond -- Register name (str) or ID (int).

  • pos -- Bit position to check (0-indexed).

  • conds -- List of (register, position) pairs.

返回:

Self, for method chaining.

  1. conditioned_by_bit(self: pysparq._core.Carry_UInt_UInt, cond: typing.SupportsInt | typing.SupportsIndex, pos: typing.SupportsInt | typing.SupportsIndex) -> pysparq._core.Carry_UInt_UInt

Condition this operation on a specific bit position.

Calling this method replaces prior bit conditions. Pass the list-of-pairs overload to require several bits simultaneously; conditions of different kinds are combined with logical AND.

参数:
  • cond -- Register name (str) or ID (int).

  • pos -- Bit position to check (0-indexed).

  • conds -- List of (register, position) pairs.

返回:

Self, for method chaining.

  1. conditioned_by_bit(self: pysparq._core.Carry_UInt_UInt, conds: collections.abc.Sequence[tuple[typing.SupportsInt | typing.SupportsIndex, typing.SupportsInt | typing.SupportsIndex]]) -> pysparq._core.Carry_UInt_UInt

Condition this operation on a specific bit position.

Calling this method replaces prior bit conditions. Pass the list-of-pairs overload to require several bits simultaneously; conditions of different kinds are combined with logical AND.

参数:
  • cond -- Register name (str) or ID (int).

  • pos -- Bit position to check (0-indexed).

  • conds -- List of (register, position) pairs.

返回:

Self, for method chaining.

conditioned_by_nonzeros(*args, **kwargs)

Overloaded function.

  1. conditioned_by_nonzeros(self: pysparq._core.Carry_UInt_UInt, cond: str) -> pysparq._core.Carry_UInt_UInt

Condition this operation on registers with nonzero values.

Calling this method replaces prior nonzero-register conditions. Pass the list overload to require several registers simultaneously; conditions of different kinds are combined with logical AND.

参数:
  • cond -- Register name (str) or ID (int) to condition on.

  • conds -- List of register names or IDs for multi-condition.

返回:

Self, for method chaining.

示例

op.conditioned_by_nonzeros('control_reg')(state)

  1. conditioned_by_nonzeros(self: pysparq._core.Carry_UInt_UInt, conds: collections.abc.Sequence[str]) -> pysparq._core.Carry_UInt_UInt

Condition this operation on registers with nonzero values.

Calling this method replaces prior nonzero-register conditions. Pass the list overload to require several registers simultaneously; conditions of different kinds are combined with logical AND.

参数:
  • cond -- Register name (str) or ID (int) to condition on.

  • conds -- List of register names or IDs for multi-condition.

返回:

Self, for method chaining.

示例

op.conditioned_by_nonzeros('control_reg')(state)

  1. conditioned_by_nonzeros(self: pysparq._core.Carry_UInt_UInt, cond: typing.SupportsInt | typing.SupportsIndex) -> pysparq._core.Carry_UInt_UInt

Condition this operation on registers with nonzero values.

Calling this method replaces prior nonzero-register conditions. Pass the list overload to require several registers simultaneously; conditions of different kinds are combined with logical AND.

参数:
  • cond -- Register name (str) or ID (int) to condition on.

  • conds -- List of register names or IDs for multi-condition.

返回:

Self, for method chaining.

示例

op.conditioned_by_nonzeros('control_reg')(state)

  1. conditioned_by_nonzeros(self: pysparq._core.Carry_UInt_UInt, conds: collections.abc.Sequence[typing.SupportsInt | typing.SupportsIndex]) -> pysparq._core.Carry_UInt_UInt

Condition this operation on registers with nonzero values.

Calling this method replaces prior nonzero-register conditions. Pass the list overload to require several registers simultaneously; conditions of different kinds are combined with logical AND.

参数:
  • cond -- Register name (str) or ID (int) to condition on.

  • conds -- List of register names or IDs for multi-condition.

返回:

Self, for method chaining.

示例

op.conditioned_by_nonzeros('control_reg')(state)

conditioned_by_value(*args, **kwargs)

Overloaded function.

  1. conditioned_by_value(self: pysparq._core.Carry_UInt_UInt, cond: str, pos: typing.SupportsInt | typing.SupportsIndex) -> pysparq._core.Carry_UInt_UInt

Condition this operation on registers holding a specific value.

Calling this method replaces prior value conditions. Pass the list-of-pairs overload to require several values simultaneously; conditions of different kinds are combined with logical AND.

参数:
  • cond -- Register name (str) or ID (int).

  • pos -- Value to match.

  • conds -- List of (register, value) pairs.

返回:

Self, for method chaining.

  1. conditioned_by_value(self: pysparq._core.Carry_UInt_UInt, conds: collections.abc.Sequence[tuple[str, typing.SupportsInt | typing.SupportsIndex]]) -> pysparq._core.Carry_UInt_UInt

Condition this operation on registers holding a specific value.

Calling this method replaces prior value conditions. Pass the list-of-pairs overload to require several values simultaneously; conditions of different kinds are combined with logical AND.

参数:
  • cond -- Register name (str) or ID (int).

  • pos -- Value to match.

  • conds -- List of (register, value) pairs.

返回:

Self, for method chaining.

  1. conditioned_by_value(self: pysparq._core.Carry_UInt_UInt, cond: typing.SupportsInt | typing.SupportsIndex, pos: typing.SupportsInt | typing.SupportsIndex) -> pysparq._core.Carry_UInt_UInt

Condition this operation on registers holding a specific value.

Calling this method replaces prior value conditions. Pass the list-of-pairs overload to require several values simultaneously; conditions of different kinds are combined with logical AND.

参数:
  • cond -- Register name (str) or ID (int).

  • pos -- Value to match.

  • conds -- List of (register, value) pairs.

返回:

Self, for method chaining.

  1. conditioned_by_value(self: pysparq._core.Carry_UInt_UInt, conds: collections.abc.Sequence[tuple[typing.SupportsInt | typing.SupportsIndex, typing.SupportsInt | typing.SupportsIndex]]) -> pysparq._core.Carry_UInt_UInt

Condition this operation on registers holding a specific value.

Calling this method replaces prior value conditions. Pass the list-of-pairs overload to require several values simultaneously; conditions of different kinds are combined with logical AND.

参数:
  • cond -- Register name (str) or ID (int).

  • pos -- Value to match.

  • conds -- List of (register, value) pairs.

返回:

Self, for method chaining.

class pysparq.Overflow_SInt_SInt

Signed-addition overflow flag at the res width.

Computes: flag ^= overflow(lhs + rhs) at width w of res: operands are sign-extended, truncated to w bits, and the same-sign/addends/result-sign- flip rule is applied. The out/res parameters only provide the width; their values are not read.

参数:
  • lhs -- Name/ID of the SignedInteger left operand register.

  • rhs -- Name/ID of the SignedInteger right operand register.

  • res -- Name/ID of the register providing the target width w (not read).

  • flag -- Name/ID of the width-1 Boolean flag register (result is XORed in).

示例

Overflow_SInt_SInt("a", "b", "result", "flag")(state) # flag ^= signed overflow of a+b at result width

clear_control_all_ones(self: pysparq._core.Overflow_SInt_SInt) → None

Clear all control conditions of the specified type.

clear_control_by_bit(self: pysparq._core.Overflow_SInt_SInt) → None

Clear all control conditions of the specified type.

clear_control_by_value(self: pysparq._core.Overflow_SInt_SInt) → None

Clear all control conditions of the specified type.

clear_control_nonzeros(self: pysparq._core.Overflow_SInt_SInt) → None

Clear all control conditions of the specified type.

property condition_variable_all_ones
property condition_variable_by_bit
property condition_variable_by_value
property condition_variable_nonzeros
conditioned_by_all_ones(*args, **kwargs)

Overloaded function.

  1. conditioned_by_all_ones(self: pysparq._core.Overflow_SInt_SInt, cond: str) -> pysparq._core.Overflow_SInt_SInt

Condition this operation on registers where all bits are 1.

Calling this method replaces prior all-ones conditions. Pass the list overload to require several registers simultaneously; conditions of different kinds are combined with logical AND.

参数:
  • cond -- Register name (str) or ID (int) to condition on.

  • conds -- List of register names or IDs for multi-condition.

返回:

Self, for method chaining.

  1. conditioned_by_all_ones(self: pysparq._core.Overflow_SInt_SInt, conds: collections.abc.Sequence[str]) -> pysparq._core.Overflow_SInt_SInt

Condition this operation on registers where all bits are 1.

Calling this method replaces prior all-ones conditions. Pass the list overload to require several registers simultaneously; conditions of different kinds are combined with logical AND.

参数:
  • cond -- Register name (str) or ID (int) to condition on.

  • conds -- List of register names or IDs for multi-condition.

返回:

Self, for method chaining.

  1. conditioned_by_all_ones(self: pysparq._core.Overflow_SInt_SInt, cond: typing.SupportsInt | typing.SupportsIndex) -> pysparq._core.Overflow_SInt_SInt

Condition this operation on registers where all bits are 1.

Calling this method replaces prior all-ones conditions. Pass the list overload to require several registers simultaneously; conditions of different kinds are combined with logical AND.

参数:
  • cond -- Register name (str) or ID (int) to condition on.

  • conds -- List of register names or IDs for multi-condition.

返回:

Self, for method chaining.

  1. conditioned_by_all_ones(self: pysparq._core.Overflow_SInt_SInt, conds: collections.abc.Sequence[typing.SupportsInt | typing.SupportsIndex]) -> pysparq._core.Overflow_SInt_SInt

Condition this operation on registers where all bits are 1.

Calling this method replaces prior all-ones conditions. Pass the list overload to require several registers simultaneously; conditions of different kinds are combined with logical AND.

参数:
  • cond -- Register name (str) or ID (int) to condition on.

  • conds -- List of register names or IDs for multi-condition.

返回:

Self, for method chaining.

conditioned_by_bit(*args, **kwargs)

Overloaded function.

  1. conditioned_by_bit(self: pysparq._core.Overflow_SInt_SInt, cond: str, pos: typing.SupportsInt | typing.SupportsIndex) -> pysparq._core.Overflow_SInt_SInt

Condition this operation on a specific bit position.

Calling this method replaces prior bit conditions. Pass the list-of-pairs overload to require several bits simultaneously; conditions of different kinds are combined with logical AND.

参数:
  • cond -- Register name (str) or ID (int).

  • pos -- Bit position to check (0-indexed).

  • conds -- List of (register, position) pairs.

返回:

Self, for method chaining.

  1. conditioned_by_bit(self: pysparq._core.Overflow_SInt_SInt, conds: collections.abc.Sequence[tuple[str, typing.SupportsInt | typing.SupportsIndex]]) -> pysparq._core.Overflow_SInt_SInt

Condition this operation on a specific bit position.

Calling this method replaces prior bit conditions. Pass the list-of-pairs overload to require several bits simultaneously; conditions of different kinds are combined with logical AND.

参数:
  • cond -- Register name (str) or ID (int).

  • pos -- Bit position to check (0-indexed).

  • conds -- List of (register, position) pairs.

返回:

Self, for method chaining.

  1. conditioned_by_bit(self: pysparq._core.Overflow_SInt_SInt, cond: typing.SupportsInt | typing.SupportsIndex, pos: typing.SupportsInt | typing.SupportsIndex) -> pysparq._core.Overflow_SInt_SInt

Condition this operation on a specific bit position.

Calling this method replaces prior bit conditions. Pass the list-of-pairs overload to require several bits simultaneously; conditions of different kinds are combined with logical AND.

参数:
  • cond -- Register name (str) or ID (int).

  • pos -- Bit position to check (0-indexed).

  • conds -- List of (register, position) pairs.

返回:

Self, for method chaining.

  1. conditioned_by_bit(self: pysparq._core.Overflow_SInt_SInt, conds: collections.abc.Sequence[tuple[typing.SupportsInt | typing.SupportsIndex, typing.SupportsInt | typing.SupportsIndex]]) -> pysparq._core.Overflow_SInt_SInt

Condition this operation on a specific bit position.

Calling this method replaces prior bit conditions. Pass the list-of-pairs overload to require several bits simultaneously; conditions of different kinds are combined with logical AND.

参数:
  • cond -- Register name (str) or ID (int).

  • pos -- Bit position to check (0-indexed).

  • conds -- List of (register, position) pairs.

返回:

Self, for method chaining.

conditioned_by_nonzeros(*args, **kwargs)

Overloaded function.

  1. conditioned_by_nonzeros(self: pysparq._core.Overflow_SInt_SInt, cond: str) -> pysparq._core.Overflow_SInt_SInt

Condition this operation on registers with nonzero values.

Calling this method replaces prior nonzero-register conditions. Pass the list overload to require several registers simultaneously; conditions of different kinds are combined with logical AND.

参数:
  • cond -- Register name (str) or ID (int) to condition on.

  • conds -- List of register names or IDs for multi-condition.

返回:

Self, for method chaining.

示例

op.conditioned_by_nonzeros('control_reg')(state)

  1. conditioned_by_nonzeros(self: pysparq._core.Overflow_SInt_SInt, conds: collections.abc.Sequence[str]) -> pysparq._core.Overflow_SInt_SInt

Condition this operation on registers with nonzero values.

Calling this method replaces prior nonzero-register conditions. Pass the list overload to require several registers simultaneously; conditions of different kinds are combined with logical AND.

参数:
  • cond -- Register name (str) or ID (int) to condition on.

  • conds -- List of register names or IDs for multi-condition.

返回:

Self, for method chaining.

示例

op.conditioned_by_nonzeros('control_reg')(state)

  1. conditioned_by_nonzeros(self: pysparq._core.Overflow_SInt_SInt, cond: typing.SupportsInt | typing.SupportsIndex) -> pysparq._core.Overflow_SInt_SInt

Condition this operation on registers with nonzero values.

Calling this method replaces prior nonzero-register conditions. Pass the list overload to require several registers simultaneously; conditions of different kinds are combined with logical AND.

参数:
  • cond -- Register name (str) or ID (int) to condition on.

  • conds -- List of register names or IDs for multi-condition.

返回:

Self, for method chaining.

示例

op.conditioned_by_nonzeros('control_reg')(state)

  1. conditioned_by_nonzeros(self: pysparq._core.Overflow_SInt_SInt, conds: collections.abc.Sequence[typing.SupportsInt | typing.SupportsIndex]) -> pysparq._core.Overflow_SInt_SInt

Condition this operation on registers with nonzero values.

Calling this method replaces prior nonzero-register conditions. Pass the list overload to require several registers simultaneously; conditions of different kinds are combined with logical AND.

参数:
  • cond -- Register name (str) or ID (int) to condition on.

  • conds -- List of register names or IDs for multi-condition.

返回:

Self, for method chaining.

示例

op.conditioned_by_nonzeros('control_reg')(state)

conditioned_by_value(*args, **kwargs)

Overloaded function.

  1. conditioned_by_value(self: pysparq._core.Overflow_SInt_SInt, cond: str, pos: typing.SupportsInt | typing.SupportsIndex) -> pysparq._core.Overflow_SInt_SInt

Condition this operation on registers holding a specific value.

Calling this method replaces prior value conditions. Pass the list-of-pairs overload to require several values simultaneously; conditions of different kinds are combined with logical AND.

参数:
  • cond -- Register name (str) or ID (int).

  • pos -- Value to match.

  • conds -- List of (register, value) pairs.

返回:

Self, for method chaining.

  1. conditioned_by_value(self: pysparq._core.Overflow_SInt_SInt, conds: collections.abc.Sequence[tuple[str, typing.SupportsInt | typing.SupportsIndex]]) -> pysparq._core.Overflow_SInt_SInt

Condition this operation on registers holding a specific value.

Calling this method replaces prior value conditions. Pass the list-of-pairs overload to require several values simultaneously; conditions of different kinds are combined with logical AND.

参数:
  • cond -- Register name (str) or ID (int).

  • pos -- Value to match.

  • conds -- List of (register, value) pairs.

返回:

Self, for method chaining.

  1. conditioned_by_value(self: pysparq._core.Overflow_SInt_SInt, cond: typing.SupportsInt | typing.SupportsIndex, pos: typing.SupportsInt | typing.SupportsIndex) -> pysparq._core.Overflow_SInt_SInt

Condition this operation on registers holding a specific value.

Calling this method replaces prior value conditions. Pass the list-of-pairs overload to require several values simultaneously; conditions of different kinds are combined with logical AND.

参数:
  • cond -- Register name (str) or ID (int).

  • pos -- Value to match.

  • conds -- List of (register, value) pairs.

返回:

Self, for method chaining.

  1. conditioned_by_value(self: pysparq._core.Overflow_SInt_SInt, conds: collections.abc.Sequence[tuple[typing.SupportsInt | typing.SupportsIndex, typing.SupportsInt | typing.SupportsIndex]]) -> pysparq._core.Overflow_SInt_SInt

Condition this operation on registers holding a specific value.

Calling this method replaces prior value conditions. Pass the list-of-pairs overload to require several values simultaneously; conditions of different kinds are combined with logical AND.

参数:
  • cond -- Register name (str) or ID (int).

  • pos -- Value to match.

  • conds -- List of (register, value) pairs.

返回:

Self, for method chaining.

class pysparq.MulOverflow_UInt_UInt

Multiplication overflow flag relative to the res width.

Computes: flag ^= (lhs * rhs does not fit in w bits), where w is the width of res; the product is evaluated at full precision (128-bit, via 64-bit hi/lo decomposition). The out/res parameters only provide the width; their values are not read.

参数:
  • lhs -- Name/ID of the first input register.

  • rhs -- Name/ID of the second input register.

  • res -- Name/ID of the register providing the target width w (not read).

  • flag -- Name/ID of the width-1 Boolean flag register (result is XORed in).

示例

MulOverflow_UInt_UInt("a", "b", "result", "flag")(state) # flag ^= (a*b overflows result width)

clear_control_all_ones(self: pysparq._core.MulOverflow_UInt_UInt) → None

Clear all control conditions of the specified type.

clear_control_by_bit(self: pysparq._core.MulOverflow_UInt_UInt) → None

Clear all control conditions of the specified type.

clear_control_by_value(self: pysparq._core.MulOverflow_UInt_UInt) → None

Clear all control conditions of the specified type.

clear_control_nonzeros(self: pysparq._core.MulOverflow_UInt_UInt) → None

Clear all control conditions of the specified type.

property condition_variable_all_ones
property condition_variable_by_bit
property condition_variable_by_value
property condition_variable_nonzeros
conditioned_by_all_ones(*args, **kwargs)

Overloaded function.

  1. conditioned_by_all_ones(self: pysparq._core.MulOverflow_UInt_UInt, cond: str) -> pysparq._core.MulOverflow_UInt_UInt

Condition this operation on registers where all bits are 1.

Calling this method replaces prior all-ones conditions. Pass the list overload to require several registers simultaneously; conditions of different kinds are combined with logical AND.

参数:
  • cond -- Register name (str) or ID (int) to condition on.

  • conds -- List of register names or IDs for multi-condition.

返回:

Self, for method chaining.

  1. conditioned_by_all_ones(self: pysparq._core.MulOverflow_UInt_UInt, conds: collections.abc.Sequence[str]) -> pysparq._core.MulOverflow_UInt_UInt

Condition this operation on registers where all bits are 1.

Calling this method replaces prior all-ones conditions. Pass the list overload to require several registers simultaneously; conditions of different kinds are combined with logical AND.

参数:
  • cond -- Register name (str) or ID (int) to condition on.

  • conds -- List of register names or IDs for multi-condition.

返回:

Self, for method chaining.

  1. conditioned_by_all_ones(self: pysparq._core.MulOverflow_UInt_UInt, cond: typing.SupportsInt | typing.SupportsIndex) -> pysparq._core.MulOverflow_UInt_UInt

Condition this operation on registers where all bits are 1.

Calling this method replaces prior all-ones conditions. Pass the list overload to require several registers simultaneously; conditions of different kinds are combined with logical AND.

参数:
  • cond -- Register name (str) or ID (int) to condition on.

  • conds -- List of register names or IDs for multi-condition.

返回:

Self, for method chaining.

  1. conditioned_by_all_ones(self: pysparq._core.MulOverflow_UInt_UInt, conds: collections.abc.Sequence[typing.SupportsInt | typing.SupportsIndex]) -> pysparq._core.MulOverflow_UInt_UInt

Condition this operation on registers where all bits are 1.

Calling this method replaces prior all-ones conditions. Pass the list overload to require several registers simultaneously; conditions of different kinds are combined with logical AND.

参数:
  • cond -- Register name (str) or ID (int) to condition on.

  • conds -- List of register names or IDs for multi-condition.

返回:

Self, for method chaining.

conditioned_by_bit(*args, **kwargs)

Overloaded function.

  1. conditioned_by_bit(self: pysparq._core.MulOverflow_UInt_UInt, cond: str, pos: typing.SupportsInt | typing.SupportsIndex) -> pysparq._core.MulOverflow_UInt_UInt

Condition this operation on a specific bit position.

Calling this method replaces prior bit conditions. Pass the list-of-pairs overload to require several bits simultaneously; conditions of different kinds are combined with logical AND.

参数:
  • cond -- Register name (str) or ID (int).

  • pos -- Bit position to check (0-indexed).

  • conds -- List of (register, position) pairs.

返回:

Self, for method chaining.

  1. conditioned_by_bit(self: pysparq._core.MulOverflow_UInt_UInt, conds: collections.abc.Sequence[tuple[str, typing.SupportsInt | typing.SupportsIndex]]) -> pysparq._core.MulOverflow_UInt_UInt

Condition this operation on a specific bit position.

Calling this method replaces prior bit conditions. Pass the list-of-pairs overload to require several bits simultaneously; conditions of different kinds are combined with logical AND.

参数:
  • cond -- Register name (str) or ID (int).

  • pos -- Bit position to check (0-indexed).

  • conds -- List of (register, position) pairs.

返回:

Self, for method chaining.

  1. conditioned_by_bit(self: pysparq._core.MulOverflow_UInt_UInt, cond: typing.SupportsInt | typing.SupportsIndex, pos: typing.SupportsInt | typing.SupportsIndex) -> pysparq._core.MulOverflow_UInt_UInt

Condition this operation on a specific bit position.

Calling this method replaces prior bit conditions. Pass the list-of-pairs overload to require several bits simultaneously; conditions of different kinds are combined with logical AND.

参数:
  • cond -- Register name (str) or ID (int).

  • pos -- Bit position to check (0-indexed).

  • conds -- List of (register, position) pairs.

返回:

Self, for method chaining.

  1. conditioned_by_bit(self: pysparq._core.MulOverflow_UInt_UInt, conds: collections.abc.Sequence[tuple[typing.SupportsInt | typing.SupportsIndex, typing.SupportsInt | typing.SupportsIndex]]) -> pysparq._core.MulOverflow_UInt_UInt

Condition this operation on a specific bit position.

Calling this method replaces prior bit conditions. Pass the list-of-pairs overload to require several bits simultaneously; conditions of different kinds are combined with logical AND.

参数:
  • cond -- Register name (str) or ID (int).

  • pos -- Bit position to check (0-indexed).

  • conds -- List of (register, position) pairs.

返回:

Self, for method chaining.

conditioned_by_nonzeros(*args, **kwargs)

Overloaded function.

  1. conditioned_by_nonzeros(self: pysparq._core.MulOverflow_UInt_UInt, cond: str) -> pysparq._core.MulOverflow_UInt_UInt

Condition this operation on registers with nonzero values.

Calling this method replaces prior nonzero-register conditions. Pass the list overload to require several registers simultaneously; conditions of different kinds are combined with logical AND.

参数:
  • cond -- Register name (str) or ID (int) to condition on.

  • conds -- List of register names or IDs for multi-condition.

返回:

Self, for method chaining.

示例

op.conditioned_by_nonzeros('control_reg')(state)

  1. conditioned_by_nonzeros(self: pysparq._core.MulOverflow_UInt_UInt, conds: collections.abc.Sequence[str]) -> pysparq._core.MulOverflow_UInt_UInt

Condition this operation on registers with nonzero values.

Calling this method replaces prior nonzero-register conditions. Pass the list overload to require several registers simultaneously; conditions of different kinds are combined with logical AND.

参数:
  • cond -- Register name (str) or ID (int) to condition on.

  • conds -- List of register names or IDs for multi-condition.

返回:

Self, for method chaining.

示例

op.conditioned_by_nonzeros('control_reg')(state)

  1. conditioned_by_nonzeros(self: pysparq._core.MulOverflow_UInt_UInt, cond: typing.SupportsInt | typing.SupportsIndex) -> pysparq._core.MulOverflow_UInt_UInt

Condition this operation on registers with nonzero values.

Calling this method replaces prior nonzero-register conditions. Pass the list overload to require several registers simultaneously; conditions of different kinds are combined with logical AND.

参数:
  • cond -- Register name (str) or ID (int) to condition on.

  • conds -- List of register names or IDs for multi-condition.

返回:

Self, for method chaining.

示例

op.conditioned_by_nonzeros('control_reg')(state)

  1. conditioned_by_nonzeros(self: pysparq._core.MulOverflow_UInt_UInt, conds: collections.abc.Sequence[typing.SupportsInt | typing.SupportsIndex]) -> pysparq._core.MulOverflow_UInt_UInt

Condition this operation on registers with nonzero values.

Calling this method replaces prior nonzero-register conditions. Pass the list overload to require several registers simultaneously; conditions of different kinds are combined with logical AND.

参数:
  • cond -- Register name (str) or ID (int) to condition on.

  • conds -- List of register names or IDs for multi-condition.

返回:

Self, for method chaining.

示例

op.conditioned_by_nonzeros('control_reg')(state)

conditioned_by_value(*args, **kwargs)

Overloaded function.

  1. conditioned_by_value(self: pysparq._core.MulOverflow_UInt_UInt, cond: str, pos: typing.SupportsInt | typing.SupportsIndex) -> pysparq._core.MulOverflow_UInt_UInt

Condition this operation on registers holding a specific value.

Calling this method replaces prior value conditions. Pass the list-of-pairs overload to require several values simultaneously; conditions of different kinds are combined with logical AND.

参数:
  • cond -- Register name (str) or ID (int).

  • pos -- Value to match.

  • conds -- List of (register, value) pairs.

返回:

Self, for method chaining.

  1. conditioned_by_value(self: pysparq._core.MulOverflow_UInt_UInt, conds: collections.abc.Sequence[tuple[str, typing.SupportsInt | typing.SupportsIndex]]) -> pysparq._core.MulOverflow_UInt_UInt

Condition this operation on registers holding a specific value.

Calling this method replaces prior value conditions. Pass the list-of-pairs overload to require several values simultaneously; conditions of different kinds are combined with logical AND.

参数:
  • cond -- Register name (str) or ID (int).

  • pos -- Value to match.

  • conds -- List of (register, value) pairs.

返回:

Self, for method chaining.

  1. conditioned_by_value(self: pysparq._core.MulOverflow_UInt_UInt, cond: typing.SupportsInt | typing.SupportsIndex, pos: typing.SupportsInt | typing.SupportsIndex) -> pysparq._core.MulOverflow_UInt_UInt

Condition this operation on registers holding a specific value.

Calling this method replaces prior value conditions. Pass the list-of-pairs overload to require several values simultaneously; conditions of different kinds are combined with logical AND.

参数:
  • cond -- Register name (str) or ID (int).

  • pos -- Value to match.

  • conds -- List of (register, value) pairs.

返回:

Self, for method chaining.

  1. conditioned_by_value(self: pysparq._core.MulOverflow_UInt_UInt, conds: collections.abc.Sequence[tuple[typing.SupportsInt | typing.SupportsIndex, typing.SupportsInt | typing.SupportsIndex]]) -> pysparq._core.MulOverflow_UInt_UInt

Condition this operation on registers holding a specific value.

Calling this method replaces prior value conditions. Pass the list-of-pairs overload to require several values simultaneously; conditions of different kinds are combined with logical AND.

参数:
  • cond -- Register name (str) or ID (int).

  • pos -- Value to match.

  • conds -- List of (register, value) pairs.

返回:

Self, for method chaining.

class pysparq.IsZero_UInt

Zero test of an unsigned integer register.

Computes: flag ^= (reg == 0), with the operand zero-extended to the full-precision domain before comparing.

参数:
  • reg -- Name/ID of the UnsignedInteger input register.

  • flag -- Name/ID of the width-1 Boolean flag register (result is XORed in).

示例

IsZero_UInt("a", "flag")(state) # flag ^= (a == 0)

clear_control_all_ones(self: pysparq._core.IsZero_UInt) → None

Clear all control conditions of the specified type.

clear_control_by_bit(self: pysparq._core.IsZero_UInt) → None

Clear all control conditions of the specified type.

clear_control_by_value(self: pysparq._core.IsZero_UInt) → None

Clear all control conditions of the specified type.

clear_control_nonzeros(self: pysparq._core.IsZero_UInt) → None

Clear all control conditions of the specified type.

property condition_variable_all_ones
property condition_variable_by_bit
property condition_variable_by_value
property condition_variable_nonzeros
conditioned_by_all_ones(*args, **kwargs)

Overloaded function.

  1. conditioned_by_all_ones(self: pysparq._core.IsZero_UInt, cond: str) -> pysparq._core.IsZero_UInt

Condition this operation on registers where all bits are 1.

Calling this method replaces prior all-ones conditions. Pass the list overload to require several registers simultaneously; conditions of different kinds are combined with logical AND.

参数:
  • cond -- Register name (str) or ID (int) to condition on.

  • conds -- List of register names or IDs for multi-condition.

返回:

Self, for method chaining.

  1. conditioned_by_all_ones(self: pysparq._core.IsZero_UInt, conds: collections.abc.Sequence[str]) -> pysparq._core.IsZero_UInt

Condition this operation on registers where all bits are 1.

Calling this method replaces prior all-ones conditions. Pass the list overload to require several registers simultaneously; conditions of different kinds are combined with logical AND.

参数:
  • cond -- Register name (str) or ID (int) to condition on.

  • conds -- List of register names or IDs for multi-condition.

返回:

Self, for method chaining.

  1. conditioned_by_all_ones(self: pysparq._core.IsZero_UInt, cond: typing.SupportsInt | typing.SupportsIndex) -> pysparq._core.IsZero_UInt

Condition this operation on registers where all bits are 1.

Calling this method replaces prior all-ones conditions. Pass the list overload to require several registers simultaneously; conditions of different kinds are combined with logical AND.

参数:
  • cond -- Register name (str) or ID (int) to condition on.

  • conds -- List of register names or IDs for multi-condition.

返回:

Self, for method chaining.

  1. conditioned_by_all_ones(self: pysparq._core.IsZero_UInt, conds: collections.abc.Sequence[typing.SupportsInt | typing.SupportsIndex]) -> pysparq._core.IsZero_UInt

Condition this operation on registers where all bits are 1.

Calling this method replaces prior all-ones conditions. Pass the list overload to require several registers simultaneously; conditions of different kinds are combined with logical AND.

参数:
  • cond -- Register name (str) or ID (int) to condition on.

  • conds -- List of register names or IDs for multi-condition.

返回:

Self, for method chaining.

conditioned_by_bit(*args, **kwargs)

Overloaded function.

  1. conditioned_by_bit(self: pysparq._core.IsZero_UInt, cond: str, pos: typing.SupportsInt | typing.SupportsIndex) -> pysparq._core.IsZero_UInt

Condition this operation on a specific bit position.

Calling this method replaces prior bit conditions. Pass the list-of-pairs overload to require several bits simultaneously; conditions of different kinds are combined with logical AND.

参数:
  • cond -- Register name (str) or ID (int).

  • pos -- Bit position to check (0-indexed).

  • conds -- List of (register, position) pairs.

返回:

Self, for method chaining.

  1. conditioned_by_bit(self: pysparq._core.IsZero_UInt, conds: collections.abc.Sequence[tuple[str, typing.SupportsInt | typing.SupportsIndex]]) -> pysparq._core.IsZero_UInt

Condition this operation on a specific bit position.

Calling this method replaces prior bit conditions. Pass the list-of-pairs overload to require several bits simultaneously; conditions of different kinds are combined with logical AND.

参数:
  • cond -- Register name (str) or ID (int).

  • pos -- Bit position to check (0-indexed).

  • conds -- List of (register, position) pairs.

返回:

Self, for method chaining.

  1. conditioned_by_bit(self: pysparq._core.IsZero_UInt, cond: typing.SupportsInt | typing.SupportsIndex, pos: typing.SupportsInt | typing.SupportsIndex) -> pysparq._core.IsZero_UInt

Condition this operation on a specific bit position.

Calling this method replaces prior bit conditions. Pass the list-of-pairs overload to require several bits simultaneously; conditions of different kinds are combined with logical AND.

参数:
  • cond -- Register name (str) or ID (int).

  • pos -- Bit position to check (0-indexed).

  • conds -- List of (register, position) pairs.

返回:

Self, for method chaining.

  1. conditioned_by_bit(self: pysparq._core.IsZero_UInt, conds: collections.abc.Sequence[tuple[typing.SupportsInt | typing.SupportsIndex, typing.SupportsInt | typing.SupportsIndex]]) -> pysparq._core.IsZero_UInt

Condition this operation on a specific bit position.

Calling this method replaces prior bit conditions. Pass the list-of-pairs overload to require several bits simultaneously; conditions of different kinds are combined with logical AND.

参数:
  • cond -- Register name (str) or ID (int).

  • pos -- Bit position to check (0-indexed).

  • conds -- List of (register, position) pairs.

返回:

Self, for method chaining.

conditioned_by_nonzeros(*args, **kwargs)

Overloaded function.

  1. conditioned_by_nonzeros(self: pysparq._core.IsZero_UInt, cond: str) -> pysparq._core.IsZero_UInt

Condition this operation on registers with nonzero values.

Calling this method replaces prior nonzero-register conditions. Pass the list overload to require several registers simultaneously; conditions of different kinds are combined with logical AND.

参数:
  • cond -- Register name (str) or ID (int) to condition on.

  • conds -- List of register names or IDs for multi-condition.

返回:

Self, for method chaining.

示例

op.conditioned_by_nonzeros('control_reg')(state)

  1. conditioned_by_nonzeros(self: pysparq._core.IsZero_UInt, conds: collections.abc.Sequence[str]) -> pysparq._core.IsZero_UInt

Condition this operation on registers with nonzero values.

Calling this method replaces prior nonzero-register conditions. Pass the list overload to require several registers simultaneously; conditions of different kinds are combined with logical AND.

参数:
  • cond -- Register name (str) or ID (int) to condition on.

  • conds -- List of register names or IDs for multi-condition.

返回:

Self, for method chaining.

示例

op.conditioned_by_nonzeros('control_reg')(state)

  1. conditioned_by_nonzeros(self: pysparq._core.IsZero_UInt, cond: typing.SupportsInt | typing.SupportsIndex) -> pysparq._core.IsZero_UInt

Condition this operation on registers with nonzero values.

Calling this method replaces prior nonzero-register conditions. Pass the list overload to require several registers simultaneously; conditions of different kinds are combined with logical AND.

参数:
  • cond -- Register name (str) or ID (int) to condition on.

  • conds -- List of register names or IDs for multi-condition.

返回:

Self, for method chaining.

示例

op.conditioned_by_nonzeros('control_reg')(state)

  1. conditioned_by_nonzeros(self: pysparq._core.IsZero_UInt, conds: collections.abc.Sequence[typing.SupportsInt | typing.SupportsIndex]) -> pysparq._core.IsZero_UInt

Condition this operation on registers with nonzero values.

Calling this method replaces prior nonzero-register conditions. Pass the list overload to require several registers simultaneously; conditions of different kinds are combined with logical AND.

参数:
  • cond -- Register name (str) or ID (int) to condition on.

  • conds -- List of register names or IDs for multi-condition.

返回:

Self, for method chaining.

示例

op.conditioned_by_nonzeros('control_reg')(state)

conditioned_by_value(*args, **kwargs)

Overloaded function.

  1. conditioned_by_value(self: pysparq._core.IsZero_UInt, cond: str, pos: typing.SupportsInt | typing.SupportsIndex) -> pysparq._core.IsZero_UInt

Condition this operation on registers holding a specific value.

Calling this method replaces prior value conditions. Pass the list-of-pairs overload to require several values simultaneously; conditions of different kinds are combined with logical AND.

参数:
  • cond -- Register name (str) or ID (int).

  • pos -- Value to match.

  • conds -- List of (register, value) pairs.

返回:

Self, for method chaining.

  1. conditioned_by_value(self: pysparq._core.IsZero_UInt, conds: collections.abc.Sequence[tuple[str, typing.SupportsInt | typing.SupportsIndex]]) -> pysparq._core.IsZero_UInt

Condition this operation on registers holding a specific value.

Calling this method replaces prior value conditions. Pass the list-of-pairs overload to require several values simultaneously; conditions of different kinds are combined with logical AND.

参数:
  • cond -- Register name (str) or ID (int).

  • pos -- Value to match.

  • conds -- List of (register, value) pairs.

返回:

Self, for method chaining.

  1. conditioned_by_value(self: pysparq._core.IsZero_UInt, cond: typing.SupportsInt | typing.SupportsIndex, pos: typing.SupportsInt | typing.SupportsIndex) -> pysparq._core.IsZero_UInt

Condition this operation on registers holding a specific value.

Calling this method replaces prior value conditions. Pass the list-of-pairs overload to require several values simultaneously; conditions of different kinds are combined with logical AND.

参数:
  • cond -- Register name (str) or ID (int).

  • pos -- Value to match.

  • conds -- List of (register, value) pairs.

返回:

Self, for method chaining.

  1. conditioned_by_value(self: pysparq._core.IsZero_UInt, conds: collections.abc.Sequence[tuple[typing.SupportsInt | typing.SupportsIndex, typing.SupportsInt | typing.SupportsIndex]]) -> pysparq._core.IsZero_UInt

Condition this operation on registers holding a specific value.

Calling this method replaces prior value conditions. Pass the list-of-pairs overload to require several values simultaneously; conditions of different kinds are combined with logical AND.

参数:
  • cond -- Register name (str) or ID (int).

  • pos -- Value to match.

  • conds -- List of (register, value) pairs.

返回:

Self, for method chaining.

class pysparq.CustomArithmetic
clear_control_all_ones(self: pysparq._core.CustomArithmetic) → None

Clear all control conditions of the specified type.

clear_control_by_bit(self: pysparq._core.CustomArithmetic) → None

Clear all control conditions of the specified type.

clear_control_by_value(self: pysparq._core.CustomArithmetic) → None

Clear all control conditions of the specified type.

clear_control_nonzeros(self: pysparq._core.CustomArithmetic) → None

Clear all control conditions of the specified type.

property condition_variable_all_ones
property condition_variable_by_bit
property condition_variable_by_value
property condition_variable_nonzeros
conditioned_by_all_ones(*args, **kwargs)

Overloaded function.

  1. conditioned_by_all_ones(self: pysparq._core.CustomArithmetic, cond: str) -> pysparq._core.CustomArithmetic

Condition this operation on registers where all bits are 1.

Calling this method replaces prior all-ones conditions. Pass the list overload to require several registers simultaneously; conditions of different kinds are combined with logical AND.

参数:
  • cond -- Register name (str) or ID (int) to condition on.

  • conds -- List of register names or IDs for multi-condition.

返回:

Self, for method chaining.

  1. conditioned_by_all_ones(self: pysparq._core.CustomArithmetic, conds: collections.abc.Sequence[str]) -> pysparq._core.CustomArithmetic

Condition this operation on registers where all bits are 1.

Calling this method replaces prior all-ones conditions. Pass the list overload to require several registers simultaneously; conditions of different kinds are combined with logical AND.

参数:
  • cond -- Register name (str) or ID (int) to condition on.

  • conds -- List of register names or IDs for multi-condition.

返回:

Self, for method chaining.

  1. conditioned_by_all_ones(self: pysparq._core.CustomArithmetic, cond: typing.SupportsInt | typing.SupportsIndex) -> pysparq._core.CustomArithmetic

Condition this operation on registers where all bits are 1.

Calling this method replaces prior all-ones conditions. Pass the list overload to require several registers simultaneously; conditions of different kinds are combined with logical AND.

参数:
  • cond -- Register name (str) or ID (int) to condition on.

  • conds -- List of register names or IDs for multi-condition.

返回:

Self, for method chaining.

  1. conditioned_by_all_ones(self: pysparq._core.CustomArithmetic, conds: collections.abc.Sequence[typing.SupportsInt | typing.SupportsIndex]) -> pysparq._core.CustomArithmetic

Condition this operation on registers where all bits are 1.

Calling this method replaces prior all-ones conditions. Pass the list overload to require several registers simultaneously; conditions of different kinds are combined with logical AND.

参数:
  • cond -- Register name (str) or ID (int) to condition on.

  • conds -- List of register names or IDs for multi-condition.

返回:

Self, for method chaining.

conditioned_by_bit(*args, **kwargs)

Overloaded function.

  1. conditioned_by_bit(self: pysparq._core.CustomArithmetic, cond: str, pos: typing.SupportsInt | typing.SupportsIndex) -> pysparq._core.CustomArithmetic

Condition this operation on a specific bit position.

Calling this method replaces prior bit conditions. Pass the list-of-pairs overload to require several bits simultaneously; conditions of different kinds are combined with logical AND.

参数:
  • cond -- Register name (str) or ID (int).

  • pos -- Bit position to check (0-indexed).

  • conds -- List of (register, position) pairs.

返回:

Self, for method chaining.

  1. conditioned_by_bit(self: pysparq._core.CustomArithmetic, conds: collections.abc.Sequence[tuple[str, typing.SupportsInt | typing.SupportsIndex]]) -> pysparq._core.CustomArithmetic

Condition this operation on a specific bit position.

Calling this method replaces prior bit conditions. Pass the list-of-pairs overload to require several bits simultaneously; conditions of different kinds are combined with logical AND.

参数:
  • cond -- Register name (str) or ID (int).

  • pos -- Bit position to check (0-indexed).

  • conds -- List of (register, position) pairs.

返回:

Self, for method chaining.

  1. conditioned_by_bit(self: pysparq._core.CustomArithmetic, cond: typing.SupportsInt | typing.SupportsIndex, pos: typing.SupportsInt | typing.SupportsIndex) -> pysparq._core.CustomArithmetic

Condition this operation on a specific bit position.

Calling this method replaces prior bit conditions. Pass the list-of-pairs overload to require several bits simultaneously; conditions of different kinds are combined with logical AND.

参数:
  • cond -- Register name (str) or ID (int).

  • pos -- Bit position to check (0-indexed).

  • conds -- List of (register, position) pairs.

返回:

Self, for method chaining.

  1. conditioned_by_bit(self: pysparq._core.CustomArithmetic, conds: collections.abc.Sequence[tuple[typing.SupportsInt | typing.SupportsIndex, typing.SupportsInt | typing.SupportsIndex]]) -> pysparq._core.CustomArithmetic

Condition this operation on a specific bit position.

Calling this method replaces prior bit conditions. Pass the list-of-pairs overload to require several bits simultaneously; conditions of different kinds are combined with logical AND.

参数:
  • cond -- Register name (str) or ID (int).

  • pos -- Bit position to check (0-indexed).

  • conds -- List of (register, position) pairs.

返回:

Self, for method chaining.

conditioned_by_nonzeros(*args, **kwargs)

Overloaded function.

  1. conditioned_by_nonzeros(self: pysparq._core.CustomArithmetic, cond: str) -> pysparq._core.CustomArithmetic

Condition this operation on registers with nonzero values.

Calling this method replaces prior nonzero-register conditions. Pass the list overload to require several registers simultaneously; conditions of different kinds are combined with logical AND.

参数:
  • cond -- Register name (str) or ID (int) to condition on.

  • conds -- List of register names or IDs for multi-condition.

返回:

Self, for method chaining.

示例

op.conditioned_by_nonzeros('control_reg')(state)

  1. conditioned_by_nonzeros(self: pysparq._core.CustomArithmetic, conds: collections.abc.Sequence[str]) -> pysparq._core.CustomArithmetic

Condition this operation on registers with nonzero values.

Calling this method replaces prior nonzero-register conditions. Pass the list overload to require several registers simultaneously; conditions of different kinds are combined with logical AND.

参数:
  • cond -- Register name (str) or ID (int) to condition on.

  • conds -- List of register names or IDs for multi-condition.

返回:

Self, for method chaining.

示例

op.conditioned_by_nonzeros('control_reg')(state)

  1. conditioned_by_nonzeros(self: pysparq._core.CustomArithmetic, cond: typing.SupportsInt | typing.SupportsIndex) -> pysparq._core.CustomArithmetic

Condition this operation on registers with nonzero values.

Calling this method replaces prior nonzero-register conditions. Pass the list overload to require several registers simultaneously; conditions of different kinds are combined with logical AND.

参数:
  • cond -- Register name (str) or ID (int) to condition on.

  • conds -- List of register names or IDs for multi-condition.

返回:

Self, for method chaining.

示例

op.conditioned_by_nonzeros('control_reg')(state)

  1. conditioned_by_nonzeros(self: pysparq._core.CustomArithmetic, conds: collections.abc.Sequence[typing.SupportsInt | typing.SupportsIndex]) -> pysparq._core.CustomArithmetic

Condition this operation on registers with nonzero values.

Calling this method replaces prior nonzero-register conditions. Pass the list overload to require several registers simultaneously; conditions of different kinds are combined with logical AND.

参数:
  • cond -- Register name (str) or ID (int) to condition on.

  • conds -- List of register names or IDs for multi-condition.

返回:

Self, for method chaining.

示例

op.conditioned_by_nonzeros('control_reg')(state)

conditioned_by_value(*args, **kwargs)

Overloaded function.

  1. conditioned_by_value(self: pysparq._core.CustomArithmetic, cond: str, pos: typing.SupportsInt | typing.SupportsIndex) -> pysparq._core.CustomArithmetic

Condition this operation on registers holding a specific value.

Calling this method replaces prior value conditions. Pass the list-of-pairs overload to require several values simultaneously; conditions of different kinds are combined with logical AND.

参数:
  • cond -- Register name (str) or ID (int).

  • pos -- Value to match.

  • conds -- List of (register, value) pairs.

返回:

Self, for method chaining.

  1. conditioned_by_value(self: pysparq._core.CustomArithmetic, conds: collections.abc.Sequence[tuple[str, typing.SupportsInt | typing.SupportsIndex]]) -> pysparq._core.CustomArithmetic

Condition this operation on registers holding a specific value.

Calling this method replaces prior value conditions. Pass the list-of-pairs overload to require several values simultaneously; conditions of different kinds are combined with logical AND.

参数:
  • cond -- Register name (str) or ID (int).

  • pos -- Value to match.

  • conds -- List of (register, value) pairs.

返回:

Self, for method chaining.

  1. conditioned_by_value(self: pysparq._core.CustomArithmetic, cond: typing.SupportsInt | typing.SupportsIndex, pos: typing.SupportsInt | typing.SupportsIndex) -> pysparq._core.CustomArithmetic

Condition this operation on registers holding a specific value.

Calling this method replaces prior value conditions. Pass the list-of-pairs overload to require several values simultaneously; conditions of different kinds are combined with logical AND.

参数:
  • cond -- Register name (str) or ID (int).

  • pos -- Value to match.

  • conds -- List of (register, value) pairs.

返回:

Self, for method chaining.

  1. conditioned_by_value(self: pysparq._core.CustomArithmetic, conds: collections.abc.Sequence[tuple[typing.SupportsInt | typing.SupportsIndex, typing.SupportsInt | typing.SupportsIndex]]) -> pysparq._core.CustomArithmetic

Condition this operation on registers holding a specific value.

Calling this method replaces prior value conditions. Pass the list-of-pairs overload to require several values simultaneously; conditions of different kinds are combined with logical AND.

参数:
  • cond -- Register name (str) or ID (int).

  • pos -- Value to match.

  • conds -- List of (register, value) pairs.

返回:

Self, for method chaining.