Register/System Operations and Debugging

Register Lifetime Operations (SparQ/include/system_operations.h)

System operations definitions.

Implements the basic operations on quantum systems, including system splitting, merging, resetting, and register splitting/merging/moving/adding/removing operations

Defines

SPLIT_BY_CONDITIONS

Macro that splits systems by conditions.

MERGE_BY_CONDITIONS

Macro that merges systems by conditions.

namespace qram_simulator

QRAM sparse state simulator namespace.

Contains all classes, functions, and data structures related to quantum computing simulation

Functions

void split_systems(std::vector<System> &new_state, std::vector<System> &old_state, const std::vector<size_t> &condition_variable_nonzeros, const std::vector<size_t> &condition_variable_all_ones, const std::vector<std::pair<size_t, size_t>> &condition_variable_by_bit, const std::vector<std::pair<size_t, size_t>> &condition_variable_by_value)

Split systems (in-place version)

Parameters:
  • new_state – New state vector

  • old_state – Old state vector

  • condition_variable_nonzeros – Nonzero condition variables

  • condition_variable_all_ones – All-ones condition variables

  • condition_variable_by_bit – Per-bit condition variables

  • condition_variable_by_value – Per-value condition variables

std::vector<System> split_systems(std::vector<System> &state, const std::vector<size_t> &condition_variable_nonzeros, const std::vector<size_t> &condition_variable_all_ones, const std::vector<std::pair<size_t, size_t>> &condition_variable_by_bit, const std::vector<std::pair<size_t, size_t>> &condition_variable_by_value)

Split systems (return-value version)

Parameters:
  • state – State vector

  • condition_variable_nonzeros – Nonzero condition variables

  • condition_variable_all_ones – All-ones condition variables

  • condition_variable_by_bit – Per-bit condition variables

  • condition_variable_by_value – Per-value condition variables

Returns:

The split state vector

SparseState split_systems(SparseState &state, const std::vector<size_t> &condition_variable_nonzeros, const std::vector<size_t> &condition_variable_all_ones, const std::vector<std::pair<size_t, size_t>> &condition_variable_by_bit, const std::vector<std::pair<size_t, size_t>> &condition_variable_by_value)

Split a sparse state.

Parameters:
  • state – Sparse state

  • condition_variable_nonzeros – Nonzero condition variables

  • condition_variable_all_ones – All-ones condition variables

  • condition_variable_by_bit – Per-bit condition variables

  • condition_variable_by_value – Per-value condition variables

Returns:

The split sparse state

void combine_systems(std::vector<System> &to, const std::vector<System> &from)

Merge systems (into a target)

Parameters:
  • to – Target state vector

  • from – Source state vector

void combine_systems(SparseState &to, const SparseState &from)

Merge sparse states (into a target)

Parameters:
  • to – Target sparse state

  • from – Source sparse state

void reset_systems(std::vector<System> &state)

Reset systems.

Parameters:

state – System state vector

void reset_systems(SparseState &state)

Reset a sparse state.

Parameters:

state – Sparse state

inline void add_systems(std::vector<System> &current_state, const std::vector<System> &new_state, double coef)

Add systems (with a coefficient)

Parameters:
  • current_state – Current state vector

  • new_state – New state vector

  • coef – Coefficient

inline void add_systems(SparseState &current, const SparseState &new_state, double coef)

Add sparse states (with a coefficient)

Parameters:
  • current – Current sparse state

  • new_state – New sparse state

  • coef – Coefficient

inline void print_state_to_file(std::vector<System> &state, const std::string &filename, int precision = 16)

Print a state to a file.

Parameters:
  • state – System state vector

  • filename – File name

  • precision – Precision (16 by default)

Throws:

Throws – an exception when the file cannot be opened

struct AddRegister
#include <system_operations.h>

Add-register operation.

Adds a new register to the system

Public Functions

AddRegister(std::string_view register_name_, StateStorageType type_, size_t size_)

Constructor.

Parameters:
  • register_name_ – Register name

  • type_ – Register type

  • size_ – Register size

size_t operator()(std::vector<System> &state) const

Apply the add operation.

Parameters:

state – System state vector

Returns:

New register ID

size_t operator()(SparseState &state) const

Apply the add operation (sparse state version)

Parameters:

state – Sparse state

Returns:

New register ID

Public Members

std::string register_name

Register name.

StateStorageType type

Register type.

size_t size

Register size.

struct AddRegisterWithHadamard
#include <system_operations.h>

Add-register-and-apply-Hadamard operation.

Adds a new register and initializes it to a uniform superposition state

Public Functions

AddRegisterWithHadamard(std::string_view register_name_, StateStorageType type_, size_t size_)

Constructor.

Parameters:
  • register_name_ – Register name

  • type_ – Register type

  • size_ – Register size

size_t operator()(std::vector<System> &state) const

Apply the add-and-Hadamard operation.

Parameters:

state – System state vector

Returns:

New register ID

size_t operator()(SparseState &state) const

Apply the add-and-Hadamard operation (sparse state version)

Parameters:

state – Sparse state

Returns:

New register ID

Public Members

std::string register_name

Register name.

StateStorageType type

Register type.

size_t size

Register size.

struct ClearZero : public qram_simulator::SelfAdjointOperator
#include <system_operations.h>

Clear-zero operation.

Removes the state components whose amplitudes are close to zero

Public Functions

inline ClearZero()

Default constructor (uses the default epsilon)

inline ClearZero(double eps_)

Constructor (with a specified threshold)

Parameters:

eps_ – Clear-zero threshold

virtual void operator()(std::vector<System> &system_states) const

Apply the clear-zero operation.

Parameters:

system_states – System state vector

inline virtual void dag(std::vector<System> &state) const override

Apply the dagger operation (the dagger of a self-adjoint operator equals itself)

Parameters:

state – System state vector

inline virtual void dag(SparseState &state) const override

Apply dagger to a SparseState.

Parameters:

state – Sparse state

inline virtual void dag(std::vector<System> &state) const

Apply the conjugate transpose (dagger) operation.

Parameters:

state – System state vector

Throws:

Throws – a not-implemented exception by default

inline virtual void dag(SparseState &state) const

Apply dagger to a SparseState.

Parameters:

state – Sparse state

Public Members

double eps

Clear-zero threshold.

struct CombineRegister
#include <system_operations.h>

Combine-register operation.

Merges two registers (removes the second one)

Public Functions

inline CombineRegister(size_t first_id_, size_t second_id_)

Constructor (ID version)

Parameters:
  • first_id_ – First register ID

  • second_id_ – Second register ID

inline CombineRegister(std::string_view first_name_, std::string_view second_name_)

Constructor (name version)

Parameters:
  • first_name_ – First register name

  • second_name_ – Second register name

size_t operator()(std::vector<System> &state) const

Apply the combine operation.

Parameters:

state – System state vector

Returns:

Combined register ID

size_t operator()(SparseState &state) const

Apply the combine operation (sparse state version)

Parameters:

state – Sparse state

Returns:

Combined register ID

Public Members

std::string first_name

First register name.

std::string second_name

Second register name.

struct MoveBackRegister
#include <system_operations.h>

Move-register-back operation.

Changes the position of a register (unsafe, must not be called as a subprocedure)

Public Functions

MoveBackRegister(std::string_view reg_in)

Constructor (name version)

Parameters:

reg_in – Register name

MoveBackRegister(size_t reg_in)

Constructor (ID version)

Parameters:

reg_in – Register ID

void operator()(std::vector<System> &states) const

Apply the move-back operation.

Parameters:

states – System state vector

void operator()(SparseState &state) const

Apply the move-back operation (sparse state version)

Parameters:

state – Sparse state

Public Members

size_t register_id

Register ID.

struct Pop : public qram_simulator::BaseOperator
#include <system_operations.h>

Pop operation.

Restores the register state from the temporary stack

Public Functions

inline Pop(std::string_view reg_name_)

Constructor (name version)

Parameters:

reg_name_ – Register name

inline Pop(size_t reg_name_)

Constructor (ID version)

Parameters:

reg_name_ – Register ID

virtual void operator()(std::vector<System> &state) const

Apply the pop operation.

Parameters:

state – System state vector

Public Members

size_t reg_id

Register ID.

std::string reg_name

Register name.

struct Push : public qram_simulator::BaseOperator
#include <system_operations.h>

Push operation.

Pushes the register state onto a temporary stack

Public Functions

inline Push(std::string_view regname_, std::string_view garbage_name_)

Constructor (name version)

Parameters:
  • regname_ – Register name

  • garbage_name_ – Temporary register name

inline Push(size_t regname_, std::string_view garbage_name_)

Constructor (ID version)

Parameters:
  • regname_ – Register ID

  • garbage_name_ – Temporary register name

virtual void operator()(std::vector<System> &state) const

Apply the push operation.

Parameters:

state – System state vector

Public Members

std::string garbage_name

Temporary register name.

size_t reg_id

Register ID.

struct RemoveRegister
#include <system_operations.h>

Remove-register operation.

Removes the specified register from the system

Public Functions

RemoveRegister(std::string_view register_name)

Constructor (name version)

Parameters:

register_name – Register name

RemoveRegister(size_t register_name_)

Constructor (ID version)

Parameters:

register_name_ – Register ID

void operator()(std::vector<System> &state) const

Apply the remove operation.

Parameters:

state – System state vector

void operator()(SparseState &state) const

Apply the remove operation (sparse state version)

Parameters:

state – Sparse state

Public Members

size_t register_id

Register ID.

struct SplitRegister
#include <system_operations.h>

Split-register operation.

Splits one register into two registers

Public Functions

inline SplitRegister(size_t first_id_, std::string_view second_name_, size_t second_size_)

Constructor (ID version)

Parameters:
  • first_id_ – First register ID

  • second_name_ – Second register name

  • second_size_ – Second register size

inline SplitRegister(std::string_view first_name_, std::string_view second_name_, size_t second_size_)

Constructor (name version)

Parameters:
  • first_name_ – First register name

  • second_name_ – Second register name

  • second_size_ – Second register size

size_t operator()(std::vector<System> &state) const

Apply the split operation.

Parameters:

state – System state vector

Returns:

New register ID

size_t operator()(SparseState &state) const

Apply the split operation (sparse state version)

Parameters:

state – Sparse state

Returns:

New register ID

Public Members

std::string first_name

First register name.

std::string second_name

Second register name.

size_t second_size

Second register size.

struct StateLoad
#include <system_operations.h>

State loading operation.

Loads a quantum state from a file

Public Functions

inline StateLoad(std::string main_reg, std::string anc_UA, std::string anc_4, std::string anc_3, std::string anc_2, std::string anc_1, size_t ds, size_t rs)

Constructor.

Parameters:
  • main_reg – Main register name

  • anc_UA – Ancilla register UA name

  • anc_4 – Ancilla register 4 name

  • anc_3 – Ancilla register 3 name

  • anc_2 – Ancilla register 2 name

  • anc_1 – Ancilla register 1 name

  • ds – Data size

  • rs – Rational number size

std::vector<System> operator()(const std::string &savename_) const

Load a state from a file.

Parameters:

savename_ – File name

Returns:

System state vector

complex_t load_amplitude(const std::string &line) const

Parse an amplitude value.

Parameters:

line – File line

Returns:

Complex amplitude

size_t load_reg(const std::string &line, const std::string &reg) const

Parse a register value.

Parameters:
  • line – File line

  • reg – Register name

Returns:

Register value

System load_branch(const std::string &line) const

Parse a branch.

Parameters:

line – File line

Returns:

System state

bool is_branch(const std::string &line) const

Check whether a line is a branch line.

Parameters:

line – File line

Returns:

Whether the line is a branch line

Public Members

std::string main_reg

Main register name.

std::string anc_UA

Ancilla register UA name.

std::string anc_4

Ancilla register 4 name.

std::string anc_3

Ancilla register 3 name.

std::string anc_2

Ancilla register 2 name.

std::string anc_1

Ancilla register 1 name.

size_t data_size

Data size.

size_t rational_size

Rational number size.

std::string savename

Save name.

Debug and Verification Operators (SparQ/include/debugger.h)

Debugging utilities definitions.

Provides debugging, validation, and checking tools for quantum states, including normalization checks, NaN checks, state printing, block encoding extraction, and so on

namespace qram_simulator

QRAM sparse state simulator namespace.

Contains all classes, functions, and data structures related to quantum computing simulation

Enums

enum StatePrintDisplay

State print display mode enum.

Values:

enumerator Default

Default display mode.

enumerator Detail

Detailed display mode.

enumerator Binary

Binary display mode.

enumerator Prob

Probability display mode.

Functions

template<typename Op>
std::vector<size_t> check_inplace_unitarity(std::initializer_list<size_t> reg_sizes, std::function<Op(std::vector<size_t>)> op_factory, bool dagger = false)

Check the unitarity of an in-place operation (general version)

Verifies the unitarity of an in-place operation for an arbitrary register layout:

  1. Iterate over all 2^total_bits input states

  2. Perform the round-trip test: U then U† (or U† then U)

  3. Verify that the state has not split (state.size() == 1)

  4. Verify that the round-trip restores the original value (U*U† = I)

  5. Verify bijectivity (no output collisions)

Template Parameters:

Op – Operation type (must inherit from BaseOperator)

Parameters:
  • reg_sizes – Size of each register (initializer_list); a total of ≤ 16 bits is recommended

  • op_factory – Factory function: std::vector<size_t>(reg_ids) → Op

  • dagger – When false, executes U then U†; when true, executes U† then U

Throws:

Throws – an exception when the operation is non-unitary (state split), non-bijective (output collision), or when the round-trip fails

Returns:

Truth table (input index → output index)

template<typename BlockEncoding, typename StateType = SparseState>
DenseMatrix<complex_t> _extract_block_encoding(BlockEncoding encA, std::string_view main_reg, std::string_view anc_UA, bool is_full = false, bool is_dag = false)

Extract the block encoding matrix (internal implementation)

Template Parameters:
  • BlockEncoding – Block encoding type

  • StateType – State type

Parameters:
  • encA – Block encoding object

  • main_reg – Main register name

  • anc_UA – Ancilla register name

  • is_full – Whether to extract the full matrix

  • is_dag – Whether this is the dagger version

Returns:

Dense matrix representation of the block encoding

template<typename BlockEncoding>
DenseMatrix<complex_t> extract_block_encoding(BlockEncoding encA, std::string_view main_reg, std::string_view anc_UA, bool is_full = false, bool is_dag = false)

Extract the block encoding matrix.

Template Parameters:

BlockEncoding – Block encoding type

Parameters:
  • encA – Block encoding object

  • main_reg – Main register name

  • anc_UA – Ancilla register name

  • is_full – Whether to extract the full matrix

  • is_dag – Whether this is the dagger version

Returns:

Dense matrix representation of the block encoding

inline void state_equal_check(std::vector<System> state1, std::vector<System> state2)

Check whether two states are equal.

Parameters:
  • state1 – First state vector

  • state2 – Second state vector

Throws:

Throws – an exception and prints the difference when the states are not equal

struct CheckDuplicateKey : public qram_simulator::SelfAdjointOperator
#include <debugger.h>

Duplicate key check class.

Checks whether duplicate system keys exist in a quantum state

Public Functions

inline CheckDuplicateKey()

Default constructor.

bool has_duplicate(std::vector<System> &system_states) const

Check whether duplicate keys exist.

Parameters:

system_states – System state vector

Returns:

Whether duplicate keys exist

virtual void operator()(std::vector<System> &system_states) const

Apply the duplicate key check.

Parameters:

system_states – System state vector

Throws:

Throws – an exception when duplicate keys are found

inline virtual void dag(std::vector<System> &state) const override

Apply the dagger operation (the dagger of a self-adjoint operator equals itself)

Parameters:

state – System state vector

inline virtual void dag(SparseState &state) const override

Apply dagger to a SparseState.

Parameters:

state – Sparse state

inline virtual void dag(std::vector<System> &state) const

Apply the conjugate transpose (dagger) operation.

Parameters:

state – System state vector

Throws:

Throws – a not-implemented exception by default

inline virtual void dag(SparseState &state) const

Apply dagger to a SparseState.

Parameters:

state – Sparse state

struct CheckNan : public qram_simulator::SelfAdjointOperator
#include <debugger.h>

NaN check class.

Checks whether NaN values exist in a quantum state

Public Functions

CheckNan()

Default constructor.

virtual void operator()(std::vector<System> &state) const

Apply the NaN check.

Parameters:

state – System state vector

Throws:

Throws – an exception when a NaN is found

inline virtual void dag(std::vector<System> &state) const override

Apply the dagger operation (the dagger of a self-adjoint operator equals itself)

Parameters:

state – System state vector

inline virtual void dag(SparseState &state) const override

Apply dagger to a SparseState.

Parameters:

state – Sparse state

inline virtual void dag(std::vector<System> &state) const

Apply the conjugate transpose (dagger) operation.

Parameters:

state – System state vector

Throws:

Throws – a not-implemented exception by default

inline virtual void dag(SparseState &state) const

Apply dagger to a SparseState.

Parameters:

state – Sparse state

struct CheckNormalization : public qram_simulator::SelfAdjointOperator
#include <debugger.h>

Normalization check class.

Checks whether a quantum state is normalized (total probability is 1)

Public Functions

CheckNormalization()

Default constructor (uses the default threshold)

inline CheckNormalization(double threshold_)

Constructor (with a specified threshold)

Parameters:

threshold_ – Check threshold

virtual void operator()(std::vector<System> &state) const

Apply the normalization check.

Parameters:

state – System state vector

Throws:

Throws – an exception when the state is not normalized

inline virtual void dag(std::vector<System> &state) const override

Apply the dagger operation (the dagger of a self-adjoint operator equals itself)

Parameters:

state – System state vector

inline virtual void dag(SparseState &state) const override

Apply dagger to a SparseState.

Parameters:

state – Sparse state

inline virtual void dag(std::vector<System> &state) const

Apply the conjugate transpose (dagger) operation.

Parameters:

state – System state vector

Throws:

Throws – a not-implemented exception by default

inline virtual void dag(SparseState &state) const

Apply dagger to a SparseState.

Parameters:

state – Sparse state

Public Members

double threshold = 1e-5

Normalization check threshold.

struct CheckNormalization_Renormalize : public qram_simulator::SelfAdjointOperator
#include <debugger.h>

Normalization check and renormalization class.

Checks the normalization of a quantum state and renormalizes it if it is not normalized

Public Functions

inline CheckNormalization_Renormalize()

Default constructor.

inline CheckNormalization_Renormalize(double threshold_)

Constructor (with a specified threshold)

Parameters:

threshold_ – Check threshold

virtual void operator()(std::vector<System> &state) const

Apply the check and renormalization.

Parameters:

state – System state vector

inline virtual void dag(std::vector<System> &state) const override

Apply the dagger operation (the dagger of a self-adjoint operator equals itself)

Parameters:

state – System state vector

inline virtual void dag(SparseState &state) const override

Apply dagger to a SparseState.

Parameters:

state – Sparse state

inline virtual void dag(std::vector<System> &state) const

Apply the conjugate transpose (dagger) operation.

Parameters:

state – System state vector

Throws:

Throws – a not-implemented exception by default

inline virtual void dag(SparseState &state) const

Apply dagger to a SparseState.

Parameters:

state – Sparse state

Public Members

double threshold = 1e-5

Normalization check threshold.

struct ModuleInheritance_Test : public qram_simulator::BaseOperator
#include <debugger.h>

Module inheritance test class.

Used to test the inheritance mechanism of BaseOperator

Public Functions

inline virtual void operator()(std::vector<System> &state) const

Apply the test operation.

Parameters:

state – System state vector

inline virtual void dag(std::vector<System> &state) const

Apply the conjugate transpose (dagger) operation.

Parameters:

state – System state vector

Throws:

Throws – a not-implemented exception by default

inline virtual void dag(SparseState &state) const

Apply dagger to a SparseState.

Parameters:

state – Sparse state

struct ModuleInheritance_Test_SelfAdjoint : public qram_simulator::SelfAdjointOperator
#include <debugger.h>

Self-adjoint module inheritance test class.

Used to test the inheritance mechanism of SelfAdjointOperator

Public Functions

inline virtual void operator()(std::vector<System> &state) const

Apply the test operation.

Parameters:

state – System state vector

inline virtual void dag(std::vector<System> &state) const override

Apply the dagger operation (the dagger of a self-adjoint operator equals itself)

Parameters:

state – System state vector

inline virtual void dag(SparseState &state) const override

Apply dagger to a SparseState.

Parameters:

state – Sparse state

inline virtual void dag(std::vector<System> &state) const

Apply the conjugate transpose (dagger) operation.

Parameters:

state – System state vector

Throws:

Throws – a not-implemented exception by default

inline virtual void dag(SparseState &state) const

Apply dagger to a SparseState.

Parameters:

state – Sparse state

struct StatePrint : public qram_simulator::SelfAdjointOperator
#include <debugger.h>

State printing class.

Prints quantum state information to standard output

Public Functions

inline StatePrint(int32_t disp = 0)

Constructor (with a specified display mode)

Parameters:

disp – Display mode

inline StatePrint(int32_t disp, int precision)

Constructor (with a specified display mode and precision)

Parameters:
  • disp – Display mode

  • precision – Precision

inline StatePrint(StatePrintDisplay disp)

Constructor (enum display mode)

Parameters:

disp – Display mode enum

std::string disp2str() const

Convert the display mode to a string.

Returns:

Display mode string

std::string to_string(std::vector<System> &state) const

Apply state printing and return the formatted string.

Parameters:

state – System state vector

Returns:

Formatted state string

virtual void operator()(std::vector<System> &state) const

Apply state printing (to standard output)

Parameters:

state – System state vector

inline virtual void dag(std::vector<System> &state) const override

Apply the dagger operation (the dagger of a self-adjoint operator equals itself)

Parameters:

state – System state vector

inline virtual void dag(SparseState &state) const override

Apply dagger to a SparseState.

Parameters:

state – Sparse state

inline virtual void dag(std::vector<System> &state) const

Apply the conjugate transpose (dagger) operation.

Parameters:

state – System state vector

Throws:

Throws – a not-implemented exception by default

inline virtual void dag(SparseState &state) const

Apply dagger to a SparseState.

Parameters:

state – Sparse state

Public Members

int32_t display

Display mode.

int precision

Precision.

Public Static Attributes

static bool on

Print switch.

struct TestRemovable : public qram_simulator::SelfAdjointOperator
#include <debugger.h>

Removability test class.

Tests whether the specified register can be safely removed

Public Functions

TestRemovable(std::string_view register_name)

Constructor (name version)

Parameters:

register_name – Register name

TestRemovable(size_t register_name)

Constructor (ID version)

Parameters:

register_name – Register ID

virtual void operator()(std::vector<System> &state) const

Apply the removability test.

Parameters:

state – System state vector

inline virtual void dag(std::vector<System> &state) const override

Apply the dagger operation (the dagger of a self-adjoint operator equals itself)

Parameters:

state – System state vector

inline virtual void dag(SparseState &state) const override

Apply dagger to a SparseState.

Parameters:

state – Sparse state

inline virtual void dag(std::vector<System> &state) const

Apply the conjugate transpose (dagger) operation.

Parameters:

state – System state vector

Throws:

Throws – a not-implemented exception by default

inline virtual void dag(SparseState &state) const

Apply dagger to a SparseState.

Parameters:

state – Sparse state

Public Members

size_t register_id

Register ID.

struct ViewNormalization : public qram_simulator::SelfAdjointOperator
#include <debugger.h>

Normalization viewing class.

Prints the normalization information of a quantum state

Public Functions

ViewNormalization()

Default constructor.

virtual void operator()(std::vector<System> &state) const

Apply the normalization viewing.

Parameters:

state – System state vector

inline virtual void dag(std::vector<System> &state) const override

Apply the dagger operation (the dagger of a self-adjoint operator equals itself)

Parameters:

state – System state vector

inline virtual void dag(SparseState &state) const override

Apply dagger to a SparseState.

Parameters:

state – Sparse state

inline virtual void dag(std::vector<System> &state) const

Apply the conjugate transpose (dagger) operation.

Parameters:

state – System state vector

Throws:

Throws – a not-implemented exception by default

inline virtual void dag(SparseState &state) const

Apply dagger to a SparseState.

Parameters:

state – Sparse state

Global Macros (SparQ/include/global_macros.h)

Global macro definitions file.

Defines compilation configuration macros, condition control macros, CUDA support macros, and various utility macros

Defines

SINGLE_THREAD
ConditionSatisfiedNonzeros(state_ref)

Check whether the condition registers are all nonzero.

ConditionSatisfiedAllOnes(state_ref)

Check whether the condition registers are all 1 (all full)

ConditionSatisfiedByValue(state_ref)

Check condition registers by value.

ConditionSatisfiedByBit(state_ref)

Check condition registers by bit.

HasCondition

Check whether any condition exists.

ConditionSatisfied(state_ref)

Check whether all conditions are satisfied.

ConditionNotSatisfied(state_ref)

Check whether the condition is not satisfied.

ClassControllableNonzeros

Define the nonzero condition control member variables and methods.

Adds the condition_variable_nonzeros member and the related condition control methods to a class

ClassControllableAllOnes

Define the all-ones condition control member variables and methods.

ClassControllableByBit

Define the per-bit condition control member variables and methods.

Allows setting condition control on specific bits

ClassControllableByValue

Define the per-value condition control member variables and methods.

ClassControllable

Combine all condition control macros.

GetAs(id, type)

Get the register value as the specified type.

Debug_CheckOverflow(regname)

Debug macro: check whether a register value overflows.

FORWARD_CONDITIONS

Forward all condition control settings.

INLINE_IMPL(type)

Inline implementation macro.

DECLARE_IMPL(type)

Declare implementation macro.

CU_IMPL(type)

CUDA implementation macro.

CU_IMPL_SKIP_GPU(type)

CUDA skip-GPU implementation macro.

COMPOSITE_OPERATION

Composite operation macro (CPU version)

OPTIMIZE_HADAM
OPTIMIZE_HADAM_INT
OPTIMIZE_ROT
SAFE_HASH
CHECK_HASH