common.h

Common types and functions used by the debugger.

This file contains declarations for several common types required for quantum computation, such as complex numbers, state vectors, etc.

Enums

enum Result

The result of an operation.

Can be either OK or ERROR.

Values:

enumerator OK

Indicates that the operation was successful.

enumerator ERROR

Indicates that an error occurred during the operation.

enum VariableType

The type of classical variables.

Supports Bool, Int, and Float.

Values:

enumerator VarBool
enumerator VarInt
enumerator VarFloat
union VariableValue
#include <common.h>

@biref Represents the value of a classical variable.

Public Members

bool boolValue

The value represented as a boolean.

int intValue

The value represented as a integer.

double floatValue

The value represented as a floating point number.

struct Variable
#include <common.h>

Represents a classical variable.

Public Members

const char *name
VariableType type
VariableValue value
struct Complex
#include <common.h>

Represents a complex number.

Public Members

double real

The real component of the complex number.

double imaginary

The imaginary component of the complex number.

struct Statevector
#include <common.h>

Represents a quantum statevector.

The number of qubits is fixed and the number of states is 2^numQubits.

Public Members

size_t numQubits

The number of qubits in the statevector.

size_t numStates

The number of states in the statevector.

This is equal to 2^numQubits.

Complex *amplitudes

An area of memory containing the amplitudes of the statevector.

The allocated memory must be enough to store numStates Complex numbers.

struct CompilationSettings
#include <common.h>

The settings that should be used to compile an assertion program.

Public Members

uint8_t opt

The optimization level that should be used. Exact meaning depends on the implementation, but typically 0 means no optimization.

size_t sliceIndex

The index of the slice that should be compiled.