Skip to content

Commit

Permalink
Merge branch 'Qiskit:main' into move-target
Browse files Browse the repository at this point in the history
  • Loading branch information
raynelfss authored Apr 19, 2024
2 parents 25c0595 + 5fb343f commit d97c13b
Show file tree
Hide file tree
Showing 4 changed files with 33 additions and 7 deletions.
4 changes: 0 additions & 4 deletions pyproject.toml
Original file line number Diff line number Diff line change
Expand Up @@ -227,18 +227,14 @@ disable = [
"no-value-for-parameter",
"not-context-manager",
"superfluous-parens",
"unknown-option-value",
"unexpected-keyword-arg",
"unnecessary-dict-index-lookup",
"unnecessary-direct-lambda-call",
"unnecessary-dunder-call",
"unnecessary-ellipsis",
"unnecessary-lambda-assignment",
"unnecessary-list-index-lookup",
"unspecified-encoding",
"unsupported-assignment-operation",
"use-dict-literal",
"use-list-literal",
"use-implicit-booleaness-not-comparison",
]

Expand Down
2 changes: 0 additions & 2 deletions qiskit/qpy/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -1101,7 +1101,6 @@
uint64_t metadata_size;
uint32_t num_registers;
uint64_t num_instructions;
uint64_t num_custom_gates;
}
This is immediately followed by ``name_size`` bytes of utf8 data for the name
Expand Down Expand Up @@ -1134,7 +1133,6 @@
uint64_t metadata_size;
uint32_t num_registers;
uint64_t num_instructions;
uint64_t num_custom_gates;
}
This is immediately followed by ``name_size`` bytes of utf8 data for the name
Expand Down
2 changes: 1 addition & 1 deletion qiskit/transpiler/preset_passmanagers/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -136,7 +136,7 @@ def generate_preset_pass_manager(
instruction_durations (InstructionDurations): Dictionary of duration
(in dt) for each instruction.
timing_constraints (TimingConstraints): Hardware time alignment restrictions.
initial_layout (Layout): Initial position of virtual qubits on
initial_layout (Layout | List[int]): Initial position of virtual qubits on
physical qubits.
layout_method (str): The :class:`~.Pass` to use for choosing initial qubit
placement. Valid choices are ``'trivial'``, ``'dense'``,
Expand Down
32 changes: 32 additions & 0 deletions test/python/transpiler/test_preset_passmanagers.py
Original file line number Diff line number Diff line change
Expand Up @@ -1436,6 +1436,38 @@ def test_generate_preset_pass_manager_with_list_coupling_map(self):
# Ensure the DAGs from both methods are identical
self.assertEqual(transpiled_circuit_list, transpiled_circuit_object)

@data(0, 1, 2, 3)
def test_generate_preset_pass_manager_with_list_initial_layout(self, optimization_level):
"""Test that generate_preset_pass_manager can handle list based initial layouts."""
coupling_map_list = [[0, 1]]

# Circuit that doesn't fit in the coupling map
qc = QuantumCircuit(2)
qc.h(0)
qc.cx(0, 1)
qc.cx(1, 0)
qc.measure_all()

pm_list = generate_preset_pass_manager(
optimization_level=optimization_level,
coupling_map=coupling_map_list,
basis_gates=["u", "cx"],
seed_transpiler=42,
initial_layout=[1, 0],
)
pm_object = generate_preset_pass_manager(
optimization_level=optimization_level,
coupling_map=coupling_map_list,
basis_gates=["u", "cx"],
seed_transpiler=42,
initial_layout=Layout.from_intlist([1, 0], *qc.qregs),
)
tqc_list = pm_list.run(qc)
tqc_obj = pm_list.run(qc)
self.assertIsInstance(pm_list, PassManager)
self.assertIsInstance(pm_object, PassManager)
self.assertEqual(tqc_list, tqc_obj)


@ddt
class TestIntegrationControlFlow(QiskitTestCase):
Expand Down

0 comments on commit d97c13b

Please sign in to comment.