# Exponentiation¶

The exponentiation function produces a quantum gate that implements the exponentiation, $$\exp(-iHt)$$, of any input Hermitian operator, $$H$$.

## Example¶

This example demonstrates synthesis of an exponentiation function in the Classiq engine. All options are specified below.

{
"functions": [
{
"name": "main",
"body": [
{
"function": "Exponentiation",
"function_params": {
"pauli_operator": {
"pauli_list": [
["IIZXXXII", 0.1],
["IIXXYYII", 0.2],
["IIIIZZYX", 0.3],
["XZIIIIIX", 0.4],
["IIIIIZXI", 0.5],
["IIIIIIZY", 0.6],
["IIIIIIXY", 0.7],
["IIYXYZII", 0.8],
["IIIIIIXZ", 0.9],
["IIYZYIII", 1.0]
]
},
"evolution_coefficient": 0.05,
"constraints": {
"max_depth": 100,
"max_error": 0.2
},
"optimization": "MINIMIZE_DEPTH"
}
}
]
}
]
}
from classiq.builtin_functions import Exponentiation
from classiq.builtin_functions.exponentiation import (
ExponentiationConstraints,
ExponentiationOptimization,
PauliOperator,
)
from classiq import Model, synthesize, show

pauli_operator = PauliOperator(
pauli_list=[
("IIZXXXII", 0.1),
("IIXXYYII", 0.2),
("IIIIZZYX", 0.3),
("XZIIIIIX", 0.4),
("IIIIIZXI", 0.5),
("IIIIIIZY", 0.6),
("IIIIIIXY", 0.7),
("IIYXYZII", 0.8),
("IIIIIIXZ", 0.9),
("IIYZYIII", 1.0),
]
)
exponentiation_params = Exponentiation(
pauli_operator=pauli_operator,
evolution_coefficient=0.05,
constraints=ExponentiationConstraints(
max_depth=100,
max_error=0.2,
),
optimization=ExponentiationOptimization.MINIMIZE_DEPTH,
)

model = Model()
model.Exponentiation(exponentiation_params)

quantum_program = synthesize(model.get_model())
show(quantum_program)

## Options¶

### Input Operator¶

You can input any $$n$$-qubit operator in its Pauli basis [1]

$H=\sum_i c_i\left[\sigma_{j_{1,i}}\otimes\sigma_{j_{2,i}}\otimes\cdots\otimes\sigma_{j_{n,i}}\right]$

where $$\sigma_{0,1,2,3}=I,X,Y,Z$$ are the single-qubit Pauli operators, and $$j\in\{0,1,2,3\}$$.

Implement it using the pauli_list field of the PauliOperator class.

For example, the operator $$H=0.1\cdot I\otimes Z+0.2\cdot X\otimes Y$$ is input as follows.

{
"pauli_list": [
["IZ",0.1],
["XY",0.2]
]
}
from classiq.builtin_functions.exponentiation import PauliOperator

operator = PauliOperator(pauli_list=[("IZ", 0.1), ("XY", 0.2)])
print(operator.show())
+0.100 * IZ
+0.200 * XY

Provide the operator to exponentiate using the pauli_operator field of the Exponentiation.

Provide a global evolution coefficient using the evolution_coefficient field of the Exponentiation; defaults to 1.0.

### Constraints¶

Provide local constraints for the exponentiation of either max_depth or max_error using the fields of the ExponentiationConstraints class; both default to no constraint.

The max_error bounds the algorithmic error of the quantum program as measured by the operator norm [2] and evaluated according to Ref. [3] .

Provide the constraints using the constraints field of the Exponentiation; defaults to no constraints.

{
"max_depth": 100,
"max_error": 0.2
}
from classiq.builtin_functions.exponentiation import ExponentiationConstraints

ExponentiationConstraints(
max_depth=100,
max_error=0.2,
)

### Optimization¶

Set the optimization target for the exponentiation to MINIMIZE_DEPTH or MINIMIZE_ERROR.

The Classiq engine automatically generates an efficient higher-order Trotter-Suzuki quantum program [4] that satisfies the optimization target within the provided constraints.

Provide the optimization using the optimization field of the Exponentiation; defaults to MINIMIZE_DEPTH.

Use a naive evolution for the operator by setting the field use_naive_evolution to True.

## References¶

[3] A. M. Childs et al, Toward the first quantum simulation with quantum speedup, https://arxiv.org/abs/1711.10980 (2017).

[4] N. Hatano and M. Suzuki, Finding Exponential Product Formulas of Higher Orders, https://arxiv.org/abs/math-ph/0506007 (2005).