Arithmetic Operators

Arithmetic operators implement quantum integer arithmetic, including addition, multiplication, shifting, comparison, and other operations. See register types for the accepted register types and Examples for end-to-end usage.

Overview

Arithmetic operators overview

Operator

Operation

Type

Unitarity class

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

Circular left shift

In-place

BaseOperator

ShiftRight_InPlace

Circular right shift

In-place

BaseOperator

Compare_UInt_UInt

Comparison flags

Out-of-place

SelfAdjoint

Less_UInt_UInt

Less-than flag

Out-of-place

SelfAdjoint

Assign

dst ^= src

Out-of-place

SelfAdjoint

FlipBools

Bitwise NOT

In-place

SelfAdjoint

Swap_General_General

Swap two registers

In-place

SelfAdjoint

GetMid_UInt_UInt

Compute the midpoint

Out-of-place

SelfAdjoint

The table lists the most commonly used arithmetic operators; the full set including signed-integer, bitwise, and overflow-aware variants is rendered in Additional Arithmetic Operators below.

—

Addition Operators

Add_UInt_UInt (out-of-place addition)

class pysparq.Add_UInt_UInt

Add two unsigned integer registers.

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

Parameters:
  • 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).

Example

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.

Parameters:
  • cond – Register name (str) or ID (int) to condition on.

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

Returns:

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.

Parameters:
  • cond – Register name (str) or ID (int) to condition on.

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

Returns:

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.

Parameters:
  • cond – Register name (str) or ID (int) to condition on.

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

Returns:

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.

Parameters:
  • cond – Register name (str) or ID (int) to condition on.

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

Returns:

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.

Parameters:
  • cond – Register name (str) or ID (int).

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

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

Returns:

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.

Parameters:
  • cond – Register name (str) or ID (int).

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

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

Returns:

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.

Parameters:
  • cond – Register name (str) or ID (int).

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

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

Returns:

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.

Parameters:
  • cond – Register name (str) or ID (int).

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

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

Returns:

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.

Parameters:
  • cond – Register name (str) or ID (int) to condition on.

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

Returns:

Self, for method chaining.

Example

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.

Parameters:
  • cond – Register name (str) or ID (int) to condition on.

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

Returns:

Self, for method chaining.

Example

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.

Parameters:
  • cond – Register name (str) or ID (int) to condition on.

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

Returns:

Self, for method chaining.

Example

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.

Parameters:
  • cond – Register name (str) or ID (int) to condition on.

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

Returns:

Self, for method chaining.

Example

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.

Parameters:
  • cond – Register name (str) or ID (int).

  • pos – Value to match.

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

Returns:

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.

Parameters:
  • cond – Register name (str) or ID (int).

  • pos – Value to match.

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

Returns:

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.

Parameters:
  • cond – Register name (str) or ID (int).

  • pos – Value to match.

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

Returns:

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.

Parameters:
  • cond – Register name (str) or ID (int).

  • pos – Value to match.

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

Returns:

Self, for method chaining.

Operation: result ^= lhs + rhs

Unitarity guarantee: XOR mechanism — applying twice restores the original value.

Type constraints: All registers must be UnsignedInteger.

Bit constraints: No special requirements; the result is truncated to the output register size.

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)
# Output: |lhs=3,rhs=5,result=8⟩ : (1+0j)

# Apply again = undo
ps.Add_UInt_UInt("lhs", "rhs", "result")(state)
# result = 8 ^ 8 = 0

Add_UInt_UInt_InPlace (in-place addition)

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.

Parameters:
  • cond – Register name (str) or ID (int) to condition on.

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

Returns:

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.

Parameters:
  • cond – Register name (str) or ID (int) to condition on.

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

Returns:

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.

Parameters:
  • cond – Register name (str) or ID (int) to condition on.

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

Returns:

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.

Parameters:
  • cond – Register name (str) or ID (int) to condition on.

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

Returns:

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.

Parameters:
  • cond – Register name (str) or ID (int).

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

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

Returns:

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.

Parameters:
  • cond – Register name (str) or ID (int).

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

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

Returns:

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.

Parameters:
  • cond – Register name (str) or ID (int).

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

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

Returns:

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.

Parameters:
  • cond – Register name (str) or ID (int).

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

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

Returns:

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.

Parameters:
  • cond – Register name (str) or ID (int) to condition on.

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

Returns:

Self, for method chaining.

Example

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.

Parameters:
  • cond – Register name (str) or ID (int) to condition on.

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

Returns:

Self, for method chaining.

Example

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.

Parameters:
  • cond – Register name (str) or ID (int) to condition on.

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

Returns:

Self, for method chaining.

Example

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.

Parameters:
  • cond – Register name (str) or ID (int) to condition on.

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

Returns:

Self, for method chaining.

Example

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.

Parameters:
  • cond – Register name (str) or ID (int).

  • pos – Value to match.

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

Returns:

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.

Parameters:
  • cond – Register name (str) or ID (int).

  • pos – Value to match.

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

Returns:

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.

Parameters:
  • cond – Register name (str) or ID (int).

  • pos – Value to match.

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

Returns:

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.

Parameters:
  • cond – Register name (str) or ID (int).

  • pos – Value to match.

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

Returns:

Self, for method chaining.

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

Apply the adjoint (inverse) of this operation.

Parameters:

state – The quantum state to operate on.

Note: Only available for self-adjoint operators.

Operation: rhs = (rhs + lhs) mod 2^n

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

Type constraints: Both registers must be UnsignedInteger.

Bit constraints: Registers of the same size are recommended; otherwise the smaller value is truncated.

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 (overflow wraps around)
op = ps.Add_UInt_UInt_InPlace("lhs", "rhs")
op(state)

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

Add_UInt_ConstUInt (constant out-of-place addition)

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.

Parameters:
  • cond – Register name (str) or ID (int) to condition on.

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

Returns:

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.

Parameters:
  • cond – Register name (str) or ID (int) to condition on.

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

Returns:

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.

Parameters:
  • cond – Register name (str) or ID (int) to condition on.

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

Returns:

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.

Parameters:
  • cond – Register name (str) or ID (int) to condition on.

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

Returns:

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.

Parameters:
  • cond – Register name (str) or ID (int).

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

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

Returns:

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.

Parameters:
  • cond – Register name (str) or ID (int).

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

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

Returns:

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.

Parameters:
  • cond – Register name (str) or ID (int).

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

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

Returns:

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.

Parameters:
  • cond – Register name (str) or ID (int).

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

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

Returns:

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.

Parameters:
  • cond – Register name (str) or ID (int) to condition on.

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

Returns:

Self, for method chaining.

Example

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.

Parameters:
  • cond – Register name (str) or ID (int) to condition on.

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

Returns:

Self, for method chaining.

Example

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.

Parameters:
  • cond – Register name (str) or ID (int) to condition on.

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

Returns:

Self, for method chaining.

Example

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.

Parameters:
  • cond – Register name (str) or ID (int) to condition on.

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

Returns:

Self, for method chaining.

Example

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.

Parameters:
  • cond – Register name (str) or ID (int).

  • pos – Value to match.

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

Returns:

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.

Parameters:
  • cond – Register name (str) or ID (int).

  • pos – Value to match.

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

Returns:

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.

Parameters:
  • cond – Register name (str) or ID (int).

  • pos – Value to match.

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

Returns:

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.

Parameters:
  • cond – Register name (str) or ID (int).

  • pos – Value to match.

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

Returns:

Self, for method chaining.

Operation: result ^= lhs + const

Type constraints: All registers must be 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 (constant in-place addition)

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.

Parameters:
  • cond – Register name (str) or ID (int) to condition on.

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

Returns:

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.

Parameters:
  • cond – Register name (str) or ID (int) to condition on.

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

Returns:

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.

Parameters:
  • cond – Register name (str) or ID (int) to condition on.

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

Returns:

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.

Parameters:
  • cond – Register name (str) or ID (int) to condition on.

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

Returns:

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.

Parameters:
  • cond – Register name (str) or ID (int).

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

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

Returns:

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.

Parameters:
  • cond – Register name (str) or ID (int).

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

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

Returns:

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.

Parameters:
  • cond – Register name (str) or ID (int).

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

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

Returns:

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.

Parameters:
  • cond – Register name (str) or ID (int).

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

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

Returns:

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.

Parameters:
  • cond – Register name (str) or ID (int) to condition on.

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

Returns:

Self, for method chaining.

Example

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.

Parameters:
  • cond – Register name (str) or ID (int) to condition on.

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

Returns:

Self, for method chaining.

Example

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.

Parameters:
  • cond – Register name (str) or ID (int) to condition on.

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

Returns:

Self, for method chaining.

Example

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.

Parameters:
  • cond – Register name (str) or ID (int) to condition on.

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

Returns:

Self, for method chaining.

Example

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.

Parameters:
  • cond – Register name (str) or ID (int).

  • pos – Value to match.

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

Returns:

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.

Parameters:
  • cond – Register name (str) or ID (int).

  • pos – Value to match.

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

Returns:

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.

Parameters:
  • cond – Register name (str) or ID (int).

  • pos – Value to match.

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

Returns:

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.

Parameters:
  • cond – Register name (str) or ID (int).

  • pos – Value to match.

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

Returns:

Self, for method chaining.

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

Apply the adjoint (inverse) of this operation.

Parameters:

state – The quantum state to operate on.

Note: Only available for self-adjoint operators.

Operation: reg = (reg + const) mod 2^n

Dagger implementation: 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)

# Undo
op.dag(state)  # counter = 10

—

Multiplication Operators

Mult_UInt_ConstUInt (constant out-of-place multiplication)

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.

Parameters:
  • cond – Register name (str) or ID (int) to condition on.

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

Returns:

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.

Parameters:
  • cond – Register name (str) or ID (int) to condition on.

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

Returns:

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.

Parameters:
  • cond – Register name (str) or ID (int) to condition on.

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

Returns:

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.

Parameters:
  • cond – Register name (str) or ID (int) to condition on.

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

Returns:

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.

Parameters:
  • cond – Register name (str) or ID (int).

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

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

Returns:

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.

Parameters:
  • cond – Register name (str) or ID (int).

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

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

Returns:

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.

Parameters:
  • cond – Register name (str) or ID (int).

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

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

Returns:

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.

Parameters:
  • cond – Register name (str) or ID (int).

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

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

Returns:

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.

Parameters:
  • cond – Register name (str) or ID (int) to condition on.

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

Returns:

Self, for method chaining.

Example

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.

Parameters:
  • cond – Register name (str) or ID (int) to condition on.

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

Returns:

Self, for method chaining.

Example

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.

Parameters:
  • cond – Register name (str) or ID (int) to condition on.

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

Returns:

Self, for method chaining.

Example

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.

Parameters:
  • cond – Register name (str) or ID (int) to condition on.

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

Returns:

Self, for method chaining.

Example

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.

Parameters:
  • cond – Register name (str) or ID (int).

  • pos – Value to match.

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

Returns:

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.

Parameters:
  • cond – Register name (str) or ID (int).

  • pos – Value to match.

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

Returns:

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.

Parameters:
  • cond – Register name (str) or ID (int).

  • pos – Value to match.

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

Returns:

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.

Parameters:
  • cond – Register name (str) or ID (int).

  • pos – Value to match.

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

Returns:

Self, for method chaining.

Operation: result ^= input * const

Unitarity guarantee: XOR mechanism.

Warning

The multiplier should be odd in order to guarantee bijectivity. An even multiplier loses the information of the lowest bit.

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)

# Good: odd multiplier
ps.Mult_UInt_ConstUInt("input", 3, "result")(state)
# result = 0 ^ (3 * 3) = 9

# Avoid: even multipliers are not bijective
# ps.Mult_UInt_ConstUInt("input", 2, "result")(state)  # loses the LSB

Add_Mult_UInt_ConstUInt_InPlace (multiply-accumulate)

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.

Parameters:
  • cond – Register name (str) or ID (int) to condition on.

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

Returns:

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.

Parameters:
  • cond – Register name (str) or ID (int) to condition on.

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

Returns:

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.

Parameters:
  • cond – Register name (str) or ID (int) to condition on.

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

Returns:

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.

Parameters:
  • cond – Register name (str) or ID (int) to condition on.

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

Returns:

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.

Parameters:
  • cond – Register name (str) or ID (int).

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

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

Returns:

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.

Parameters:
  • cond – Register name (str) or ID (int).

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

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

Returns:

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.

Parameters:
  • cond – Register name (str) or ID (int).

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

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

Returns:

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.

Parameters:
  • cond – Register name (str) or ID (int).

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

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

Returns:

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.

Parameters:
  • cond – Register name (str) or ID (int) to condition on.

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

Returns:

Self, for method chaining.

Example

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.

Parameters:
  • cond – Register name (str) or ID (int) to condition on.

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

Returns:

Self, for method chaining.

Example

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.

Parameters:
  • cond – Register name (str) or ID (int) to condition on.

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

Returns:

Self, for method chaining.

Example

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.

Parameters:
  • cond – Register name (str) or ID (int) to condition on.

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

Returns:

Self, for method chaining.

Example

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.

Parameters:
  • cond – Register name (str) or ID (int).

  • pos – Value to match.

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

Returns:

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.

Parameters:
  • cond – Register name (str) or ID (int).

  • pos – Value to match.

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

Returns:

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.

Parameters:
  • cond – Register name (str) or ID (int).

  • pos – Value to match.

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

Returns:

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.

Parameters:
  • cond – Register name (str) or ID (int).

  • pos – Value to match.

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

Returns:

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.

Parameters:

state – The quantum state to operate on.

Note: Only available for self-adjoint operators.

Operation: result += input * const

Dagger implementation: 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)  # larger to avoid overflow

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)

# Undo
op.dag(state)

—

Modular Multiplication Operator

Mod_Mult_UInt_ConstUInt_InPlace (modular multiplication operator)

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.

Parameters:
  • cond – Register name (str) or ID (int) to condition on.

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

Returns:

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.

Parameters:
  • cond – Register name (str) or ID (int) to condition on.

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

Returns:

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.

Parameters:
  • cond – Register name (str) or ID (int) to condition on.

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

Returns:

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.

Parameters:
  • cond – Register name (str) or ID (int) to condition on.

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

Returns:

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.

Parameters:
  • cond – Register name (str) or ID (int).

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

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

Returns:

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.

Parameters:
  • cond – Register name (str) or ID (int).

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

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

Returns:

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.

Parameters:
  • cond – Register name (str) or ID (int).

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

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

Returns:

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.

Parameters:
  • cond – Register name (str) or ID (int).

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

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

Returns:

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.

Parameters:
  • cond – Register name (str) or ID (int) to condition on.

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

Returns:

Self, for method chaining.

Example

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.

Parameters:
  • cond – Register name (str) or ID (int) to condition on.

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

Returns:

Self, for method chaining.

Example

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.

Parameters:
  • cond – Register name (str) or ID (int) to condition on.

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

Returns:

Self, for method chaining.

Example

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.

Parameters:
  • cond – Register name (str) or ID (int) to condition on.

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

Returns:

Self, for method chaining.

Example

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.

Parameters:
  • cond – Register name (str) or ID (int).

  • pos – Value to match.

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

Returns:

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.

Parameters:
  • cond – Register name (str) or ID (int).

  • pos – Value to match.

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

Returns:

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.

Parameters:
  • cond – Register name (str) or ID (int).

  • pos – Value to match.

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

Returns:

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.

Parameters:
  • cond – Register name (str) or ID (int).

  • pos – Value to match.

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

Returns:

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.

Parameters:

state – The quantum state to operate on.

Note: Only available for self-adjoint operators.

Operation: y → y * a^(2^x) mod N (in-place modular multiplication)

Dagger: y → y * a^(-2^x) mod N (the modular inverse is computed with the extended Euclidean algorithm)

Type constraints: UnsignedInteger; the register size must be ≥ ⌈log₂(N)⌉.

Condition: a and N must be coprime (gcd(a, N) = 1); otherwise an exception is raised at construction.

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)

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

—

Shift Operators

ShiftLeft_InPlace (circular left shift)

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.

Parameters:
  • cond – Register name (str) or ID (int) to condition on.

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

Returns:

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.

Parameters:
  • cond – Register name (str) or ID (int) to condition on.

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

Returns:

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.

Parameters:
  • cond – Register name (str) or ID (int) to condition on.

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

Returns:

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.

Parameters:
  • cond – Register name (str) or ID (int) to condition on.

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

Returns:

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.

Parameters:
  • cond – Register name (str) or ID (int).

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

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

Returns:

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.

Parameters:
  • cond – Register name (str) or ID (int).

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

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

Returns:

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.

Parameters:
  • cond – Register name (str) or ID (int).

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

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

Returns:

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.

Parameters:
  • cond – Register name (str) or ID (int).

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

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

Returns:

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.

Parameters:
  • cond – Register name (str) or ID (int) to condition on.

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

Returns:

Self, for method chaining.

Example

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.

Parameters:
  • cond – Register name (str) or ID (int) to condition on.

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

Returns:

Self, for method chaining.

Example

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.

Parameters:
  • cond – Register name (str) or ID (int) to condition on.

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

Returns:

Self, for method chaining.

Example

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.

Parameters:
  • cond – Register name (str) or ID (int) to condition on.

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

Returns:

Self, for method chaining.

Example

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.

Parameters:
  • cond – Register name (str) or ID (int).

  • pos – Value to match.

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

Returns:

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.

Parameters:
  • cond – Register name (str) or ID (int).

  • pos – Value to match.

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

Returns:

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.

Parameters:
  • cond – Register name (str) or ID (int).

  • pos – Value to match.

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

Returns:

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.

Parameters:
  • cond – Register name (str) or ID (int).

  • pos – Value to match.

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

Returns:

Self, for method chaining.

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

Apply the adjoint (inverse) of this operation.

Parameters:

state – The quantum state to operate on.

Note: Only available for self-adjoint operators.

Operation: Circularly shifts left by digit bits

Dagger: .dag() is implemented and has the same effect as ShiftRight_InPlace(reg, digit); the two are daggers of each other.

Type constraints: UnsignedInteger or SignedInteger.

Bit constraints: digit <= register size.

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

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

ShiftRight_InPlace (circular right shift)

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.

Parameters:
  • cond – Register name (str) or ID (int) to condition on.

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

Returns:

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.

Parameters:
  • cond – Register name (str) or ID (int) to condition on.

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

Returns:

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.

Parameters:
  • cond – Register name (str) or ID (int) to condition on.

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

Returns:

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.

Parameters:
  • cond – Register name (str) or ID (int) to condition on.

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

Returns:

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.

Parameters:
  • cond – Register name (str) or ID (int).

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

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

Returns:

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.

Parameters:
  • cond – Register name (str) or ID (int).

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

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

Returns:

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.

Parameters:
  • cond – Register name (str) or ID (int).

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

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

Returns:

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.

Parameters:
  • cond – Register name (str) or ID (int).

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

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

Returns:

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.

Parameters:
  • cond – Register name (str) or ID (int) to condition on.

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

Returns:

Self, for method chaining.

Example

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.

Parameters:
  • cond – Register name (str) or ID (int) to condition on.

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

Returns:

Self, for method chaining.

Example

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.

Parameters:
  • cond – Register name (str) or ID (int) to condition on.

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

Returns:

Self, for method chaining.

Example

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.

Parameters:
  • cond – Register name (str) or ID (int) to condition on.

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

Returns:

Self, for method chaining.

Example

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.

Parameters:
  • cond – Register name (str) or ID (int).

  • pos – Value to match.

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

Returns:

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.

Parameters:
  • cond – Register name (str) or ID (int).

  • pos – Value to match.

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

Returns:

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.

Parameters:
  • cond – Register name (str) or ID (int).

  • pos – Value to match.

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

Returns:

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.

Parameters:
  • cond – Register name (str) or ID (int).

  • pos – Value to match.

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

Returns:

Self, for method chaining.

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

Apply the adjoint (inverse) of this operation.

Parameters:

state – The quantum state to operate on.

Note: Only available for self-adjoint operators.

Operation: Circularly shifts right by digit bits

Dagger: ShiftLeft_InPlace(reg, digit)

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

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

# ShiftLeft_InPlace and ShiftRight_InPlace are inverses of each other
ps.ShiftLeft_InPlace("reg", 1)(state)
# reg = 0b1010 = 10

—

Comparison Operators

Compare_UInt_UInt (comparison)

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.

Parameters:
  • cond – Register name (str) or ID (int) to condition on.

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

Returns:

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.

Parameters:
  • cond – Register name (str) or ID (int) to condition on.

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

Returns:

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.

Parameters:
  • cond – Register name (str) or ID (int) to condition on.

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

Returns:

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.

Parameters:
  • cond – Register name (str) or ID (int) to condition on.

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

Returns:

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.

Parameters:
  • cond – Register name (str) or ID (int).

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

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

Returns:

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.

Parameters:
  • cond – Register name (str) or ID (int).

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

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

Returns:

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.

Parameters:
  • cond – Register name (str) or ID (int).

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

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

Returns:

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.

Parameters:
  • cond – Register name (str) or ID (int).

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

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

Returns:

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.

Parameters:
  • cond – Register name (str) or ID (int) to condition on.

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

Returns:

Self, for method chaining.

Example

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.

Parameters:
  • cond – Register name (str) or ID (int) to condition on.

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

Returns:

Self, for method chaining.

Example

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.

Parameters:
  • cond – Register name (str) or ID (int) to condition on.

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

Returns:

Self, for method chaining.

Example

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.

Parameters:
  • cond – Register name (str) or ID (int) to condition on.

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

Returns:

Self, for method chaining.

Example

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.

Parameters:
  • cond – Register name (str) or ID (int).

  • pos – Value to match.

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

Returns:

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.

Parameters:
  • cond – Register name (str) or ID (int).

  • pos – Value to match.

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

Returns:

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.

Parameters:
  • cond – Register name (str) or ID (int).

  • pos – Value to match.

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

Returns:

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.

Parameters:
  • cond – Register name (str) or ID (int).

  • pos – Value to match.

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

Returns:

Self, for method chaining.

Operation: Sets less_flag and equal_flag based on lhs < rhs and lhs == rhs.

Type constraints: Inputs UnsignedInteger, outputs 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 (less-than comparison)

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.

Parameters:
  • cond – Register name (str) or ID (int) to condition on.

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

Returns:

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.

Parameters:
  • cond – Register name (str) or ID (int) to condition on.

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

Returns:

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.

Parameters:
  • cond – Register name (str) or ID (int) to condition on.

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

Returns:

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.

Parameters:
  • cond – Register name (str) or ID (int) to condition on.

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

Returns:

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.

Parameters:
  • cond – Register name (str) or ID (int).

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

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

Returns:

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.

Parameters:
  • cond – Register name (str) or ID (int).

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

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

Returns:

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.

Parameters:
  • cond – Register name (str) or ID (int).

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

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

Returns:

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.

Parameters:
  • cond – Register name (str) or ID (int).

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

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

Returns:

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.

Parameters:
  • cond – Register name (str) or ID (int) to condition on.

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

Returns:

Self, for method chaining.

Example

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.

Parameters:
  • cond – Register name (str) or ID (int) to condition on.

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

Returns:

Self, for method chaining.

Example

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.

Parameters:
  • cond – Register name (str) or ID (int) to condition on.

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

Returns:

Self, for method chaining.

Example

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.

Parameters:
  • cond – Register name (str) or ID (int) to condition on.

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

Returns:

Self, for method chaining.

Example

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.

Parameters:
  • cond – Register name (str) or ID (int).

  • pos – Value to match.

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

Returns:

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.

Parameters:
  • cond – Register name (str) or ID (int).

  • pos – Value to match.

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

Returns:

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.

Parameters:
  • cond – Register name (str) or ID (int).

  • pos – Value to match.

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

Returns:

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.

Parameters:
  • cond – Register name (str) or ID (int).

  • pos – Value to match.

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

Returns:

Self, for method chaining.

Operation: Sets only less_flag.

—

Other Operators

Assign (assignment)

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.

Parameters:
  • cond – Register name (str) or ID (int) to condition on.

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

Returns:

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.

Parameters:
  • cond – Register name (str) or ID (int) to condition on.

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

Returns:

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.

Parameters:
  • cond – Register name (str) or ID (int) to condition on.

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

Returns:

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.

Parameters:
  • cond – Register name (str) or ID (int) to condition on.

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

Returns:

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.

Parameters:
  • cond – Register name (str) or ID (int).

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

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

Returns:

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.

Parameters:
  • cond – Register name (str) or ID (int).

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

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

Returns:

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.

Parameters:
  • cond – Register name (str) or ID (int).

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

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

Returns:

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.

Parameters:
  • cond – Register name (str) or ID (int).

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

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

Returns:

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.

Parameters:
  • cond – Register name (str) or ID (int) to condition on.

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

Returns:

Self, for method chaining.

Example

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.

Parameters:
  • cond – Register name (str) or ID (int) to condition on.

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

Returns:

Self, for method chaining.

Example

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.

Parameters:
  • cond – Register name (str) or ID (int) to condition on.

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

Returns:

Self, for method chaining.

Example

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.

Parameters:
  • cond – Register name (str) or ID (int) to condition on.

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

Returns:

Self, for method chaining.

Example

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.

Parameters:
  • cond – Register name (str) or ID (int).

  • pos – Value to match.

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

Returns:

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.

Parameters:
  • cond – Register name (str) or ID (int).

  • pos – Value to match.

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

Returns:

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.

Parameters:
  • cond – Register name (str) or ID (int).

  • pos – Value to match.

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

Returns:

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.

Parameters:
  • cond – Register name (str) or ID (int).

  • pos – Value to match.

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

Returns:

Self, for method chaining.

Operation: dst ^= src

Unitarity guarantee: XOR mechanism.

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 (bitwise NOT)

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.

Parameters:
  • cond – Register name (str) or ID (int) to condition on.

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

Returns:

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.

Parameters:
  • cond – Register name (str) or ID (int) to condition on.

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

Returns:

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.

Parameters:
  • cond – Register name (str) or ID (int) to condition on.

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

Returns:

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.

Parameters:
  • cond – Register name (str) or ID (int) to condition on.

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

Returns:

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.

Parameters:
  • cond – Register name (str) or ID (int).

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

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

Returns:

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.

Parameters:
  • cond – Register name (str) or ID (int).

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

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

Returns:

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.

Parameters:
  • cond – Register name (str) or ID (int).

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

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

Returns:

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.

Parameters:
  • cond – Register name (str) or ID (int).

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

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

Returns:

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.

Parameters:
  • cond – Register name (str) or ID (int) to condition on.

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

Returns:

Self, for method chaining.

Example

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.

Parameters:
  • cond – Register name (str) or ID (int) to condition on.

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

Returns:

Self, for method chaining.

Example

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.

Parameters:
  • cond – Register name (str) or ID (int) to condition on.

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

Returns:

Self, for method chaining.

Example

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.

Parameters:
  • cond – Register name (str) or ID (int) to condition on.

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

Returns:

Self, for method chaining.

Example

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.

Parameters:
  • cond – Register name (str) or ID (int).

  • pos – Value to match.

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

Returns:

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.

Parameters:
  • cond – Register name (str) or ID (int).

  • pos – Value to match.

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

Returns:

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.

Parameters:
  • cond – Register name (str) or ID (int).

  • pos – Value to match.

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

Returns:

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.

Parameters:
  • cond – Register name (str) or ID (int).

  • pos – Value to match.

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

Returns:

Self, for method chaining.

Operation: reg = ~reg

Type constraints: Any integer type.

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 (swap)

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.

Parameters:
  • cond – Register name (str) or ID (int) to condition on.

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

Returns:

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.

Parameters:
  • cond – Register name (str) or ID (int) to condition on.

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

Returns:

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.

Parameters:
  • cond – Register name (str) or ID (int) to condition on.

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

Returns:

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.

Parameters:
  • cond – Register name (str) or ID (int) to condition on.

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

Returns:

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.

Parameters:
  • cond – Register name (str) or ID (int).

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

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

Returns:

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.

Parameters:
  • cond – Register name (str) or ID (int).

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

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

Returns:

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.

Parameters:
  • cond – Register name (str) or ID (int).

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

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

Returns:

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.

Parameters:
  • cond – Register name (str) or ID (int).

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

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

Returns:

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.

Parameters:
  • cond – Register name (str) or ID (int) to condition on.

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

Returns:

Self, for method chaining.

Example

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.

Parameters:
  • cond – Register name (str) or ID (int) to condition on.

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

Returns:

Self, for method chaining.

Example

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.

Parameters:
  • cond – Register name (str) or ID (int) to condition on.

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

Returns:

Self, for method chaining.

Example

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.

Parameters:
  • cond – Register name (str) or ID (int) to condition on.

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

Returns:

Self, for method chaining.

Example

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.

Parameters:
  • cond – Register name (str) or ID (int).

  • pos – Value to match.

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

Returns:

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.

Parameters:
  • cond – Register name (str) or ID (int).

  • pos – Value to match.

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

Returns:

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.

Parameters:
  • cond – Register name (str) or ID (int).

  • pos – Value to match.

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

Returns:

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.

Parameters:
  • cond – Register name (str) or ID (int).

  • pos – Value to match.

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

Returns:

Self, for method chaining.

Operation: Swaps the values of two registers.

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 (midpoint computation)

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.

Parameters:
  • cond – Register name (str) or ID (int) to condition on.

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

Returns:

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.

Parameters:
  • cond – Register name (str) or ID (int) to condition on.

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

Returns:

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.

Parameters:
  • cond – Register name (str) or ID (int) to condition on.

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

Returns:

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.

Parameters:
  • cond – Register name (str) or ID (int) to condition on.

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

Returns:

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.

Parameters:
  • cond – Register name (str) or ID (int).

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

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

Returns:

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.

Parameters:
  • cond – Register name (str) or ID (int).

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

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

Returns:

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.

Parameters:
  • cond – Register name (str) or ID (int).

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

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

Returns:

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.

Parameters:
  • cond – Register name (str) or ID (int).

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

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

Returns:

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.

Parameters:
  • cond – Register name (str) or ID (int) to condition on.

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

Returns:

Self, for method chaining.

Example

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.

Parameters:
  • cond – Register name (str) or ID (int) to condition on.

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

Returns:

Self, for method chaining.

Example

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.

Parameters:
  • cond – Register name (str) or ID (int) to condition on.

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

Returns:

Self, for method chaining.

Example

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.

Parameters:
  • cond – Register name (str) or ID (int) to condition on.

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

Returns:

Self, for method chaining.

Example

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.

Parameters:
  • cond – Register name (str) or ID (int).

  • pos – Value to match.

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

Returns:

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.

Parameters:
  • cond – Register name (str) or ID (int).

  • pos – Value to match.

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

Returns:

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.

Parameters:
  • cond – Register name (str) or ID (int).

  • pos – Value to match.

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

Returns:

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.

Parameters:
  • cond – Register name (str) or ID (int).

  • pos – Value to match.

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

Returns:

Self, for method chaining.

Operation: mid ^= (left + right) // 2

Purpose: Binary search algorithms.

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

Extended integer arithmetic beyond the operators above: signed-integer operations, bitwise logic, division/square roots, overflow-aware adds, and selection. All act on whole registers (see register types for the storage semantics of SignedInteger vs 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.

Parameters:
  • 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).

Example

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.

Parameters:
  • cond – Register name (str) or ID (int) to condition on.

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

Returns:

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.

Parameters:
  • cond – Register name (str) or ID (int) to condition on.

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

Returns:

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.

Parameters:
  • cond – Register name (str) or ID (int) to condition on.

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

Returns:

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.

Parameters:
  • cond – Register name (str) or ID (int) to condition on.

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

Returns:

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.

Parameters:
  • cond – Register name (str) or ID (int).

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

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

Returns:

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.

Parameters:
  • cond – Register name (str) or ID (int).

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

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

Returns:

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.

Parameters:
  • cond – Register name (str) or ID (int).

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

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

Returns:

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.

Parameters:
  • cond – Register name (str) or ID (int).

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

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

Returns:

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.

Parameters:
  • cond – Register name (str) or ID (int) to condition on.

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

Returns:

Self, for method chaining.

Example

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.

Parameters:
  • cond – Register name (str) or ID (int) to condition on.

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

Returns:

Self, for method chaining.

Example

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.

Parameters:
  • cond – Register name (str) or ID (int) to condition on.

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

Returns:

Self, for method chaining.

Example

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.

Parameters:
  • cond – Register name (str) or ID (int) to condition on.

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

Returns:

Self, for method chaining.

Example

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.

Parameters:
  • cond – Register name (str) or ID (int).

  • pos – Value to match.

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

Returns:

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.

Parameters:
  • cond – Register name (str) or ID (int).

  • pos – Value to match.

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

Returns:

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.

Parameters:
  • cond – Register name (str) or ID (int).

  • pos – Value to match.

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

Returns:

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.

Parameters:
  • cond – Register name (str) or ID (int).

  • pos – Value to match.

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

Returns:

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.

Parameters:
  • cond – Register name (str) or ID (int) to condition on.

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

Returns:

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.

Parameters:
  • cond – Register name (str) or ID (int) to condition on.

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

Returns:

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.

Parameters:
  • cond – Register name (str) or ID (int) to condition on.

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

Returns:

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.

Parameters:
  • cond – Register name (str) or ID (int) to condition on.

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

Returns:

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.

Parameters:
  • cond – Register name (str) or ID (int).

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

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

Returns:

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.

Parameters:
  • cond – Register name (str) or ID (int).

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

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

Returns:

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.

Parameters:
  • cond – Register name (str) or ID (int).

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

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

Returns:

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.

Parameters:
  • cond – Register name (str) or ID (int).

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

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

Returns:

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.

Parameters:
  • cond – Register name (str) or ID (int) to condition on.

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

Returns:

Self, for method chaining.

Example

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.

Parameters:
  • cond – Register name (str) or ID (int) to condition on.

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

Returns:

Self, for method chaining.

Example

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.

Parameters:
  • cond – Register name (str) or ID (int) to condition on.

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

Returns:

Self, for method chaining.

Example

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.

Parameters:
  • cond – Register name (str) or ID (int) to condition on.

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

Returns:

Self, for method chaining.

Example

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.

Parameters:
  • cond – Register name (str) or ID (int).

  • pos – Value to match.

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

Returns:

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.

Parameters:
  • cond – Register name (str) or ID (int).

  • pos – Value to match.

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

Returns:

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.

Parameters:
  • cond – Register name (str) or ID (int).

  • pos – Value to match.

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

Returns:

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.

Parameters:
  • cond – Register name (str) or ID (int).

  • pos – Value to match.

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

Returns:

Self, for method chaining.

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

Apply the adjoint (inverse) of this operation.

Parameters:

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.

Parameters:
  • reg – Name/ID of the input register.

  • res – Name/ID of the output register (result is XORed in).

Example

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.

Parameters:
  • cond – Register name (str) or ID (int) to condition on.

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

Returns:

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.

Parameters:
  • cond – Register name (str) or ID (int) to condition on.

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

Returns:

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.

Parameters:
  • cond – Register name (str) or ID (int) to condition on.

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

Returns:

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.

Parameters:
  • cond – Register name (str) or ID (int) to condition on.

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

Returns:

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.

Parameters:
  • cond – Register name (str) or ID (int).

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

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

Returns:

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.

Parameters:
  • cond – Register name (str) or ID (int).

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

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

Returns:

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.

Parameters:
  • cond – Register name (str) or ID (int).

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

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

Returns:

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.

Parameters:
  • cond – Register name (str) or ID (int).

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

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

Returns:

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.

Parameters:
  • cond – Register name (str) or ID (int) to condition on.

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

Returns:

Self, for method chaining.

Example

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.

Parameters:
  • cond – Register name (str) or ID (int) to condition on.

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

Returns:

Self, for method chaining.

Example

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.

Parameters:
  • cond – Register name (str) or ID (int) to condition on.

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

Returns:

Self, for method chaining.

Example

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.

Parameters:
  • cond – Register name (str) or ID (int) to condition on.

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

Returns:

Self, for method chaining.

Example

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.

Parameters:
  • cond – Register name (str) or ID (int).

  • pos – Value to match.

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

Returns:

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.

Parameters:
  • cond – Register name (str) or ID (int).

  • pos – Value to match.

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

Returns:

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.

Parameters:
  • cond – Register name (str) or ID (int).

  • pos – Value to match.

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

Returns:

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.

Parameters:
  • cond – Register name (str) or ID (int).

  • pos – Value to match.

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

Returns:

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

Parameters:
  • reg – Name/ID of the SignedInteger input register.

  • res – Name/ID of the UnsignedInteger output register (result is XORed in).

Example

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.

Parameters:
  • cond – Register name (str) or ID (int) to condition on.

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

Returns:

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.

Parameters:
  • cond – Register name (str) or ID (int) to condition on.

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

Returns:

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.

Parameters:
  • cond – Register name (str) or ID (int) to condition on.

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

Returns:

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.

Parameters:
  • cond – Register name (str) or ID (int) to condition on.

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

Returns:

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.

Parameters:
  • cond – Register name (str) or ID (int).

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

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

Returns:

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.

Parameters:
  • cond – Register name (str) or ID (int).

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

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

Returns:

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.

Parameters:
  • cond – Register name (str) or ID (int).

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

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

Returns:

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.

Parameters:
  • cond – Register name (str) or ID (int).

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

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

Returns:

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.

Parameters:
  • cond – Register name (str) or ID (int) to condition on.

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

Returns:

Self, for method chaining.

Example

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.

Parameters:
  • cond – Register name (str) or ID (int) to condition on.

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

Returns:

Self, for method chaining.

Example

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.

Parameters:
  • cond – Register name (str) or ID (int) to condition on.

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

Returns:

Self, for method chaining.

Example

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.

Parameters:
  • cond – Register name (str) or ID (int) to condition on.

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

Returns:

Self, for method chaining.

Example

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.

Parameters:
  • cond – Register name (str) or ID (int).

  • pos – Value to match.

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

Returns:

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.

Parameters:
  • cond – Register name (str) or ID (int).

  • pos – Value to match.

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

Returns:

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.

Parameters:
  • cond – Register name (str) or ID (int).

  • pos – Value to match.

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

Returns:

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.

Parameters:
  • cond – Register name (str) or ID (int).

  • pos – Value to match.

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

Returns:

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.

Parameters:
  • 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).

Example

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.

Parameters:
  • cond – Register name (str) or ID (int) to condition on.

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

Returns:

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.

Parameters:
  • cond – Register name (str) or ID (int) to condition on.

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

Returns:

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.

Parameters:
  • cond – Register name (str) or ID (int) to condition on.

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

Returns:

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.

Parameters:
  • cond – Register name (str) or ID (int) to condition on.

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

Returns:

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.

Parameters:
  • cond – Register name (str) or ID (int).

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

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

Returns:

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.

Parameters:
  • cond – Register name (str) or ID (int).

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

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

Returns:

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.

Parameters:
  • cond – Register name (str) or ID (int).

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

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

Returns:

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.

Parameters:
  • cond – Register name (str) or ID (int).

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

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

Returns:

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.

Parameters:
  • cond – Register name (str) or ID (int) to condition on.

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

Returns:

Self, for method chaining.

Example

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.

Parameters:
  • cond – Register name (str) or ID (int) to condition on.

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

Returns:

Self, for method chaining.

Example

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.

Parameters:
  • cond – Register name (str) or ID (int) to condition on.

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

Returns:

Self, for method chaining.

Example

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.

Parameters:
  • cond – Register name (str) or ID (int) to condition on.

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

Returns:

Self, for method chaining.

Example

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.

Parameters:
  • cond – Register name (str) or ID (int).

  • pos – Value to match.

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

Returns:

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.

Parameters:
  • cond – Register name (str) or ID (int).

  • pos – Value to match.

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

Returns:

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.

Parameters:
  • cond – Register name (str) or ID (int).

  • pos – Value to match.

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

Returns:

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.

Parameters:
  • cond – Register name (str) or ID (int).

  • pos – Value to match.

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

Returns:

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.

Parameters:
  • 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).

Example

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.

Parameters:
  • cond – Register name (str) or ID (int) to condition on.

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

Returns:

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.

Parameters:
  • cond – Register name (str) or ID (int) to condition on.

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

Returns:

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.

Parameters:
  • cond – Register name (str) or ID (int) to condition on.

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

Returns:

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.

Parameters:
  • cond – Register name (str) or ID (int) to condition on.

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

Returns:

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.

Parameters:
  • cond – Register name (str) or ID (int).

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

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

Returns:

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.

Parameters:
  • cond – Register name (str) or ID (int).

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

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

Returns:

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.

Parameters:
  • cond – Register name (str) or ID (int).

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

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

Returns:

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.

Parameters:
  • cond – Register name (str) or ID (int).

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

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

Returns:

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.

Parameters:
  • cond – Register name (str) or ID (int) to condition on.

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

Returns:

Self, for method chaining.

Example

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.

Parameters:
  • cond – Register name (str) or ID (int) to condition on.

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

Returns:

Self, for method chaining.

Example

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.

Parameters:
  • cond – Register name (str) or ID (int) to condition on.

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

Returns:

Self, for method chaining.

Example

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.

Parameters:
  • cond – Register name (str) or ID (int) to condition on.

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

Returns:

Self, for method chaining.

Example

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.

Parameters:
  • cond – Register name (str) or ID (int).

  • pos – Value to match.

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

Returns:

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.

Parameters:
  • cond – Register name (str) or ID (int).

  • pos – Value to match.

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

Returns:

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.

Parameters:
  • cond – Register name (str) or ID (int).

  • pos – Value to match.

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

Returns:

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.

Parameters:
  • cond – Register name (str) or ID (int).

  • pos – Value to match.

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

Returns:

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.

Parameters:
  • reg – Name/ID of the input register.

  • res – Name/ID of the output register (result is XORed in).

Example

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.

Parameters:
  • cond – Register name (str) or ID (int) to condition on.

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

Returns:

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.

Parameters:
  • cond – Register name (str) or ID (int) to condition on.

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

Returns:

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.

Parameters:
  • cond – Register name (str) or ID (int) to condition on.

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

Returns:

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.

Parameters:
  • cond – Register name (str) or ID (int) to condition on.

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

Returns:

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.

Parameters:
  • cond – Register name (str) or ID (int).

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

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

Returns:

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.

Parameters:
  • cond – Register name (str) or ID (int).

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

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

Returns:

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.

Parameters:
  • cond – Register name (str) or ID (int).

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

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

Returns:

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.

Parameters:
  • cond – Register name (str) or ID (int).

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

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

Returns:

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.

Parameters:
  • cond – Register name (str) or ID (int) to condition on.

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

Returns:

Self, for method chaining.

Example

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.

Parameters:
  • cond – Register name (str) or ID (int) to condition on.

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

Returns:

Self, for method chaining.

Example

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.

Parameters:
  • cond – Register name (str) or ID (int) to condition on.

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

Returns:

Self, for method chaining.

Example

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.

Parameters:
  • cond – Register name (str) or ID (int) to condition on.

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

Returns:

Self, for method chaining.

Example

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.

Parameters:
  • cond – Register name (str) or ID (int).

  • pos – Value to match.

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

Returns:

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.

Parameters:
  • cond – Register name (str) or ID (int).

  • pos – Value to match.

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

Returns:

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.

Parameters:
  • cond – Register name (str) or ID (int).

  • pos – Value to match.

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

Returns:

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.

Parameters:
  • cond – Register name (str) or ID (int).

  • pos – Value to match.

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

Returns:

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.

Parameters:
  • 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).

Example

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.

Parameters:
  • cond – Register name (str) or ID (int) to condition on.

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

Returns:

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.

Parameters:
  • cond – Register name (str) or ID (int) to condition on.

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

Returns:

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.

Parameters:
  • cond – Register name (str) or ID (int) to condition on.

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

Returns:

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.

Parameters:
  • cond – Register name (str) or ID (int) to condition on.

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

Returns:

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.

Parameters:
  • cond – Register name (str) or ID (int).

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

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

Returns:

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.

Parameters:
  • cond – Register name (str) or ID (int).

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

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

Returns:

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.

Parameters:
  • cond – Register name (str) or ID (int).

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

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

Returns:

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.

Parameters:
  • cond – Register name (str) or ID (int).

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

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

Returns:

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.

Parameters:
  • cond – Register name (str) or ID (int) to condition on.

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

Returns:

Self, for method chaining.

Example

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.

Parameters:
  • cond – Register name (str) or ID (int) to condition on.

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

Returns:

Self, for method chaining.

Example

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.

Parameters:
  • cond – Register name (str) or ID (int) to condition on.

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

Returns:

Self, for method chaining.

Example

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.

Parameters:
  • cond – Register name (str) or ID (int) to condition on.

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

Returns:

Self, for method chaining.

Example

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.

Parameters:
  • cond – Register name (str) or ID (int).

  • pos – Value to match.

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

Returns:

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.

Parameters:
  • cond – Register name (str) or ID (int).

  • pos – Value to match.

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

Returns:

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.

Parameters:
  • cond – Register name (str) or ID (int).

  • pos – Value to match.

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

Returns:

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.

Parameters:
  • cond – Register name (str) or ID (int).

  • pos – Value to match.

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

Returns:

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.

Parameters:
  • 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).

Example

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.

Parameters:
  • cond – Register name (str) or ID (int) to condition on.

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

Returns:

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.

Parameters:
  • cond – Register name (str) or ID (int) to condition on.

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

Returns:

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.

Parameters:
  • cond – Register name (str) or ID (int) to condition on.

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

Returns:

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.

Parameters:
  • cond – Register name (str) or ID (int) to condition on.

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

Returns:

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.

Parameters:
  • cond – Register name (str) or ID (int).

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

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

Returns:

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.

Parameters:
  • cond – Register name (str) or ID (int).

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

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

Returns:

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.

Parameters:
  • cond – Register name (str) or ID (int).

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

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

Returns:

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.

Parameters:
  • cond – Register name (str) or ID (int).

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

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

Returns:

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.

Parameters:
  • cond – Register name (str) or ID (int) to condition on.

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

Returns:

Self, for method chaining.

Example

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.

Parameters:
  • cond – Register name (str) or ID (int) to condition on.

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

Returns:

Self, for method chaining.

Example

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.

Parameters:
  • cond – Register name (str) or ID (int) to condition on.

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

Returns:

Self, for method chaining.

Example

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.

Parameters:
  • cond – Register name (str) or ID (int) to condition on.

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

Returns:

Self, for method chaining.

Example

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.

Parameters:
  • cond – Register name (str) or ID (int).

  • pos – Value to match.

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

Returns:

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.

Parameters:
  • cond – Register name (str) or ID (int).

  • pos – Value to match.

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

Returns:

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.

Parameters:
  • cond – Register name (str) or ID (int).

  • pos – Value to match.

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

Returns:

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.

Parameters:
  • cond – Register name (str) or ID (int).

  • pos – Value to match.

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

Returns:

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.

Parameters:
  • 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).

Example

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.

Parameters:
  • cond – Register name (str) or ID (int) to condition on.

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

Returns:

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.

Parameters:
  • cond – Register name (str) or ID (int) to condition on.

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

Returns:

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.

Parameters:
  • cond – Register name (str) or ID (int) to condition on.

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

Returns:

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.

Parameters:
  • cond – Register name (str) or ID (int) to condition on.

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

Returns:

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.

Parameters:
  • cond – Register name (str) or ID (int).

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

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

Returns:

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.

Parameters:
  • cond – Register name (str) or ID (int).

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

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

Returns:

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.

Parameters:
  • cond – Register name (str) or ID (int).

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

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

Returns:

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.

Parameters:
  • cond – Register name (str) or ID (int).

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

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

Returns:

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.

Parameters:
  • cond – Register name (str) or ID (int) to condition on.

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

Returns:

Self, for method chaining.

Example

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.

Parameters:
  • cond – Register name (str) or ID (int) to condition on.

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

Returns:

Self, for method chaining.

Example

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.

Parameters:
  • cond – Register name (str) or ID (int) to condition on.

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

Returns:

Self, for method chaining.

Example

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.

Parameters:
  • cond – Register name (str) or ID (int) to condition on.

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

Returns:

Self, for method chaining.

Example

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.

Parameters:
  • cond – Register name (str) or ID (int).

  • pos – Value to match.

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

Returns:

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.

Parameters:
  • cond – Register name (str) or ID (int).

  • pos – Value to match.

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

Returns:

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.

Parameters:
  • cond – Register name (str) or ID (int).

  • pos – Value to match.

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

Returns:

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.

Parameters:
  • cond – Register name (str) or ID (int).

  • pos – Value to match.

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

Returns:

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.

Parameters:
  • 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).

Example

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.

Parameters:
  • cond – Register name (str) or ID (int) to condition on.

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

Returns:

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.

Parameters:
  • cond – Register name (str) or ID (int) to condition on.

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

Returns:

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.

Parameters:
  • cond – Register name (str) or ID (int) to condition on.

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

Returns:

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.

Parameters:
  • cond – Register name (str) or ID (int) to condition on.

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

Returns:

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.

Parameters:
  • cond – Register name (str) or ID (int).

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

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

Returns:

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.

Parameters:
  • cond – Register name (str) or ID (int).

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

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

Returns:

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.

Parameters:
  • cond – Register name (str) or ID (int).

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

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

Returns:

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.

Parameters:
  • cond – Register name (str) or ID (int).

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

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

Returns:

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.

Parameters:
  • cond – Register name (str) or ID (int) to condition on.

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

Returns:

Self, for method chaining.

Example

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.

Parameters:
  • cond – Register name (str) or ID (int) to condition on.

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

Returns:

Self, for method chaining.

Example

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.

Parameters:
  • cond – Register name (str) or ID (int) to condition on.

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

Returns:

Self, for method chaining.

Example

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.

Parameters:
  • cond – Register name (str) or ID (int) to condition on.

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

Returns:

Self, for method chaining.

Example

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.

Parameters:
  • cond – Register name (str) or ID (int).

  • pos – Value to match.

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

Returns:

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.

Parameters:
  • cond – Register name (str) or ID (int).

  • pos – Value to match.

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

Returns:

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.

Parameters:
  • cond – Register name (str) or ID (int).

  • pos – Value to match.

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

Returns:

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.

Parameters:
  • cond – Register name (str) or ID (int).

  • pos – Value to match.

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

Returns:

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.

Parameters:
  • 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).

Example

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.

Parameters:
  • cond – Register name (str) or ID (int) to condition on.

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

Returns:

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.

Parameters:
  • cond – Register name (str) or ID (int) to condition on.

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

Returns:

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.

Parameters:
  • cond – Register name (str) or ID (int) to condition on.

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

Returns:

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.

Parameters:
  • cond – Register name (str) or ID (int) to condition on.

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

Returns:

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.

Parameters:
  • cond – Register name (str) or ID (int).

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

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

Returns:

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.

Parameters:
  • cond – Register name (str) or ID (int).

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

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

Returns:

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.

Parameters:
  • cond – Register name (str) or ID (int).

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

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

Returns:

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.

Parameters:
  • cond – Register name (str) or ID (int).

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

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

Returns:

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.

Parameters:
  • cond – Register name (str) or ID (int) to condition on.

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

Returns:

Self, for method chaining.

Example

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.

Parameters:
  • cond – Register name (str) or ID (int) to condition on.

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

Returns:

Self, for method chaining.

Example

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.

Parameters:
  • cond – Register name (str) or ID (int) to condition on.

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

Returns:

Self, for method chaining.

Example

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.

Parameters:
  • cond – Register name (str) or ID (int) to condition on.

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

Returns:

Self, for method chaining.

Example

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.

Parameters:
  • cond – Register name (str) or ID (int).

  • pos – Value to match.

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

Returns:

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.

Parameters:
  • cond – Register name (str) or ID (int).

  • pos – Value to match.

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

Returns:

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.

Parameters:
  • cond – Register name (str) or ID (int).

  • pos – Value to match.

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

Returns:

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.

Parameters:
  • cond – Register name (str) or ID (int).

  • pos – Value to match.

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

Returns:

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.

Parameters:
  • 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).

Example

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.

Parameters:
  • cond – Register name (str) or ID (int) to condition on.

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

Returns:

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.

Parameters:
  • cond – Register name (str) or ID (int) to condition on.

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

Returns:

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.

Parameters:
  • cond – Register name (str) or ID (int) to condition on.

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

Returns:

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.

Parameters:
  • cond – Register name (str) or ID (int) to condition on.

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

Returns:

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.

Parameters:
  • cond – Register name (str) or ID (int).

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

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

Returns:

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.

Parameters:
  • cond – Register name (str) or ID (int).

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

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

Returns:

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.

Parameters:
  • cond – Register name (str) or ID (int).

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

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

Returns:

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.

Parameters:
  • cond – Register name (str) or ID (int).

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

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

Returns:

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.

Parameters:
  • cond – Register name (str) or ID (int) to condition on.

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

Returns:

Self, for method chaining.

Example

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.

Parameters:
  • cond – Register name (str) or ID (int) to condition on.

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

Returns:

Self, for method chaining.

Example

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.

Parameters:
  • cond – Register name (str) or ID (int) to condition on.

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

Returns:

Self, for method chaining.

Example

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.

Parameters:
  • cond – Register name (str) or ID (int) to condition on.

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

Returns:

Self, for method chaining.

Example

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.

Parameters:
  • cond – Register name (str) or ID (int).

  • pos – Value to match.

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

Returns:

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.

Parameters:
  • cond – Register name (str) or ID (int).

  • pos – Value to match.

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

Returns:

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.

Parameters:
  • cond – Register name (str) or ID (int).

  • pos – Value to match.

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

Returns:

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.

Parameters:
  • cond – Register name (str) or ID (int).

  • pos – Value to match.

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

Returns:

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.

Parameters:
  • 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).

Example

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.

Parameters:
  • cond – Register name (str) or ID (int) to condition on.

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

Returns:

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.

Parameters:
  • cond – Register name (str) or ID (int) to condition on.

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

Returns:

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.

Parameters:
  • cond – Register name (str) or ID (int) to condition on.

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

Returns:

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.

Parameters:
  • cond – Register name (str) or ID (int) to condition on.

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

Returns:

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.

Parameters:
  • cond – Register name (str) or ID (int).

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

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

Returns:

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.

Parameters:
  • cond – Register name (str) or ID (int).

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

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

Returns:

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.

Parameters:
  • cond – Register name (str) or ID (int).

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

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

Returns:

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.

Parameters:
  • cond – Register name (str) or ID (int).

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

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

Returns:

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.

Parameters:
  • cond – Register name (str) or ID (int) to condition on.

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

Returns:

Self, for method chaining.

Example

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.

Parameters:
  • cond – Register name (str) or ID (int) to condition on.

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

Returns:

Self, for method chaining.

Example

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.

Parameters:
  • cond – Register name (str) or ID (int) to condition on.

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

Returns:

Self, for method chaining.

Example

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.

Parameters:
  • cond – Register name (str) or ID (int) to condition on.

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

Returns:

Self, for method chaining.

Example

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.

Parameters:
  • cond – Register name (str) or ID (int).

  • pos – Value to match.

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

Returns:

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.

Parameters:
  • cond – Register name (str) or ID (int).

  • pos – Value to match.

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

Returns:

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.

Parameters:
  • cond – Register name (str) or ID (int).

  • pos – Value to match.

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

Returns:

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.

Parameters:
  • cond – Register name (str) or ID (int).

  • pos – Value to match.

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

Returns:

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.

Parameters:
  • 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).

Example

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.

Parameters:
  • cond – Register name (str) or ID (int) to condition on.

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

Returns:

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.

Parameters:
  • cond – Register name (str) or ID (int) to condition on.

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

Returns:

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.

Parameters:
  • cond – Register name (str) or ID (int) to condition on.

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

Returns:

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.

Parameters:
  • cond – Register name (str) or ID (int) to condition on.

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

Returns:

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.

Parameters:
  • cond – Register name (str) or ID (int).

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

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

Returns:

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.

Parameters:
  • cond – Register name (str) or ID (int).

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

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

Returns:

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.

Parameters:
  • cond – Register name (str) or ID (int).

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

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

Returns:

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.

Parameters:
  • cond – Register name (str) or ID (int).

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

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

Returns:

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.

Parameters:
  • cond – Register name (str) or ID (int) to condition on.

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

Returns:

Self, for method chaining.

Example

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.

Parameters:
  • cond – Register name (str) or ID (int) to condition on.

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

Returns:

Self, for method chaining.

Example

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.

Parameters:
  • cond – Register name (str) or ID (int) to condition on.

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

Returns:

Self, for method chaining.

Example

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.

Parameters:
  • cond – Register name (str) or ID (int) to condition on.

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

Returns:

Self, for method chaining.

Example

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.

Parameters:
  • cond – Register name (str) or ID (int).

  • pos – Value to match.

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

Returns:

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.

Parameters:
  • cond – Register name (str) or ID (int).

  • pos – Value to match.

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

Returns:

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.

Parameters:
  • cond – Register name (str) or ID (int).

  • pos – Value to match.

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

Returns:

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.

Parameters:
  • cond – Register name (str) or ID (int).

  • pos – Value to match.

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

Returns:

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.

Parameters:
  • reg – Name/ID of the UnsignedInteger input register.

  • flag – Name/ID of the width-1 Boolean flag register (result is XORed in).

Example

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.

Parameters:
  • cond – Register name (str) or ID (int) to condition on.

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

Returns:

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.

Parameters:
  • cond – Register name (str) or ID (int) to condition on.

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

Returns:

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.

Parameters:
  • cond – Register name (str) or ID (int) to condition on.

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

Returns:

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.

Parameters:
  • cond – Register name (str) or ID (int) to condition on.

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

Returns:

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.

Parameters:
  • cond – Register name (str) or ID (int).

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

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

Returns:

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.

Parameters:
  • cond – Register name (str) or ID (int).

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

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

Returns:

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.

Parameters:
  • cond – Register name (str) or ID (int).

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

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

Returns:

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.

Parameters:
  • cond – Register name (str) or ID (int).

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

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

Returns:

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.

Parameters:
  • cond – Register name (str) or ID (int) to condition on.

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

Returns:

Self, for method chaining.

Example

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.

Parameters:
  • cond – Register name (str) or ID (int) to condition on.

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

Returns:

Self, for method chaining.

Example

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.

Parameters:
  • cond – Register name (str) or ID (int) to condition on.

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

Returns:

Self, for method chaining.

Example

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.

Parameters:
  • cond – Register name (str) or ID (int) to condition on.

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

Returns:

Self, for method chaining.

Example

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.

Parameters:
  • cond – Register name (str) or ID (int).

  • pos – Value to match.

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

Returns:

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.

Parameters:
  • cond – Register name (str) or ID (int).

  • pos – Value to match.

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

Returns:

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.

Parameters:
  • cond – Register name (str) or ID (int).

  • pos – Value to match.

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

Returns:

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.

Parameters:
  • cond – Register name (str) or ID (int).

  • pos – Value to match.

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

Returns:

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.

Parameters:
  • cond – Register name (str) or ID (int) to condition on.

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

Returns:

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.

Parameters:
  • cond – Register name (str) or ID (int) to condition on.

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

Returns:

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.

Parameters:
  • cond – Register name (str) or ID (int) to condition on.

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

Returns:

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.

Parameters:
  • cond – Register name (str) or ID (int) to condition on.

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

Returns:

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.

Parameters:
  • cond – Register name (str) or ID (int).

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

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

Returns:

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.

Parameters:
  • cond – Register name (str) or ID (int).

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

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

Returns:

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.

Parameters:
  • cond – Register name (str) or ID (int).

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

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

Returns:

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.

Parameters:
  • cond – Register name (str) or ID (int).

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

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

Returns:

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.

Parameters:
  • cond – Register name (str) or ID (int) to condition on.

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

Returns:

Self, for method chaining.

Example

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.

Parameters:
  • cond – Register name (str) or ID (int) to condition on.

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

Returns:

Self, for method chaining.

Example

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.

Parameters:
  • cond – Register name (str) or ID (int) to condition on.

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

Returns:

Self, for method chaining.

Example

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.

Parameters:
  • cond – Register name (str) or ID (int) to condition on.

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

Returns:

Self, for method chaining.

Example

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.

Parameters:
  • cond – Register name (str) or ID (int).

  • pos – Value to match.

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

Returns:

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.

Parameters:
  • cond – Register name (str) or ID (int).

  • pos – Value to match.

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

Returns:

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.

Parameters:
  • cond – Register name (str) or ID (int).

  • pos – Value to match.

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

Returns:

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.

Parameters:
  • cond – Register name (str) or ID (int).

  • pos – Value to match.

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

Returns:

Self, for method chaining.