Jump to FSCD2025 Examples section
machine@user:~$ sudo apt install software-properties-common -y
machine@user:~$ sudo add-apt-repository ppa:deadsnakes/ppa
machine@user:~$ sudo apt install python3.10
machine@user:~$ curl -sS https://bootstrap.pypa.io/get-pip.py | python3.10If you needed these steps to upgrade to Python 3.10, do NOT try under any circumstances to play with the different Python versions now installed on your machine, you will break it. The previously installed Python 2 and Python 3 should still be the default and everything should still work.
The newly installed Python can be called and accessed via the new python3.10 command.
machine@user:~$ python3.10 -m virtualenv venvvenv can be replaced with any name you like. An eponymous directory has been created which will handle the environment.
The environment must be activated every time you use the package:
machine@user:~$ source venv/bin/activate
(venv) machine@user:~$ python
Python 3.10.16 (main, Dec 4 2024, 08:53:37) [GCC 9.4.0] on linux
Type "help", "copyright", "credits" or "license" for more information.
>>> (venv) machine@user:~$ pip install -e .This should install the pfoqcompiler package, along with all the package listed as dependencies in the pyproject.toml file and their respective dependencies.
Any use of the library, being for its development or intended use, must now be imported with:
from pfoqcompiler.compiler import *And not:
from compiler import *We provide here instructions to compile the different BASIC programs in the FSCD2025 submission, with the outcomes also given in the file FSCD_2025.
The compiler compiler.py can be found in the pfoqcompiler file.
The program PAIRS (Figure 1) can be compiled for input size 11 with the following command
machine@user:~$ python compiler.py -f pairs.pfoq -i 11The program QFT (Figure 5) on 4 qubits can be obtained with the command
machine@user:~$ python compiler.py -f QFT-basic.pfoq -i 4The Full Adder program (Example 14) can be compiled for the case of 13 qubits with the command
machine@user:~$ python compiler.py -f full_adder-basic.pfoq -i 13The Chained Substring example (Example 15) for k=2 can be compiled on input size 10 with the command
machine@user:~$ python compiler.py -f chained-substring.pfoq -i 10A more readable pdf version can be found .
The Sum(r) example (Example 16) for r=3 compiled for 6 input qubits is done with the command
machine@user:~$ python compiler.py -f sum_three.pfoq -i 6The examples can also be easily run without any optimization (basically as in the rules of compile (Figure 7) where we ignore the width condition and always perform the first case of the procedure compilation rule). This is triggered with the option --no-optimize. For instance, program PAIRS on input size 11 with no optimization results in the following circuit.
machine@user:~$ python compiler.py -f pairs.pfoq -i 11 --no-optimize




