Check if the mapper
complies with the OpenSquirrel requirements.
If an implementation of Mapper
passes these checks it should be compatible with the Circuit.map
method.
Parameters:
Name |
Type |
Description |
Default |
mapper |
Mapper
|
|
required
|
Source code in opensquirrel\utils\check_passes\check_mapper.py
| def check_mapper(mapper: Mapper) -> None:
"""Check if the `mapper` complies with the OpenSquirrel requirements.
If an implementation of ``Mapper`` passes these checks it should be compatible with the ``Circuit.map`` method.
Args:
mapper: Mapper to check.
"""
assert isinstance(mapper, Mapper)
register_manager = RegisterManager(QubitRegister(10), BitRegister(10))
ir = IR()
circuit = Circuit(register_manager, ir)
_check_scenario(circuit, mapper)
ir = IR()
ir.add_comment(Comment("comment"))
ir.add_gate(BlochSphereRotation(Qubit(42), (1, 0, 0), 1, 2))
ir.add_gate(ControlledGate(Qubit(42), BlochSphereRotation.identity(Qubit(100))))
ir.add_measurement(Measure(Qubit(42), Bit(42), (0, 0, 1)))
Circuit(register_manager, ir)
_check_scenario(circuit, mapper)
|