qfnn.qf_circ.p_lyr_circ module

class qfnn.qf_circ.p_lyr_circ.P_LYR_Circ(n_qubits, n_repeats)

Bases: qfnn.qf_circ.base.LinnerCircuit

P_LYR_Circ is a class, which includes functions to build p-layer circuit

Parameters
  • n_qubits – input qubits of each unit

  • n_repeats – repeat times of each unit

add_aux(circuit, name='aux_qbit')

Function add add_aux is to add a group of qubits as input qubit .

Parameters

circuit – The circuit that you add the unit at the end

Returns

The register of qubits

Return type

qubits

add_out_qubits(circuit, name='p_layer_qbits')

Function add_out_qubits is to add a group of qubits as input qubit .

Parameters

circuit – The circuit that you add the unit at the end

Returns

The register of qubits

Return type

qubits

forward(circuit, weight, in_qubits, out_qubits, aux=[])

Function add forward is to add the circuit of batch normalization.

Parameters
  • circuit – The circuit that you add the unit at the end

  • weight – A list of binary weight.

  • in_qubits – The register of input qubits

  • out_qubit – The register of output qubits

  • aux – aux qubits

class qfnn.qf_circ.p_lyr_circ.P_Neuron_Circ(n_qubits)

Bases: qfnn.qf_circ.p_lyr_circ.P_LYR_Circ

P_Neuron_Circ is a class, which includes functions to build P-Neuron circuit. P-Layer consists of serverl P-Neuron.A neuron only repeats onece.

Parameters

n_qubits – input qubits of each unit

forward(circuit, weight, in_qubits, out_qubits, ang=[], aux=[])

Function forward is to add the circuit of batch normalization.

Parameters
  • circuit – The circuit that you add the unit at the end

  • weight – A list of binary weight.

  • in_qubits – The register of input qubits

  • out_qubit – The register of output qubits

  • ang – the angle list of angle encoding

  • aux – aux qubits