Skip to content

Commit

Permalink
Remove check for U gate in map_gate_ids
Browse files Browse the repository at this point in the history
* This requires modifying the external parser crate.
* Depend temporarily on the branch of the parser with this modification.
* Make another change required by other upstream improvments.
* Cargo config files are changed because of above changes.
  • Loading branch information
jlapeyre committed May 2, 2024
1 parent f7cf821 commit b22b7d7
Show file tree
Hide file tree
Showing 4 changed files with 8 additions and 12 deletions.
10 changes: 5 additions & 5 deletions Cargo.lock

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion crates/qasm3/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -18,4 +18,4 @@ extension-module = ["pyo3/extension-module"]
pyo3.workspace = true
indexmap.workspace = true
hashbrown.workspace = true
oq3_semantics = { git = "https://github.com/jlapeyre/openqasm3_parser", branch = "update-for-qiskit-importer"}
oq3_semantics = { git = "https://github.com/jlapeyre/openqasm3_parser", branch = "no-U-in-gate-list"}
4 changes: 0 additions & 4 deletions crates/qasm3/src/build.rs
Original file line number Diff line number Diff line change
Expand Up @@ -231,10 +231,6 @@ impl BuilderState {
// Gates mapped via CustomGates will not raise an exception.
fn map_gate_ids(&mut self, _py: Python, ast_symbols: &SymbolTable) -> PyResult<()> {
for (name, name_id, defined_num_params, defined_num_qubits) in ast_symbols.gates().iter() {
if *name == "U" {
// The sole built in gate. `gphase` is treated specially.
continue;
}
let pygate = self.pygates.get(*name).ok_or_else(|| {
QASM3ImporterError::new_err(format!("can't handle non-built-in gate: '{}'", name))
})?;
Expand Down
4 changes: 2 additions & 2 deletions crates/qasm3/src/expr.rs
Original file line number Diff line number Diff line change
Expand Up @@ -241,11 +241,11 @@ pub fn eval_qarg(
qarg: &asg::GateOperand,
) -> PyResult<BroadcastItem> {
match qarg {
asg::GateOperand::Identifier(iden) => broadcast_bits_for_identifier(
asg::GateOperand::Identifier(symbol) => broadcast_bits_for_identifier(
py,
&our_symbols.qubits,
&our_symbols.qregs,
iden.symbol().as_ref().unwrap(),
symbol.as_ref().unwrap(),
),
asg::GateOperand::IndexedIdentifier(indexed) => {
let iden_symbol = indexed.identifier().as_ref().unwrap();
Expand Down

0 comments on commit b22b7d7

Please sign in to comment.