Skip to content

Commit 54ab13a

Browse files
committed
Refactor algorithm loading functions in README and codebase
1 parent 22d02b8 commit 54ab13a

44 files changed

Lines changed: 2209 additions & 2030 deletions

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

.github/ISSUE_TEMPLATE/algorithm-implementation.md

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -8,8 +8,8 @@ assignees: ''
88
---
99

1010
**Required functions to implement:**
11-
- [ ] `load_program()` - Load complete executable circuit
12-
- [ ] `generate_subroutine()` - Generate reusable subroutine
11+
- [ ] `generate_program()` - Load complete executable circuit
12+
- [ ] `save_to_qasm()` - Generate reusable subroutine
1313
- [ ] Additional functions: _______________
1414

1515
**CLI integration needed:**

README.md

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -65,12 +65,12 @@ you can generate .qasm files to use them as subroutines in your own circuits.
6565

6666
### Loading Algorithms as PyQASM Modules
6767

68-
To load an algorithm as a PyQASM module, use the `load_program` function from the `qbraid_algorithms` package, passing algorithm-specific parameters. For example, to load the Quantum Fourier Transform (QFT) algorithm:
68+
To load an algorithm as a PyQASM module, use the `generate_program` function from the `qbraid_algorithms` package, passing algorithm-specific parameters. For example, to load the Quantum Fourier Transform (QFT) algorithm:
6969

7070
```python
7171
from qbraid_algorithms import qft
7272

73-
qft_module = qft.load_program(3) # Load QFT for 3 qubits
73+
qft_module = qft.generate_program(3) # Load QFT for 3 qubits
7474
```
7575

7676
Now, you can perform operations with the PyQASM module, such as unrolling, and
@@ -84,15 +84,15 @@ qasm_str = pyqasm.dumps(qft_module)
8484
### Loading Algorithms as `.qasm` Files
8585

8686
In order to utilize algorithms as subroutines in your own circuits, use the
87-
`generate_subroutine` function for your desired algorithm. By passing algorithm-specific parameters, and optionally a desired output path, you can
87+
`save_to_qasm` function for your desired algorithm. By passing algorithm-specific parameters, and optionally a desired output path, you can
8888
generate a .qasm file containing a subroutine for the paramterized circuit. For
8989
example, to generate a QFT subroutine for 4 qubits:
9090

9191
```python
9292
from qbraid_algorithms import qft, iqft
9393
path = "path/to/output" # Specify your desired output path
94-
qft.generate_subroutine(4) # Generate 4-qubit QFT in the current directory
95-
iqft.generate_subroutine(4, path=path) # Generate 4-qubit IQFT in specified path
94+
qft.save_to_qasm(4) # Generate 4-qubit QFT in the current directory
95+
iqft.save_to_qasm(4, path=path) # Generate 4-qubit IQFT in specified path
9696

9797
```
9898

@@ -101,7 +101,7 @@ To utilize the generated subroutine in your own circuit, include the generated
101101
when generating the subroutine. For example, after running
102102

103103
```python
104-
qft.generate_subroutine(4)
104+
qft.save_to_qasm(4)
105105
```
106106

107107
you can append `include "qft.qasm";` to your OpenQASM file, and call the

0 commit comments

Comments
 (0)