CircuitLib
QuICT.tools.circuit_library.CircuitLib ¶
A class handling QuICT circuit library.
Parameters:
-
output_type(str, default:'circuit') –one of [circuit, qasm, file]. Defaults to "circuit".
-
output_path(str, default:'.') –The path to store qasm file if output type is file. Defaults to the current working path.
Source code in QuICT/tools/circuit_library/circuitlib.py
get_circuit ¶
get_circuit(type: str, classify: str = None, qubits_interval: Union[list, int] = None) -> Union[List[Union[Circuit, str]], None]
Get the target circuits from QuICT Circuit Library.
Parameters:
-
type(str) –The type of circuits, one of [machine, algorithm].
-
classify(str, default:None) –The classify of selected circuit's type. For machine circuit's type, classify is one of [aspen-4, ourense, rochester, sycamore, tokyo] For algorithm circuit's type, classify is one of [adder, clifford, qnn, grover, qft, vqe, cnf, maxcut, quantum_walk]
-
qubits_interval(Union[List, int], default:None) –The interval of qubit number, if it givens an interger, it equals to the interval of [1, qubits_interval], Otherwise, if it is list, it should contains the minimal qubits number and maximul qubits number.
Returns:
-
List[Circuit | String] | None–Return the list of output circuit order by output_type.
Source code in QuICT/tools/circuit_library/circuitlib.py
get_template_circuit ¶
get_template_circuit(qubits_interval: Union[list, int] = None, max_size: int = None, max_depth: int = None, typelist: list = None) -> Union[List[Union[Circuit, str]], None]
Get template circuits in QuICT circuit library. A template will be loaded if
it satisfies the following restrictions:
1. the circuit in the given classify.
2. its number of qubits <= max_width,
3. its number of gates <= max_size,
4. its depth <= max_depth.
5. its gates' types are in typelist
Restrictions will be ignored if not specified.
Parameters:
-
qubits_interval(Union[List, int], default:None) –The interval of qubit number, if it givens an interger, it equals to the interval of [1, qubits_interval], Otherwise, if it is list, it should contains the minimal qubits number and maximul qubits number. The range should be [1, 5].
-
max_size(int)–max number of gates, range is [2, 6].
-
max_depth(int)–max depth of circuit, range is [2, 9].
-
typelist(Iterable[GateType])–list of allowed gate types
Returns:
-
List[Circuit | String] | None–Return the list of output circuit order by output_type.