simple_mappers
This module contains the following simple mappers:
- IdentityMapper
- HardcodedMapper
- RandomMapper
HardcodedMapper
Bases: Mapper
Source code in opensquirrel/passes/mapper/simple_mappers.py
__init__
A HardcodedMapper maps each virtual qubit to a hardcoded physical qubit
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
mapping
|
Mapping
|
The mapping from virtual to physical qubits |
required |
Source code in opensquirrel/passes/mapper/simple_mappers.py
map
Return the hardcoded mapping.
Source code in opensquirrel/passes/mapper/simple_mappers.py
IdentityMapper
Bases: Mapper
Source code in opensquirrel/passes/mapper/simple_mappers.py
__init__
An IdentityMapper maps each virtual qubit to exactly the same physical qubit.
map
Map the circuit according to a identity mapping.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
ir
|
IR
|
The intermediate representation of the quantum circuit to be mapped. |
required |
qubit_register_size
|
int
|
The size of the (virtual) qubit register. |
required |
Returns:
| Type | Description |
|---|---|
Mapping
|
Mapping from virtual to physical qubits. |
Source code in opensquirrel/passes/mapper/simple_mappers.py
RandomMapper
Bases: Mapper
Source code in opensquirrel/passes/mapper/simple_mappers.py
__init__
A RandomMapper maps each virtual qubit to a random physical qubit.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
seed
|
int | None
|
Random seed for reproducible results |
None
|
Source code in opensquirrel/passes/mapper/simple_mappers.py
map
Create a random mapping.