Skip to content

Commit 4db261d

Browse files
committed
Corrections and improvement of tutorial notebooks
1 parent 7ca2d81 commit 4db261d

19 files changed

Lines changed: 2825 additions & 2220 deletions

benchmark/compare_ae_probability/CompareAEalgorithmsOnPureProbability.ipynb

Lines changed: 20 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -404,6 +404,26 @@
404404
"pdf[results_info]"
405405
]
406406
},
407+
{
408+
"cell_type": "code",
409+
"execution_count": null,
410+
"id": "b99187e5",
411+
"metadata": {},
412+
"outputs": [],
413+
"source": [
414+
"len(pdf.columns)"
415+
]
416+
},
417+
{
418+
"cell_type": "code",
419+
"execution_count": null,
420+
"id": "a53de931",
421+
"metadata": {},
422+
"outputs": [],
423+
"source": [
424+
"pdf[[\"oracle_calls\", \"max_oracle_depth\"]]"
425+
]
426+
},
407427
{
408428
"cell_type": "markdown",
409429
"id": "67384c33",

benchmark/q_ae_cliquet/QAE_CliquetOptions.ipynb

Lines changed: 22 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -958,6 +958,28 @@
958958
"]]"
959959
]
960960
},
961+
{
962+
"cell_type": "code",
963+
"execution_count": null,
964+
"id": "bb43a2d7",
965+
"metadata": {},
966+
"outputs": [],
967+
"source": [
968+
"ae_dict.update({\n",
969+
" \"ae_type\" : \"BAYESQAE\",\n",
970+
"})"
971+
]
972+
},
973+
{
974+
"cell_type": "code",
975+
"execution_count": null,
976+
"id": "19b93006",
977+
"metadata": {},
978+
"outputs": [],
979+
"source": [
980+
"pdf_parts = ae_cliquet_estimation_step_po(**ae_dict)"
981+
]
982+
},
961983
{
962984
"cell_type": "markdown",
963985
"id": "2e4a2494",

misc/notebooks/00_AboutTheNotebooksAndQPUs.ipynb

Lines changed: 55 additions & 40 deletions
Original file line numberDiff line numberDiff line change
@@ -5,38 +5,40 @@
55
"id": "ad639bf4",
66
"metadata": {},
77
"source": [
8-
"# 1. About the notebooks\n",
98
"\n",
10-
"The notebooks located in the folder: **misc/notebooks/** can be used as tutorials for understanding the working and the capabilities of the **FinancialApplications** software package and the **QQuantLib** Python library developed inside it. \n"
9+
"# 1. About the Notebooks\n",
10+
"\n",
11+
"The notebooks located in the folder **misc/notebooks/** serve as tutorials to help users understand the functionality and capabilities of the **FinancialApplications** software package and the **QQuantLib** Python library developed within it. These notebooks provide hands-on examples and explanations, making it easier to explore and utilize the tools effectively."
1112
]
1213
},
1314
{
1415
"cell_type": "markdown",
1516
"id": "5b633e42",
1617
"metadata": {},
1718
"source": [
18-
"# 2. About the QQuantLib library\n",
19+
"# 2. About the QQuantLib Library\n",
1920
"\n",
20-
"The main idea of the **FinancialApplications** software and the **QQuantLib** Python library is to develop several state-of-the-art quantum algorithms and routines for price estimation of financial derivatives using **myQLM** quantum software stack and/or for the Qaptiva™ Appliance developed by **Eviden**. \n"
21+
"The primary objective of the **FinancialApplications** software and the **QQuantLib** Python library is to implement advanced quantum algorithms and routines for estimating the prices of financial derivatives. These tools leverage the **myQLM** quantum software stack and/or the Qaptiva™ Appliance developed by **Eviden**, enabling cutting-edge quantum computing capabilities in the field of finance."
2122
]
2223
},
2324
{
2425
"cell_type": "markdown",
2526
"id": "8775aba8",
2627
"metadata": {},
2728
"source": [
28-
"# 3. About the myQLM and Qaptiva Access environment\n",
29-
"\n",
30-
"Meanwhile the **myQLM** (https://myqlm.github.io/index.html#) is an open-source library that can be installed in a local computer the Qaptiva™ Appliance was designed for executing the quantum programs in a **ATOS** **Quantum Learning Machine** (https://atos.net/en/solutions/quantum-learning-machine). \n",
29+
"# 3. About the myQLM and Qaptiva Access Environment\n",
3130
"\n",
31+
"While **myQLM** (https://myqlm.github.io/index.html#) is an open-source library that can be installed on a local machine, the **Qaptiva™ Appliance** is designed to execute quantum programs on the **ATOS Quantum Learning Machine** (https://atos.net/en/solutions/quantum-learning-machine). \n",
3232
"\n",
33-
"Additionally, **Eviden** has developed a library called **Qaptiva Access** (a.k.a. QLMaaS or QLM as a Service) that allows to the user submit **myQLM** computations to remote **Quantum Learning Machine**. \n",
33+
"Additionally, **Eviden** has developed a library called **Qaptiva Access** (also known as QLMaaS or QLM as a Service), which allows users to submit **myQLM** computations to a remote **Quantum Learning Machine**.\n",
3434
"\n",
35-
"The **QQuantLib** library was developed completely in **myQLM** but the code can be used straight locally in a **Quantum Learning Machine** or by submitting to it using the **Qaptiva Access**.\n",
35+
"The **QQuantLib** library was fully developed using **myQLM**, and its code can be executed either locally on a **Quantum Learning Machine** or submitted remotely via **Qaptiva Access**.\n",
3636
"\n",
37-
"For understanding how to use these different ways in the **QQuantLib** we have to build a **Quantum Procces Unit** (or **QPU**). In the **myQLM** and **Qaptiva Access** framework a **QPU** is a Python object that executes a Job and returns a Result (see https://myqlm.github.io/02_user_guide/02_execute/03_qpu.html#qpu).\n",
37+
"To understand how to use these different execution methods within **QQuantLib**, it is essential to build a **Quantum Processing Unit** (**QPU**). In the **myQLM** and **Qaptiva Access** framework, a **QPU** is a Python object that executes a Job and returns a Result (see https://myqlm.github.io/02_user_guide/02_execute/03_qpu.html#qpu).\n",
3838
"\n",
39-
"A **QPU** can be a Quantum Emulator (a classical software emulating the behaviour of a physical QPU) or a Physical system. \n"
39+
"A **QPU** can represent either:\n",
40+
"- A **Quantum Emulator**: A classical software tool that simulates the behavior of a physical quantum processor.\n",
41+
"- A **Physical System**: An actual quantum hardware device capable of executing quantum computations."
4042
]
4143
},
4244
{
@@ -46,7 +48,7 @@
4648
"source": [
4749
"# 4. QQuantLib and QPUs\n",
4850
"\n",
49-
"From the point of view of the **QQuantLib** library the **QPU**s are used for simulating (or executing in a quantum device in the future) the quantum circuits generated by the different functions of the library. Depending on the library to use (**myQLM** or Qaptiva™ Appliance) different **QPU**s can be used with the **QQuantLib** library.\n"
51+
"From the perspective of the **QQuantLib** library, **QPUs** are utilized to simulate (or execute on quantum hardware in the future) the quantum circuits generated by the library's functions. Depending on the underlying framework being used (**myQLM** or the **Qaptiva™ Appliance**), various types of **QPUs** can be employed with **QQuantLib**.\n"
5052
]
5153
},
5254
{
@@ -56,10 +58,11 @@
5658
"source": [
5759
"## 4.1 myQLM\n",
5860
"\n",
59-
"**QQuantLib** can only use the two following **myQLM QPU**s, that are linear algebra simulators:\n",
61+
"The **QQuantLib** library can utilize two **myQLM QPU** options, both of which are linear algebra simulators:\n",
62+
"\n",
63+
"- `PyLinalg`: This simulator is entirely written in Python and leverages the **NumPy** library for its computations.\n",
6064
"\n",
61-
"* PyLinalg : It is entirely written in Python, and is based in particular on the Numpy library.\n",
62-
"* CLinalg : it si a Linear-algebra simulator written in C++, with a python (pybind11) interface."
65+
"- `CLinalg`: This is a high-performance linear algebra simulator implemented in C++ with a Python interface (via **pybind11**). It offers faster execution times compared to PyLinalg.\n"
6366
]
6467
},
6568
{
@@ -69,44 +72,53 @@
6972
"source": [
7073
"## 4.2 Qaptiva™ Appliance\n",
7174
"\n",
72-
"For Qaptiva™ Appliance the **QPU** zoo is more complicated because several categories arise:\n",
75+
"For the **Qaptiva™ Appliance**, the range of available **QPUs** is more diverse, as they are categorized into distinct types based on their functionality:\n",
76+
"\n",
77+
"### 1. **Ideal Computation**\n",
78+
"In this category, the quantum circuit is simulated under ideal conditions without introducing noise. Two main approaches are available:\n",
79+
"\n",
80+
"- **Exact Representation**:\n",
81+
" - **LinAlg QPU**: A linear algebra simulator specifically designed for the **Quantum Learning Machine**. This simulator computes the state vector exactly, without any approximations.\n",
7382
"\n",
74-
"* **Ideal Computation**: in this case, the circuit is simulated ideally. Two different approaches can be used:\n",
75-
" * *Exact Representation*: **LinAlg QPU**: linear algebra simulator that was programing specifically for **Quantum Learning Machine**. The state vector is computed without any approximation.\n",
76-
" * *Approximate Representation*: **MPS QPU** using matrix product state for simulating in an approximated way the state vector.\n",
77-
"* **Noisy Computation**: in this case, the **QPU** can be configured with a noise model for doing a noisy simulation of the circuits. The **NoisyQProc QPU** is used for this task.\n",
78-
"\n"
83+
"- **Approximate Representation**:\n",
84+
" - **MPS QPU**: Utilizes matrix product states (MPS) to simulate the state vector in an approximate manner. This approach is particularly useful for handling larger systems where exact representation becomes computationally expensive.\n",
85+
"\n",
86+
"### 2. **Noisy Computation**\n",
87+
"In this category, the **QPU** incorporates a noise model to simulate realistic behavior, accounting for imperfections in quantum hardware. The following **QPU** is used for this purpose:\n",
88+
"\n",
89+
"- **NoisyQProc QPU**: Configured with a noise model, this simulator provides a more accurate representation of how circuits would behave on actual quantum devices.\n",
90+
"\n",
91+
"These categories allow users to choose the most appropriate simulation method based on their specific requirements, whether it be precision, scalability, or realism in the presence of noise."
7992
]
8093
},
8194
{
8295
"cell_type": "markdown",
8396
"id": "88e10ff3",
8497
"metadata": {},
8598
"source": [
86-
"## 4.3 Accesing ways Qaptiva™ Appliance **QPU**s\n",
99+
"## 4.3 Accessing Qaptiva™ Appliance QPU Modes\n",
87100
"\n",
101+
"The **QPU**s provided by the **Qaptiva™ Appliance** can be accessed in two distinct ways:\n",
88102
"\n",
89-
"Additionally, the Qaptiva™ Appliance **QPU**s can be used in two different ways:\n",
90-
"\n",
91-
"1. Locally connected to the **Quantum Learning Machine**.\n",
92-
"2. Connect to the remote QPUs of a **Quantum Learning Machine** using the **Qaptiva Access** library.\n"
103+
"1. **Local Connection**: Users should be connected to an available **Quantum Learning Machine**.\n",
104+
"2. **Remote Access via Qaptiva Access**: Users can also connect to remote **Quantum Learning Machine** using the **Qaptiva Access** library (also known as QLMaaS or QLM as a Service).\n"
93105
]
94106
},
95107
{
96108
"cell_type": "markdown",
97109
"id": "7eb69e24",
98110
"metadata": {},
99111
"source": [
100-
"## 5. How QQuantLib deals with QPUs?\n",
112+
"## 5. How QQuantLib Deals with QPUs?\n",
101113
"\n",
102-
"As explained before there are several **QPU**s and different ways to access them in the different **Eviden** environments. The **QQuantLib** allows the user to select them in an easy way using the *get_qpu* function from **QQuantLib.qpu.get_qpu** module. This function allows to the user select different ideal **QPU**s by providing a specific string:\n",
114+
"As explained earlier, there are several **QPUs** and multiple ways to access them across different **Eviden** environments. The **QQuantLib** library simplifies the selection process by providing the `get_qpu` function from the **QQuantLib.qpu.get_qpu** module. This function allows users to easily choose a specific **QPU** by passing a corresponding string identifier. Below is a list of available options:\n",
103115
"\n",
104-
"* *qlmass_linalg*: this is for getting the **LinAlg QPU** but using the **Qaptiva Access** library for a remote connection to a **Quantum Learning Machine**.\n",
105-
"* *qlmass_mps*: this is for getting the **MPS QPU** but using the **Qaptiva Access** library for a remote connection to a **Quantum Learning Machine**.\n",
106-
"* *linalg*: this is for getting the **LinAlg QPU** when locally connected to a **Quantum Learning Machine** (uses driectly the Qaptiva™ Appliance software)\n",
107-
"* *mps*: this is for getting the **MPS QPU** when locally connected to a **Quantum Learning Machine** (uses driectly the Qaptiva™ Appliance software)\n",
108-
"* *c*: this is for getting the **CLinalg QPU** (uses directly the **myQLM** software).\n",
109-
"* *python*: this is for getting the **PyLinalg QPU** (uses directly the **myQLM** software)."
116+
"- `qlmass_linalg`: Retrieves the **LinAlg QPU** via the **Qaptiva Access** library for remote execution on a **Quantum Learning Machine**.\n",
117+
"- `qlmass_mps`: Retrieves the **MPS QPU** via the **Qaptiva Access** library for remote execution on a **Quantum Learning Machine**.\n",
118+
"- `linalg`: Retrieves the **LinAlg QPU** for local execution on a **Quantum Learning Machine**, using the **Qaptiva™ Appliance** software directly.\n",
119+
"- `mps`: Retrieves the **MPS QPU** for local execution on a **Quantum Learning Machine**, using the **Qaptiva™ Appliance** software directly.\n",
120+
"- `c`: Retrieves the **CLinalg QPU**, utilizing the **myQLM** software directly.\n",
121+
"- `python`: Retrieves the **PyLinalg QPU**, utilizing the **myQLM** software directly.\n"
110122
]
111123
},
112124
{
@@ -210,19 +222,22 @@
210222
"id": "d3f7ac3c",
211223
"metadata": {},
212224
"source": [
213-
"## 6. What about noisy QPUs?\n",
225+
"## 6. What About Noisy QPUs?\n",
226+
"\n",
227+
"The **Eviden** Qaptiva™ Appliance enables users to create and configure various noise models, which can be easily integrated into a **QPU**. However, configuring noise models is a complex task, as numerous implementations and configurations are possible.\n",
214228
"\n",
215-
"**Eviden** Qaptiva™ Appliance allows to the user create and configure different noisy models and add to the **QPU** in an easy way. The main problem is that configuring noise models is a very complicated subject and a lot of different implementations can be used. \n",
229+
"To simplify this process, **QQuantLib** provides a predefined noisy model that can be configured to some extent, leveraging the capabilities of the **Eviden** Qaptiva™ Appliance library. This model offers a practical starting point for incorporating noise into quantum simulations.\n",
216230
"\n",
217-
"In the **QQuantLib** a fixed noisy model, that can be configured to some extent, was created using the **Eviden** Qaptiva™ Appliance library. For more information about the model and how to use we refer to the **QQuantLib/qpu/NoisyModels.ipynb** notebooks"
231+
"For more detailed information about the noise model, its configuration, and usage, please refer to the notebook: \n",
232+
"[**QQuantLib/qpu/NoisyModels.ipynb**](./QQuantLib/qpu/NoisyModels.ipynb).\n"
218233
]
219234
}
220235
],
221236
"metadata": {
222237
"kernelspec": {
223-
"display_name": "myqlm_tes",
238+
"display_name": "Python 3 (ipykernel)",
224239
"language": "python",
225-
"name": "myqlm_tes"
240+
"name": "python3"
226241
},
227242
"language_info": {
228243
"codemirror_mode": {
@@ -234,7 +249,7 @@
234249
"name": "python",
235250
"nbconvert_exporter": "python",
236251
"pygments_lexer": "ipython3",
237-
"version": "3.10.14"
252+
"version": "3.9.9"
238253
}
239254
},
240255
"nbformat": 4,

0 commit comments

Comments
 (0)