Skip to content
Merged
Show file tree
Hide file tree
Changes from 1 commit
Commits
Show all changes
32 commits
Select commit Hold shift + click to select a range
d2b3632
Draft minimal version of the to_openqasm transform
SimoneGasperini May 7, 2025
bc84b14
Fix copyright year
SimoneGasperini May 7, 2025
00ca12d
Move the function to the io module
SimoneGasperini May 7, 2025
97996f2
Fix to_openqasm function signature
SimoneGasperini May 7, 2025
41e27fe
Fix code formatting
SimoneGasperini May 7, 2025
c26c140
Merge branch 'master' into openqasm-transform
SimoneGasperini May 7, 2025
53f0a3f
Add docstring including example and usage details
SimoneGasperini May 8, 2025
11d7830
Merge branch 'openqasm-transform' of github.com:PennyLaneAI/pennylane…
SimoneGasperini May 8, 2025
a8be15d
Merge branch 'master' into openqasm-transform
SimoneGasperini May 8, 2025
6497853
Merge branch 'master' into openqasm-transform
SimoneGasperini May 8, 2025
a8c925c
Add basic unit tests
SimoneGasperini May 8, 2025
ad5ca97
Merge branch 'master' into openqasm-transform
SimoneGasperini May 8, 2025
e4727f4
Update the changelog
SimoneGasperini May 8, 2025
72c5ac0
Remove duplicate test
SimoneGasperini May 8, 2025
a9f20fe
Update doc/releases/changelog-dev.md
SimoneGasperini May 8, 2025
3f34bf1
Fix typos
SimoneGasperini May 8, 2025
e049cd0
Minor fix to docstring
SimoneGasperini May 8, 2025
bd3a783
Merge branch 'master' into openqasm-transform
SimoneGasperini May 8, 2025
9eb79e2
Merge branch 'master' into openqasm-transform
SimoneGasperini May 9, 2025
0380827
Move changelog entry on top
SimoneGasperini May 9, 2025
5a87a13
Fix docstring
SimoneGasperini May 9, 2025
55036b1
More minor fixes to docstring
SimoneGasperini May 9, 2025
5671127
Merge branch 'master' into openqasm-transform
SimoneGasperini May 9, 2025
6975858
Apply suggested docstring fixes
SimoneGasperini May 9, 2025
7d2e729
Add usage example to changelog
SimoneGasperini May 9, 2025
01249de
Minor fix to changelog
SimoneGasperini May 9, 2025
56d3a92
Minor fix
SimoneGasperini May 9, 2025
6ed02b4
Merge branch 'master' into openqasm-transform
SimoneGasperini May 12, 2025
1cc7217
Add test for numerical precision
SimoneGasperini May 12, 2025
718c217
Minor fix to docstring
SimoneGasperini May 12, 2025
8eb4c54
Fix sphinx failure
SimoneGasperini May 14, 2025
1978259
Merge branch 'master' into openqasm-transform
SimoneGasperini May 14, 2025
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions pennylane/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -128,6 +128,7 @@
pattern_matching_optimization,
clifford_t_decomposition,
add_noise,
to_openqasm,
)
from pennylane.ops.functions import (
dot,
Expand Down
1 change: 1 addition & 0 deletions pennylane/transforms/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -307,6 +307,7 @@ def circuit(params):
from .split_to_single_terms import split_to_single_terms
from .insert_ops import insert
from .combine_global_phases import combine_global_phases
from .openqasm import to_openqasm

from .mitigate import (
mitigate_with_zne,
Expand Down
26 changes: 26 additions & 0 deletions pennylane/transforms/openqasm.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,26 @@
# Copyright 2018-2024 Xanadu Quantum Technologies Inc.

# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at

# http://www.apache.org/licenses/LICENSE-2.0

# Unless required by applicable law or agreed to in writing, software
# distributed under the License is distributed on an "AS IS" BASIS,
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
# See the License for the specific language governing permissions and
# limitations under the License.

"""
Provides a transform to get the OpenQASM 2.0 program corresponding to a given QNode.
"""

from pennylane import workflow


def to_openqasm(qnode, *args, **kwargs) -> str:
"""TODO"""
tape = workflow.construct_tape(qnode)(*args, **kwargs)
qasm = tape.to_openqasm(*args, **kwargs)
return qasm