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