Classical functions
Classical functions and execution primitives are used in cfunc
's to define the classical execution logic of a quantum program.
This is a list of the available functions and primitives in Qmod
.
classical_execution_primitives
Functions:
Name | Description |
---|---|
batch_estimate |
|
batch_sample |
|
estimate |
|
iqae |
|
molecule_ground_state_solution_post_process |
|
qae_with_qpe_result_post_processing |
|
qsvm_full_run |
|
sample |
|
save |
|
vqe |
|
Attributes:
Name | Type | Description |
---|---|---|
ExecutionParams |
|
CARRAY_SEPARATOR
CARRAY_SEPARATOR: Final[str] = '_'
ExecutionParams
ExecutionParams = dict[
str, Union[float, int, list[int], list[float]]
]
batch_estimate
batch_estimate(
hamiltonian: list[QmodPyStruct],
batch_execution_params: list[ExecutionParams],
) -> EstimationResults
batch_sample
batch_sample(
batch_execution_params: list[ExecutionParams],
) -> MultipleExecutionDetails
estimate
estimate(
hamiltonian: list[QmodPyStruct],
execution_params: Optional[ExecutionParams] = None,
) -> EstimationResult
iqae
iqae(
epsilon: float,
alpha: float,
execution_params: Optional[ExecutionParams] = None,
) -> IQAEResult
molecule_ground_state_solution_post_process
molecule_ground_state_solution_post_process(
problem: QmodPyStruct, vqe_result: VQESolverResult
) -> QmodPyStruct
qae_with_qpe_result_post_processing
qae_with_qpe_result_post_processing(
estimation_register_size: int,
estimation_method: QaeWithQpeEstimationMethod,
result: ExecutionDetails,
) -> float
qsvm_full_run
qsvm_full_run(
train_data: Data,
train_labels: Labels,
test_data: Data,
test_labels: Labels,
predict_data: Data,
) -> QmodPyStruct
save
save(values_to_save: dict) -> None
vqe
vqe(
hamiltonian: list[QmodPyStruct],
maximize: bool,
initial_point: list[float],
optimizer: Optimizer,
max_iteration: int,
tolerance: float,
step_size: float,
skip_compute_variance: bool,
alpha_cvar: float,
) -> VQESolverResult
classical_functions
Functions:
ChemistryAtom
ChemistryAtom(element: CInt, 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]
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)
LadderTerm
LadderTerm(coefficient: CReal, ops: CArray[LadderOp])
Attributes:
Name | Type | Description |
---|---|---|
coefficient |
CReal
|
|
ops |
CArray[LadderOp]
|
|
coefficient
coefficient: CReal
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
|
|
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
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
Position
Position(x: CReal, y: CReal, 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
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
fock_hamiltonian_problem_to_hamiltonian
fock_hamiltonian_problem_to_hamiltonian(
problem: FockHamiltonianProblem,
) -> CArray[PauliTerm]
gaussian_finance_post_process
gaussian_finance_post_process(
finance_model: GaussianModel,
estimation_method: FinanceFunction,
probability: CReal,
) -> CReal
grid_entangler_graph
grid_entangler_graph(
num_qubits: CInt,
schmidt_rank: CInt,
grid_randomization: CBool,
) -> CArray[CArray[CInt]]
hypercube_entangler_graph
hypercube_entangler_graph(
num_qubits: CInt,
) -> CArray[CArray[CInt]]
log_normal_finance_post_process
log_normal_finance_post_process(
finance_model: LogNormalModel,
estimation_method: FinanceFunction,
probability: CReal,
) -> CReal
molecule_problem_to_hamiltonian
molecule_problem_to_hamiltonian(
problem: MoleculeProblem,
) -> CArray[PauliTerm]
qft_const_adder_phase
qft_const_adder_phase(
bit_index: CInt, value: CInt, reg_len: CInt
) -> CReal