Skip to content

Classical types

This is a list of the classical types that are built-in in Qmod. For more information regarding classical types see: classical types.

structs

Classes:

Name Description
ChemistryAtom
CombinatorialOptimizationSolution
FinanceFunction
FockHamiltonianProblem
GaussianModel
LadderOp
LadderTerm
LogNormalModel
Molecule
MoleculeProblem
PauliTerm

A term in a Hamiltonian, represented as a product of Pauli operators.

Position
QSVMFeatureMapPauli
QsvmResult

BUILTIN_STRUCT_DECLARATIONS

BUILTIN_STRUCT_DECLARATIONS = {
    __name__: StructDeclaration(
        name=__name__,
        variables={
            name: convert(type)
            for field in fields(struct_decl)
        },
    )
    for struct_decl in values()
    if is_dataclass(struct_decl)
}

ChemistryAtom

ChemistryAtom(element: CInt, position: Position)

Attributes:

Name Type Description
element CInt
position Position

element

element: CInt

position

position: Position

CombinatorialOptimizationSolution

CombinatorialOptimizationSolution(
    probability: CReal,
    cost: CReal,
    solution: CArray[CInt],
    count: CInt,
)

Attributes:

Name Type Description
cost CReal
count CInt
probability CReal
solution CArray[CInt]

cost

cost: CReal

count

count: CInt

probability

probability: CReal

solution

solution: CArray[CInt]

FinanceFunction

FinanceFunction(
    f: CInt,
    threshold: CReal,
    larger: CBool,
    polynomial_degree: CInt,
    use_chebyshev_polynomial_approximation: CBool,
    tail_probability: CReal,
)

Attributes:

Name Type Description
f CInt
larger CBool
polynomial_degree CInt
tail_probability CReal
threshold CReal
use_chebyshev_polynomial_approximation CBool

f

f: CInt

larger

larger: CBool

polynomial_degree

polynomial_degree: CInt

tail_probability

tail_probability: CReal

threshold

threshold: CReal

use_chebyshev_polynomial_approximation

use_chebyshev_polynomial_approximation: CBool

FockHamiltonianProblem

FockHamiltonianProblem(
    mapping: CInt,
    z2_symmetries: CBool,
    terms: CArray[LadderTerm],
    num_particles: CArray[CInt],
)

Attributes:

Name Type Description
mapping CInt
num_particles CArray[CInt]
terms CArray[LadderTerm]
z2_symmetries CBool

mapping

mapping: CInt

num_particles

num_particles: CArray[CInt]

terms

terms: CArray[LadderTerm]

z2_symmetries

z2_symmetries: CBool

GaussianModel

GaussianModel(
    num_qubits: CInt,
    normal_max_value: CReal,
    default_probabilities: CArray[CReal],
    rhos: CArray[CReal],
    loss: CArray[CInt],
    min_loss: CInt,
)

Attributes:

Name Type Description
default_probabilities CArray[CReal]
loss CArray[CInt]
min_loss CInt
normal_max_value CReal
num_qubits CInt
rhos CArray[CReal]

default_probabilities

default_probabilities: CArray[CReal]

loss

loss: CArray[CInt]

min_loss

min_loss: CInt

normal_max_value

normal_max_value: CReal

num_qubits

num_qubits: CInt

rhos

rhos: CArray[CReal]

LadderOp

LadderOp(op: LadderOperator, index: CInt)

Attributes:

Name Type Description
index CInt
op LadderOperator

index

index: CInt

LadderTerm

LadderTerm(coefficient: CReal, ops: CArray[LadderOp])

Attributes:

Name Type Description
coefficient CReal
ops CArray[LadderOp]

coefficient

coefficient: CReal

ops

ops: CArray[LadderOp]

LogNormalModel

LogNormalModel(num_qubits: CInt, mu: CReal, sigma: CReal)

Attributes:

Name Type Description
mu CReal
num_qubits CInt
sigma CReal

mu

mu: CReal

num_qubits

num_qubits: CInt

sigma

sigma: CReal

Molecule

Molecule(
    atoms: CArray[ChemistryAtom], spin: CInt, charge: CInt
)

Attributes:

Name Type Description
atoms CArray[ChemistryAtom]
charge CInt
spin CInt

atoms

atoms: CArray[ChemistryAtom]

charge

charge: CInt

spin

spin: CInt

MoleculeProblem

MoleculeProblem(
    mapping: CInt,
    z2_symmetries: CBool,
    molecule: Molecule,
    freeze_core: CBool,
    remove_orbitals: CArray[CInt],
)

Attributes:

Name Type Description
freeze_core CBool
mapping CInt
molecule Molecule
remove_orbitals CArray[CInt]
z2_symmetries CBool

freeze_core

freeze_core: CBool

mapping

mapping: CInt

molecule

molecule: Molecule

remove_orbitals

remove_orbitals: CArray[CInt]

z2_symmetries

z2_symmetries: CBool

PauliTerm

PauliTerm(pauli: CArray[Pauli], coefficient: CReal)

A term in a Hamiltonian, represented as a product of Pauli operators.

Attributes:

Name Type Description
pauli CArray[Pauli]

The list of the chosen Pauli operators in the term, corresponds to a product of them.

coefficient CReal

The coefficient of the term (floating number).

Attributes:

Name Type Description
coefficient CReal
pauli CArray[Pauli]

coefficient

coefficient: CReal

pauli

pauli: CArray[Pauli]

Position

Position(x: CReal, y: CReal, z: CReal)

Attributes:

Name Type Description
x CReal
y CReal
z CReal

x

x: CReal

y

y: CReal

z

z: CReal

QSVMFeatureMapPauli

QSVMFeatureMapPauli(
    feature_dimension: CInt,
    reps: CInt,
    entanglement: CInt,
    alpha: CReal,
    paulis: CArray[CArray[Pauli]],
)

Attributes:

Name Type Description
alpha CReal
entanglement CInt
feature_dimension CInt
paulis CArray[CArray[Pauli]]
reps CInt

alpha

alpha: CReal

entanglement

entanglement: CInt

feature_dimension

feature_dimension: CInt

paulis

paulis: CArray[CArray[Pauli]]

reps

reps: CInt

QsvmResult

QsvmResult(
    test_score: CReal, predicted_labels: CArray[CReal]
)

Attributes:

Name Type Description
predicted_labels CArray[CReal]
test_score CReal

predicted_labels

predicted_labels: CArray[CReal]

test_score

test_score: CReal

constants

Attributes:

Name Type Description
SIGNED
UNSIGNED

SIGNED

SIGNED = QConstant('SIGNED', CBool, True)

UNSIGNED

UNSIGNED = QConstant('UNSIGNED', CBool, False)

enums

Classes:

Name Description
Element
FermionMapping
FinanceFunctionType
LadderOperator
Optimizer
Pauli

Enumeration for the Pauli matrices used in quantum computing.

QSVMFeatureMapEntanglement

BUILTIN_ENUM_DECLARATIONS

BUILTIN_ENUM_DECLARATIONS = {__name__: EnumDeclaration(name=__name__, members={name: _nOQmfor enum_val in enum_def})for enum_def in values() if isinstance(enum_def, type) and issubclass(enum_def, IntEnum) and enum_def is not IntEnum}

Element

Bases: IntEnum

Attributes:

Name Type Description
Ac
Ag
Al
Am
Ar
As
At
Au
B
Ba
Be
Bh
Bi
Bk
Br
C
Ca
Cd
Ce
Cf
Cl
Cm
Cn
Co
Cr
Cs
Cu
Db
Ds
Dy
Er
Es
Eu
F
Fe
Fl
Fm
Fr
Ga
Gd
Ge
H
He
Hf
Hg
Ho
Hs
I
In
Ir
K
Kr
La
Li
Lr
Lu
Lv
Mc
Md
Mg
Mn
Mo
Mt
N
Na
Nb
Nd
Ne
Nh
Ni
No
Np
O
Og
Os
P
Pa
Pb
Pd
Pm
Po
Pr
Pt
Pu
Ra
Rb
Re
Rf
Rg
Rh
Rn
Ru
S
Sb
Sc
Se
Sg
Si
Sm
Sn
Sr
Ta
Tb
Tc
Te
Th
Ti
Tl
Tm
Ts
U
V
W
Xe
Y
Yb
Zn
Zr

Ac

Ac = 88

Ag

Ag = 46

Al

Al = 12

Am

Am = 94

Ar

Ar = 17

As

As = 32

At

At = 84

Au

Au = 78

B

B = 4

Ba

Ba = 55

Be

Be = 3

Bh

Bh = 106

Bi

Bi = 82

Bk

Bk = 96

Br

Br = 34

C

C = 5

Ca

Ca = 19

Cd

Cd = 47

Ce

Ce = 57

Cf

Cf = 97

Cl

Cl = 16

Cm

Cm = 95

Cn

Cn = 111

Co

Co = 26

Cr

Cr = 23

Cs

Cs = 54

Cu

Cu = 28

Db

Db = 104

Ds

Ds = 109

Dy

Dy = 65

Er

Er = 67

Es

Es = 98

Eu

Eu = 62

F

F = 8

Fe

Fe = 25

Fl

Fl = 113

Fm

Fm = 99

Fr

Fr = 86

Ga

Ga = 30

Gd

Gd = 63

Ge

Ge = 31

H

H = 0

He

He = 1

Hf

Hf = 71

Hg

Hg = 79

Ho

Ho = 66

Hs

Hs = 107

I

I = 52

In

In = 48

Ir

Ir = 76

K

K = 18

Kr

Kr = 35

La

La = 56

Li

Li = 2

Lr

Lr = 102

Lu

Lu = 70

Lv

Lv = 115

Mc

Mc = 114

Md

Md = 100

Mg

Mg = 11

Mn

Mn = 24

Mo

Mo = 41

Mt

Mt = 108

N

N = 6

Na

Na = 10

Nb

Nb = 40

Nd

Nd = 59

Ne

Ne = 9

Nh

Nh = 112

Ni

Ni = 27

No

No = 101

Np

Np = 92

O

O = 7

Og

Og = 117

Os

Os = 75

P

P = 14

Pa

Pa = 90

Pb

Pb = 81

Pd

Pd = 45

Pm

Pm = 60

Po

Po = 83

Pr

Pr = 58

Pt

Pt = 77

Pu

Pu = 93

Ra

Ra = 87

Rb

Rb = 36

Re

Re = 74

Rf

Rf = 103

Rg

Rg = 110

Rh

Rh = 44

Rn

Rn = 85

Ru

Ru = 43

S

S = 15

Sb

Sb = 50

Sc

Sc = 20

Se

Se = 33

Sg

Sg = 105

Si

Si = 13

Sm

Sm = 61

Sn

Sn = 49

Sr

Sr = 37

Ta

Ta = 72

Tb

Tb = 64

Tc

Tc = 42

Te

Te = 51

Th

Th = 89

Ti

Ti = 21

Tl

Tl = 80

Tm

Tm = 68

Ts

Ts = 116

U

U = 91

V

V = 22

W

W = 73

Xe

Xe = 53

Y

Y = 38

Yb

Yb = 69

Zn

Zn = 29

Zr

Zr = 39

FermionMapping

Bases: IntEnum

Attributes:

Name Type Description
BRAVYI_KITAEV
FAST_BRAVYI_KITAEV
JORDAN_WIGNER
PARITY

BRAVYI_KITAEV

BRAVYI_KITAEV = 2

FAST_BRAVYI_KITAEV

FAST_BRAVYI_KITAEV = 3

JORDAN_WIGNER

JORDAN_WIGNER = 0

PARITY

PARITY = 1

FinanceFunctionType

Bases: IntEnum

Attributes:

Name Type Description
EUROPEAN_CALL_OPTION
SHORTFALL
VAR
X_SQUARE

EUROPEAN_CALL_OPTION

EUROPEAN_CALL_OPTION = 3

SHORTFALL

SHORTFALL = 1

VAR

VAR = 0

X_SQUARE

X_SQUARE = 2

LadderOperator

Bases: IntEnum

Attributes:

Name Type Description
MINUS
PLUS

MINUS

MINUS = 1

PLUS

PLUS = 0

Optimizer

Bases: IntEnum

Attributes:

Name Type Description
ADAM
COBYLA
L_BFGS_B
NELDER_MEAD
SPSA

ADAM

ADAM = 5

COBYLA

COBYLA = 1

L_BFGS_B

L_BFGS_B = 3

NELDER_MEAD

NELDER_MEAD = 4

SPSA

SPSA = 2

Pauli

Bases: IntEnum

Enumeration for the Pauli matrices used in quantum computing.

The Pauli matrices are fundamental operations in quantum computing, and this enum assigns integer values to represent each matrix.

Attributes:

Name Type Description
I

I (int): Identity matrix, represented by the integer 0.

X

X (int): Pauli-X matrix, represented by the integer 1.

Y

Y (int): Pauli-Y matrix, represented by the integer 2.

Z

Z (int): Pauli-Z matrix, represented by the integer 3.

I

I = 0

I (int): Identity matrix, represented by the integer 0.

\(I = \begin{bmatrix} 1 & 0 \\ 0 & 1 \end{bmatrix}\)

X

X = 1

X (int): Pauli-X matrix, represented by the integer 1.

\(X = \begin{bmatrix} 0 & 1 \\ 1 & 0 \end{bmatrix}\)

Y

Y = 2

Y (int): Pauli-Y matrix, represented by the integer 2.

\(Y = \begin{bmatrix} 0 & -i \\ i & 0 \end{bmatrix}\)

Z

Z = 3

Z (int): Pauli-Z matrix, represented by the integer 3.

\(Z = \begin{bmatrix} 1 & 0 \\ 0 & -1 \end{bmatrix}\)

QSVMFeatureMapEntanglement

Bases: IntEnum

Attributes:

Name Type Description
CIRCULAR
FULL
LINEAR
PAIRWISE
SCA

CIRCULAR

CIRCULAR = 2

FULL

FULL = 0

LINEAR

LINEAR = 1

PAIRWISE

PAIRWISE = 4

SCA

SCA = 3