mindquantum.algorithm.compiler.BasicCompilerRule
- class mindquantum.algorithm.compiler.BasicCompilerRule(rule_name='BasicCompilerRule', log_level=0)[source]
The basic compiler rule class.
Compiler rule will handle a
DAGCircuit
and compile it following the rule in thedo
method. You must implement thedo
method when inheritance a child compiler rule. Please make sure that thedo
method will return a bool, which will tell whether the compiler successful compiled the circuit.- Parameters
- abstract do(dag_circuit: DAGCircuit)[source]
Inplace applying this compiler rule to the
DAGCircuit
.- Parameters
dag_circuit (
DAGCircuit
) – The DAG graph of quantum circuit.
- set_log_level(log_level: int)[source]
Set display log level.
- Parameters
log_level (int) – the display log level. Could be
0
,1
or2
. For more explanation of log level, please refers toBasicCompilerRule
.