- Python Version:
3.11
- To install dependencies, run:
pip install -r requirements.txt
To run the program, use:
python3 main.py <config.yml>
The program uses a YAML configuration file to define its parameters. Below is a detailed description of the configuration categories and their parameters:
Section | Key | Type | Description |
---|---|---|---|
Run Configuration | run |
String | Defines the algorithm to run. Options: 'vqe' , 'redundant' , 'zne' . |
System Configuration | nqubits |
Integer | Specifies the number of qubits in the quantum system. |
state |
String | Defines the state representation. Options: 'dmatrix' (density matrix) or 'statevector' . |
|
Observable (Target Hamiltonian) | def |
String | Defines the type of Hamiltonian. Options: 'custom' , 'ising' , 'heisenberg' . Warning: Coefficients are overwritten based on the selected type. For 'ising' , cn values are set to [0.5] , bn values are set to [1] , and r is set to 1 . For 'heisenberg' , only cn is used. |
coefficients |
Object | Contains coefficients for the Hamiltonian terms: | |
cn |
List of Floats | ||
bn |
List of Floats | ||
r |
Float | ||
Output Configuration | file_name_prefix |
String | Specifies the prefix for the output file name. |
draw |
Object | Configures drawing options for output files: | |
status |
Boolean | ||
fig_dpi |
Integer | ||
type |
String | ||
VQE Configuration | iteration |
Integer | Specifies the number of iterations for the VQE algorithm. |
optimization |
Object | Configures optimization settings: | |
status |
Boolean | ||
algorithm |
String | ||
constraint |
Boolean | ||
ansatz |
Object | Configures the ansatz circuit: | |
type |
String | ||
layer |
Integer | ||
gateset |
Integer | ||
ugate |
Object | ||
coefficients |
|||
cn |
|||
bn |
|||
r |
|||
time |
|||
min |
|||
max |
|||
noise |
Object | ||
status |
|||
value |
|||
init_param |
String | Defines the initialization method for parameters. Options: 'random' , etc. Example: "random" . |
|
Redundant Circuit Configuration | identity_factors |
List of Lists | Specifies the identity scaling factors for gates. Example: [[1, 0, 0, 1], [2, 3, 2, 1], ...] . |
Warning | String | Warning: Identity scaling for the U gate is supported only if the ansatz type is 'xy-iss' . For other types, the identity scaling factor for the U gate must be set to 0 . |
|
Zero Noise Extrapolation (ZNE) | method |
String | Defines the method for zero-noise extrapolation. Options: 'linear' , 'polynomial' , 'richardson' , 'richardson-mul' . |
degree |
Integer | Sets the degree for polynomial or Richardson methods. Used for regression. | |
sampling |
String | Specifies the sampling method for extrapolation. Options: 'default' , 'default-N' , 'random-N' , where N is an integer. |
|
data_points |
List of Lists | Provides the data points for extrapolation. Each entry contains several values, such as time and noise levels. Example: [[12, 1, 0, 3, -3.3480294367352315], [20, 7, 10, 3, -0.05316450776222178], ...] . |
-
Observable (Target Hamiltonian) Coefficients Overwritten:
- For the
ising
Hamiltonian (observable.def: "ising"
), the coefficients are automatically overwritten as follows:cn
:[0.5]
bn
:[1.0]
r
:1
- For the
heisenberg
Hamiltonian (observable.def: "heisenberg"
), only thecn
coefficient is used, andbn
andr
are ignored.
- For the
-
Ansatz Type for Zero Noise Extrapolation (ZNE):
- When using Zero Noise Extrapolation (ZNE) with redundant circuits, the ansatz type must be set to
'xy-iss'
(vqe.ansatz.type: "xy-iss"
). This is required for identity-scaling the circuit gates (U, Y, and CZ). - Warning: The identity-scaling for the U gate is only supported if the ansatz type is
'xy_model-xz-z'
. For other ansatz types, the identity scaling for the U gate must be set to0
.
- When using Zero Noise Extrapolation (ZNE) with redundant circuits, the ansatz type must be set to
-
VQE Ansatz Coefficients Overwritten:
- When using the VQE algorithm with certain ansatz types (
'xy-iss'
), the coefficients are automatically overwritten as follows:cn
:[0.5]
bn
:[0]
r
:0
- For ansatz types such as
'ising'
or'heisenberg'
, the coefficients are predefined according to the selected type.
- When using the VQE algorithm with certain ansatz types (
-
Initialization of Parameters:
- The initial parameters for the ansatz are set to
random
by default (vqe.ansatz.init_param: "random"
). If you need to modify the initialization method, ensure to update this value accordingly.
- The initial parameters for the ansatz are set to
-
Sampling Method for Zero Noise Extrapolation:
- The
sampling
method should be selected appropriately:'default'
- All points are sampled.'default-N'
- The firstN
points are sampled.'random-N'
-N
points are sampled randomly.
- Ensure that the method aligns with the desired sampling strategy for extrapolation.
- The
For testing, use pytest
.
To run the tests, execute:
pytest test/.
- Use
flake8
for linting. - Use
black
andisort
for formatting the code.# Run linting flake8 . # Run formatting black . isort .