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 |
|
qae_with_qpe_result_post_processing |
|
qsvm_full_run |
|
sample |
|
save |
|
vqe |
|
CARRAY_SEPARATOR
CARRAY_SEPARATOR: Final[str] = '_'
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: ExecutionParams | None = None,
) -> EstimationResult
iqae
iqae(
epsilon: float,
alpha: float,
execution_params: ExecutionParams | None = None,
) -> IQAEResult
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
sample
sample(
execution_params: ExecutionParams | None = None,
) -> ExecutionDetails
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:
Name | Description |
---|---|
qft_const_adder_phase |
|
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]
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]
IndexedPauli
IndexedPauli(pauli: Pauli, index: CInt)
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
PauliTerm
PauliTerm(pauli: CArray[Pauli], coefficient: CReal)
A term in a Hamiltonian, represented as a product of single-qubit Pauli matrices.
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). |
coefficient
coefficient: 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
SparsePauliOp
SparsePauliOp(
terms: list[SparsePauliTerm], num_qubits: int
)
Represents a collection of sparse Pauli operators.
Attributes:
Name | Type | Description |
---|---|---|
terms |
CArray[SparsePauliTerm]
|
The list of chosen sparse Pauli terms, corresponds to a product of them. (See: SparsePauliTerm) |
num_qubits |
CInt
|
The number of qubits in the Hamiltonian. |
num_qubits
num_qubits: int
SparsePauliTerm
SparsePauliTerm(
paulis: CArray[IndexedPauli], coefficient: CReal
)
A term in the Hamiltonian, represented as a sparse product of single-qubit Pauli matrices.
Attributes: paulis (CArray[IndexedPauli]): The list of chosen sparse Pauli operators in the term corresponds to a product of them. (See IndexedPauli) coefficient (CReal): The coefficient of the term (floating number).
Attributes:
Name | Type | Description |
---|---|---|
coefficient |
CReal
|
|
paulis |
CArray[IndexedPauli]
|
|
coefficient
coefficient: CReal
qft_const_adder_phase
qft_const_adder_phase(
bit_index: CInt, value: CInt, reg_len: CInt
) -> CReal