:py:mod:`pyqrack` ================= .. py:module:: pyqrack Subpackages ----------- .. toctree:: :titlesonly: :maxdepth: 3 qrack_system/index.rst tests/index.rst util/index.rst Submodules ---------- .. toctree:: :titlesonly: :maxdepth: 1 neuron_activation_fn/index.rst pauli/index.rst qrack_circuit/index.rst qrack_neuron/index.rst qrack_simulator/index.rst quimb_circuit_type/index.rst Package Contents ---------------- Classes ~~~~~~~ .. autoapisummary:: pyqrack.QrackSystem pyqrack.QrackSimulator pyqrack.QrackNeuron pyqrack.QrackCircuit pyqrack.Pauli pyqrack.NeuronActivationFn pyqrack.QuimbCircuitType Attributes ~~~~~~~~~~ .. autoapisummary:: pyqrack.Qrack .. py:class:: QrackSystem .. py:data:: Qrack .. py:class:: QrackSimulator(qubitCount=-1, cloneSid=-1, isTensorNetwork=True, isSchmidtDecomposeMulti=True, isSchmidtDecompose=True, isStabilizerHybrid=True, isBinaryDecisionTree=False, isPaged=True, isCpuGpuHybrid=True, isOpenCL=True, isHostPointer=False, pyzxCircuit=None, qiskitCircuit=None) Interface for all the QRack functionality. .. attribute:: qubitCount Number of qubits that are to be simulated. :type: int .. attribute:: sid Corresponding simulator id. :type: int .. py:method:: _get_error() .. py:method:: _throw_if_error() .. py:method:: __del__() .. py:method:: _int_byref(a) .. py:method:: _ulonglong_byref(a) .. py:method:: _double_byref(a) .. py:method:: _complex_byref(a) .. py:method:: _real1_byref(a) .. py:method:: _bool_byref(a) .. py:method:: _qrack_complex_byref(a) .. py:method:: _to_ubyte(nv, v) .. py:method:: _to_ulonglong(m, v) .. py:method:: _pairwise(it) .. py:method:: seed(s) .. py:method:: set_concurrency(p) .. py:method:: x(q) Applies X gate. Applies the Pauli “X” operator to the qubit at position “q.” The Pauli “X” operator is equivalent to a logical “NOT.” :param q: the qubit number on which the gate is applied to. :raises RuntimeError: QrackSimulator raised an exception. .. py:method:: y(q) Applies Y gate. Applies the Pauli “Y” operator to the qubit at “q.” The Pauli “Y” operator is equivalent to a logical “NOT" with permutation phase. :param q: the qubit number on which the gate is applied to. :raises RuntimeError: QrackSimulator raised an exception. .. py:method:: z(q) Applies Z gate. Applies the Pauli “Z” operator to the qubit at “q.” The Pauli “Z” operator flips the phase of `|1>` :param q: the qubit number on which the gate is applied to. :raises RuntimeError: QrackSimulator raised an exception. .. py:method:: h(q) Applies H gate. Applies the Hadarmard operator to the qubit at “q.” :param q: the qubit number on which the gate is applied to. :raises RuntimeError: QrackSimulator raised an exception. .. py:method:: s(q) Applies S gate. Applies the 1/4 phase rotation to the qubit at “q.” :param q: the qubit number on which the gate is applied to. :raises RuntimeError: QrackSimulator raised an exception. .. py:method:: t(q) Applies T gate. Applies the 1/8 phase rotation to the qubit at “q.” :param q: the qubit number on which the gate is applied to. :raises RuntimeError: QrackSimulator raised an exception. .. py:method:: adjs(q) Adjoint of S gate Applies the gate equivalent to the inverse of S gate. :param q: the qubit number on which the gate is applied to. :raises RuntimeError: QrackSimulator raised an exception. .. py:method:: adjt(q) Adjoint of T gate Applies the gate equivalent to the inverse of T gate. :param q: the qubit number on which the gate is applied to. :raises RuntimeError: QrackSimulator raised an exception. .. py:method:: u(q, th, ph, la) General unitary gate. Applies a gate guaranteed to be unitary. Spans all possible single bit unitary gates. `U(theta, phi, lambda) = RZ(phi + pi/2)RX(theta)RZ(lambda - pi/2)` :param q: the qubit number on which the gate is applied to. :param th: theta :param ph: phi :param la: lambda :raises RuntimeError: QrackSimulator raised an exception. .. py:method:: mtrx(m, q) Operation from matrix. Applies arbitrary operation defined by the given matrix. :param m: row-major complex list representing the operator. :param q: the qubit number on which the gate is applied to. :raises ValueError: 2x2 matrix 'm' in QrackSimulator.mtrx() must contain at least 4 elements. :raises RuntimeError: QrackSimulator raised an exception. .. py:method:: r(b, ph, q) Rotation gate. Rotate the qubit along the given pauli basis by the given angle. :param b: Pauli basis :param ph: rotation angle :param q: the qubit number on which the gate is applied to :raises RuntimeError: QrackSimulator raised an exception. .. py:method:: exp(b, ph, q) Arbitrary exponentiation `exp(b, theta) = e^{i*theta*[b_0 . b_1 ...]}` where `.` is the tensor product. :param b: Pauli basis :param ph: coefficient of exponentiation :param q: the qubit number on which the gate is applied to :raises RuntimeError: QrackSimulator raised an exception. .. py:method:: mcx(c, q) Multi-controlled X gate If all controlled qubits are `|1>` then the target qubit is flipped. :param c: list of controlled qubits. :param q: target qubit. :raises RuntimeError: QrackSimulator raised an exception. .. py:method:: mcy(c, q) Multi-controlled Y gate If all controlled qubits are `|1>` then the Pauli "Y" gate is applied to the target qubit. :param c: list of controlled qubits. :param q: target qubit. :raises RuntimeError: QrackSimulator raised an exception. .. py:method:: mcz(c, q) Multi-controlled Z gate If all controlled qubits are `|1>` then the Pauli "Z" gate is applied to the target qubit. :param c: list of controlled qubits. :param q: target qubit. :raises RuntimeError: QrackSimulator raised an exception. .. py:method:: mch(c, q) Multi-controlled H gate If all controlled qubits are `|1>` then the Hadarmard gate is applied to the target qubit. :param c: list of controlled qubits. :param q: target qubit. :raises RuntimeError: QrackSimulator raised an exception. .. py:method:: mcs(c, q) Multi-controlled S gate If all controlled qubits are `|1>` then the "S" gate is applied to the target qubit. :param c: list of controlled qubits. :param q: target qubit. :raises RuntimeError: QrackSimulator raised an exception. .. py:method:: mct(c, q) Multi-controlled T gate If all controlled qubits are `|1>` then the "T" gate is applied to the target qubit. :param c: list of controlled qubits. :param q: target qubit. :raises RuntimeError: QrackSimulator raised an exception. .. py:method:: mcadjs(c, q) Multi-controlled adjs gate If all controlled qubits are `|1>` then the adjs gate is applied to the target qubit. :param c: list of controlled qubits. :param q: target qubit. :raises RuntimeError: QrackSimulator raised an exception. .. py:method:: mcadjt(c, q) Multi-controlled adjt gate If all controlled qubits are `|1>` then the adjt gate is applied to the target qubit. :param c: list of controlled qubits. :param q: target qubit. :raises RuntimeError: QrackSimulator raised an exception. .. py:method:: mcu(c, q, th, ph, la) Multi-controlled arbitraty unitary If all controlled qubits are `|1>` then the unitary gate described by parameters is applied to the target qubit. :param c: list of controlled qubits. :param q: target qubit. :param th: theta :param ph: phi :param la: lambda :raises RuntimeError: QrackSimulator raised an exception. .. py:method:: mcmtrx(c, m, q) Multi-controlled arbitrary operator If all controlled qubits are `|1>` then the arbitrary operation by parameters is applied to the target qubit. :param c: list of controlled qubits :param m: row-major complex list representing the operator. :param q: target qubit :raises ValueError: 2x2 matrix 'm' in QrackSimulator.mcmtrx() must contain at least 4 elements. :raises RuntimeError: QrackSimulator raised an exception. .. py:method:: macx(c, q) Anti multi-controlled X gate If all controlled qubits are `|0>` then the target qubit is flipped. :param c: list of controlled qubits. :param q: target qubit. :raises RuntimeError: QrackSimulator raised an exception. .. py:method:: macy(c, q) Anti multi-controlled Y gate If all controlled qubits are `|0>` then the Pauli "Y" gate is applied to the target qubit. :param c: list of controlled qubits. :param q: target qubit. :raises RuntimeError: QrackSimulator raised an exception. .. py:method:: macz(c, q) Anti multi-controlled Z gate If all controlled qubits are `|0>` then the Pauli "Z" gate is applied to the target qubit. :param c: list of controlled qubits. :param q: target qubit. :raises RuntimeError: QrackSimulator raised an exception. .. py:method:: mach(c, q) Anti multi-controlled H gate If all controlled qubits are `|0>` then the Hadarmard gate is applied to the target qubit. :param c: list of controlled qubits. :param q: target qubit. :raises RuntimeError: QrackSimulator raised an exception. .. py:method:: macs(c, q) Anti multi-controlled S gate If all controlled qubits are `|0>` then the "S" gate is applied to the target qubit. :param c: list of controlled qubits. :param q: target qubit. :raises RuntimeError: QrackSimulator raised an exception. .. py:method:: mact(c, q) Anti multi-controlled T gate If all controlled qubits are `|0>` then the "T" gate is applied to the target qubit. :param c: list of controlled qubits. :param q: target qubit. :raises RuntimeError: QrackSimulator raised an exception. .. py:method:: macadjs(c, q) Anti multi-controlled adjs gate If all controlled qubits are `|0>` then the adjs gate is applied to the target qubit. :param c: list of controlled qubits. :param q: target qubit. :raises RuntimeError: QrackSimulator raised an exception. .. py:method:: macadjt(c, q) Anti multi-controlled adjt gate If all controlled qubits are `|0>` then the adjt gate is applied to the target qubit. :param c: list of controlled qubits. :param q: target qubit. :raises RuntimeError: QrackSimulator raised an exception. .. py:method:: macu(c, q, th, ph, la) Anti multi-controlled arbitraty unitary If all controlled qubits are `|0>` then the unitary gate described by parameters is applied to the target qubit. :param c: list of controlled qubits. :param q: target qubit. :param th: theta :param ph: phi :param la: lambda :raises RuntimeError: QrackSimulator raised an exception. .. py:method:: macmtrx(c, m, q) Anti multi-controlled arbitraty operator If all controlled qubits are `|0>` then the arbitrary operation by parameters is applied to the target qubit. :param c: list of controlled qubits. :param m: row-major complex matrix which defines the operator. :param q: target qubit. :raises ValueError: 2x2 matrix 'm' in QrackSimulator.macmtrx() must contain at least 4 elements. :raises RuntimeError: QrackSimulator raised an exception. .. py:method:: ucmtrx(c, m, q, p) Multi-controlled arbitrary operator with arbitrary controls If all control qubits match 'p' permutation by bit order, then the arbitrary operation by parameters is applied to the target qubit. :param c: list of control qubits :param m: row-major complex list representing the operator. :param q: target qubit :param p: permutation of list of control qubits :raises ValueError: 2x2 matrix 'm' in QrackSimulator.ucmtrx() must contain at least 4 elements. :raises RuntimeError: QrackSimulator raised an exception. .. py:method:: multiplex1_mtrx(c, q, m) Multiplex gate A multiplex gate with a single target and an arbitrary number of controls. :param c: list of controlled qubits. :param m: row-major complex matrix which defines the operator. :param q: target qubit. :raises ValueError: Multiplex matrix 'm' in QrackSimulator.multiplex1_mtrx() must contain at least 4 elements. :raises RuntimeError: QrackSimulator raised an exception. .. py:method:: mx(q) Multi X-gate Applies the Pauli “X” operator on all qubits. :param q: list of qubits to apply X on. :raises RuntimeError: QrackSimulator raised an exception. .. py:method:: my(q) Multi Y-gate Applies the Pauli “Y” operator on all qubits. :param q: list of qubits to apply Y on. :raises RuntimeError: QrackSimulator raised an exception. .. py:method:: mz(q) Multi Z-gate Applies the Pauli “Z” operator on all qubits. :param q: list of qubits to apply Z on. :raises RuntimeError: QrackSimulator raised an exception. .. py:method:: mcr(b, ph, c, q) Multi-controlled arbitrary rotation. If all controlled qubits are `|1>` then the arbitrary rotation by parameters is applied to the target qubit. :param b: Pauli basis :param ph: coefficient of exponentiation. :param c: list of controlled qubits. :param q: the qubit number on which the gate is applied to. :raises RuntimeError: QrackSimulator raised an exception. .. py:method:: mcexp(b, ph, cs, q) Multi-controlled arbitrary exponentiation If all controlled qubits are `|1>` then the target qubit is exponentiated an pauli basis basis with coefficient. :param b: Pauli basis :param ph: coefficient of exponentiation. :param q: the qubit number on which the gate is applied to. :raises RuntimeError: QrackSimulator raised an exception. .. py:method:: swap(qi1, qi2) Swap Gate Swaps the qubits at two given positions. :param qi1: First position of qubit. :param qi2: Second position of qubit. :raises RuntimeError: QrackSimulator raised an exception. .. py:method:: iswap(qi1, qi2) Swap Gate with phase. Swaps the qubits at two given positions. If the bits are different then there is additional phase of `i`. :param qi1: First position of qubit. :param qi2: Second position of qubit. :raises RuntimeError: QrackSimulator raised an exception. .. py:method:: adjiswap(qi1, qi2) Swap Gate with phase. Swaps the qubits at two given positions. If the bits are different then there is additional phase of `-i`. :param qi1: First position of qubit. :param qi2: Second position of qubit. :raises RuntimeError: QrackSimulator raised an exception. .. py:method:: fsim(th, ph, qi1, qi2) Fsim gate. The 2-qubit “fSim” gate Useful in the simulation of particles with fermionic statistics :param qi1: First position of qubit. :param qi2: Second position of qubit. :raises RuntimeError: QrackSimulator raised an exception. .. py:method:: cswap(c, qi1, qi2) Controlled-swap Gate Swaps the qubits at two given positions if the control qubits are `|1>` :param c: list of controlled qubits. :param qi1: First position of qubit. :param qi2: Second position of qubit. :raises RuntimeError: QrackSimulator raised an exception. .. py:method:: acswap(c, qi1, qi2) Anti controlled-swap Gate Swaps the qubits at two given positions if the control qubits are `|0>` :param c: list of controlled qubits. :param qi1: First position of qubit. :param qi2: Second position of qubit. :raises RuntimeError: QrackSimulator raised an exception. .. py:method:: m(q) Measurement gate Measures the qubit at "q" and returns Boolean value. This operator is not unitary & is probabilistic in nature. :param q: qubit to measure :raises RuntimeError: QrackSimulator raised an exception. :returns: Measurement result. .. py:method:: force_m(q, r) Force-Measurement gate Acts as if the measurement is applied and the result obtained is `r` :param q: qubit to measure :param r: the required result :raises RuntimeError: QrackSimulator raised an exception. :returns: Measurement result. .. py:method:: m_all() Measure-all gate Measures measures all qubits. This operator is not unitary & is probabilistic in nature. :raises RuntimeError: QrackSimulator raised an exception. :returns: Measurement result of all qubits. .. py:method:: measure_pauli(b, q) Pauli Measurement gate Measures the qubit at "q" with the given pauli basis. This operator is not unitary & is probabilistic in nature. :param b: Pauli basis :param q: qubit to measure :raises RuntimeError: QrackSimulator raised an exception. :returns: Measurement result. .. py:method:: measure_shots(q, s) Multi-shot measurement operator Measures the qubit at "q" with the given pauli basis. This operator is not unitary & is probabilistic in nature. :param q: list of qubits to measure :param s: number of shots :raises RuntimeError: QrackSimulator raised an exception. :returns: list of measurement result. .. py:method:: reset_all() Reset gate Resets all qubits to `|0>` :raises RuntimeError: QrackSimulator raised an exception. .. py:method:: _split_longs(a) Split operation Splits the given integer into 64 bit numbers. :param a: number to split :raises RuntimeError: QrackSimulator raised an exception. :returns: list of split numbers. .. py:method:: _split_longs_2(a, m) Split simultanoues operation Splits 2 integers into same number of 64 bit numbers. :param a: first number to split :param m: second number to split :raises RuntimeError: QrackSimulator raised an exception. :returns: pair of lists of split numbers. .. py:method:: add(a, q) Add integer to qubit Adds the given integer to the given set of qubits. :param a: first number to split :param q: list of qubits to add the number :raises RuntimeError: QrackSimulator raised an exception. .. py:method:: sub(a, q) Subtract integer to qubit Subtracts the given integer to the given set of qubits. :param a: first number to split :param q: list of qubits to subtract the number :raises RuntimeError: QrackSimulator raised an exception. .. py:method:: adds(a, s, q) Signed Addition integer to qubit Signed Addition of the given integer to the given set of qubits, if there is an overflow the resultant will become negative. :param a: number to add :param s: qubit to store overflow :param q: list of qubits to add the number :raises RuntimeError: QrackSimulator raised an exception. .. py:method:: subs(a, s, q) Subtract integer to qubit Subtracts the given integer to the given set of qubits, if there is an overflow the resultant will become negative. :param a: number to subtract :param s: qubit to store overflow :param q: list of qubits to subtract the number :raises RuntimeError: QrackSimulator raised an exception. .. py:method:: mul(a, q, o) Multiplies integer to qubit Multiplies the given integer to the given set of qubits. Carry register is required for maintaining the unitary nature of operation and must be as long as the input qubit register. :param a: number to multiply :param q: list of qubits to multiply the number :param o: carry register :raises RuntimeError: QrackSimulator raised an exception. :raises RuntimeError: QrackSimulator with isTensorNetwork=True option cannot mul()! (Turn off just this option, in the constructor.) .. py:method:: div(a, q, o) Divides qubit by integer 'Divides' the given qubits by the integer. (This is rather the adjoint of mul().) Carry register is required for maintaining the unitary nature of operation. :param a: integer to divide by :param q: qubits to divide :param o: carry register :raises RuntimeError: QrackSimulator raised an exception. :raises RuntimeError: QrackSimulator with isTensorNetwork=True option cannot div()! (Turn off just this option, in the constructor.) .. py:method:: muln(a, m, q, o) Modulo Multiplication Modulo Multiplication of the given integer to the given set of qubits Out-of-place register is required to store the resultant. :param a: number to multiply :param m: modulo number :param q: list of qubits to multiply the number :param o: carry register :raises RuntimeError: QrackSimulator raised an exception. .. py:method:: divn(a, m, q, o) Modulo Division 'Modulo Division' of the given set of qubits by the given integer (This is rather the adjoint of muln().) Out-of-place register is required to retrieve the resultant. :param a: integer by which qubit will be divided :param m: modulo integer :param q: qubits to divide :param o: carry register :raises RuntimeError: QrackSimulator raised an exception. .. py:method:: pown(a, m, q, o) Modulo Power Raises the qubit to the power `a` to which `mod m` is applied to. Out-of-place register is required to store the resultant. :param a: number in power :param m: modulo number :param q: list of qubits to exponentiate :param o: out-of-place register :raises RuntimeError: QrackSimulator raised an exception. :raises RuntimeError: QrackSimulator with isTensorNetwork=True option cannot pown()! (Turn off just this option, in the constructor.) .. py:method:: mcadd(a, c, q) Controlled-add Adds the given integer to the given set of qubits if all controlled qubits are `|1>`. :param a: number to add. :param c: list of controlled qubits. :param q: list of qubits to add the number :raises RuntimeError: QrackSimulator raised an exception. .. py:method:: mcsub(a, c, q) Controlled-subtract Subtracts the given integer to the given set of qubits if all controlled qubits are `|1>`. :param a: number to subtract. :param c: list of controlled qubits. :param q: list of qubits to add the number :raises RuntimeError: QrackSimulator raised an exception. .. py:method:: mcmul(a, c, q, o) Controlled-multiply Multiplies the given integer to the given set of qubits if all controlled qubits are `|1>`. Carry register is required for maintaining the unitary nature of operation. :param a: number to multiply :param c: list of controlled qubits. :param q: list of qubits to add the number :param o: carry register :raises RuntimeError: QrackSimulator raised an exception. :raises RuntimeError: QrackSimulator with isTensorNetwork=True option cannot mcmul()! (Turn off just this option, in the constructor.) .. py:method:: mcdiv(a, c, q, o) Controlled-divide. 'Divides' the given qubits by the integer if all controlled qubits are `|1>`. (This is rather the adjoint of mcmul().) Carry register is required for maintaining the unitary nature of operation. :param a: number to divide by :param c: list of controlled qubits. :param q: qubits to divide :param o: carry register :raises RuntimeError: QrackSimulator raised an exception. :raises RuntimeError: QrackSimulator with isTensorNetwork=True option cannot mcdiv()! (Turn off just this option, in the constructor.) .. py:method:: mcmuln(a, c, m, q, o) Controlled-modulo multiplication Modulo multiplication of the given integer to the given set of qubits if all controlled qubits are `|1>`. Out-of-place register is required to store the resultant. :param a: number to multiply :param c: list of controlled qubits. :param m: modulo number :param q: list of qubits to add the number :param o: out-of-place output register :raises RuntimeError: QrackSimulator raised an exception. .. py:method:: mcdivn(a, c, m, q, o) Controlled-divide. Modulo division of the given qubits by the given number if all controlled qubits are `|1>`. (This is rather the adjoint of mcmuln().) Out-of-place register is required to retrieve the resultant. :param a: number to divide by :param c: list of controlled qubits. :param m: modulo number :param q: qubits to divide :param o: carry register :raises RuntimeError: QrackSimulator raised an exception. .. py:method:: mcpown(a, c, m, q, o) Controlled-modulo Power Raises the qubit to the power `a` to which `mod m` is applied to if all the controlled qubits are set to `|1>`. Out-of-place register is required to store the resultant. :param a: number in power :param c: control qubits :param m: modulo number :param q: list of qubits to exponentiate :param o: out-of-place register :raises RuntimeError: QrackSimulator raised an exception. :raises RuntimeError: QrackSimulator with isTensorNetwork=True option cannot mcpown()! (Turn off just this option, in the constructor.) .. py:method:: lda(qi, qv, t) Load Accumalator Quantum counterpart for LDA from MOS-6502 assembly. `t` must be of the length `2 ** len(qi)`. It loads each list entry index of t into the qi register and each list entry value into the qv register. :param qi: qubit register for index :param qv: qubit register for value :param t: list of values :raises RuntimeError: QrackSimulator raised an exception. :raises RuntimeError: QrackSimulator with isTensorNetwork=True option cannot lda()! (Turn off just this option, in the constructor.) .. py:method:: adc(s, qi, qv, t) Add with Carry Quantum counterpart for ADC from MOS-6502 assembly. `t` must be of the length `2 ** len(qi)`. :param qi: qubit register for index :param qv: qubit register for value :param t: list of values :raises RuntimeError: QrackSimulator raised an exception. :raises RuntimeError: QrackSimulator with isTensorNetwork=True option cannot adc()! (Turn off just this option, in the constructor.) .. py:method:: sbc(s, qi, qv, t) Subtract with Carry Quantum counterpart for SBC from MOS-6502 assembly. `t` must be of the length `2 ** len(qi)` :param qi: qubit register for index :param qv: qubit register for value :param t: list of values :raises RuntimeError: QrackSimulator raised an exception. :raises RuntimeError: QrackSimulator with isTensorNetwork=True option cannot sbc()! (Turn off just this option, in the constructor.) .. py:method:: hash(q, t) Hash function Replicates the behaviour of LDA without the index register. For the operation to be unitary, the entries present in `t` must be unique, and the length of `t` must be `2 ** len(qi)`. :param q: qubit register for value :param t: list of values :raises RuntimeError: QrackSimulator raised an exception. :raises RuntimeError: QrackSimulator with isTensorNetwork=True option cannot hash()! (Turn off just this option, in the constructor.) .. py:method:: qand(qi1, qi2, qo) Logical AND Logical AND of 2 qubits whose result is stored in the target qubit. :param qi1: qubit 1 :param qi2: qubit 2 :param qo: target qubit :raises RuntimeError: QrackSimulator raised an exception. .. py:method:: qor(qi1, qi2, qo) Logical OR Logical OR of 2 qubits whose result is stored in the target qubit. :param qi1: qubit 1 :param qi2: qubit 2 :param qo: target qubit :raises RuntimeError: QrackSimulator raised an exception. .. py:method:: qxor(qi1, qi2, qo) Logical XOR Logical exlusive-OR of 2 qubits whose result is stored in the target qubit. :param qi1: qubit 1 :param qi2: qubit 2 :param qo: target qubit :raises RuntimeError: QrackSimulator raised an exception. .. py:method:: qnand(qi1, qi2, qo) Logical NAND Logical NAND of 2 qubits whose result is stored in the target qubit. :param qi1: qubit 1 :param qi2: qubit 2 :param qo: target qubit :raises RuntimeError: QrackSimulator raised an exception. .. py:method:: qnor(qi1, qi2, qo) Logical NOR Logical NOR of 2 qubits whose result is stored in the target qubit. :param qi1: qubit 1 :param qi2: qubit 2 :param qo: target qubit :raises RuntimeError: QrackSimulator raised an exception. .. py:method:: qxnor(qi1, qi2, qo) Logical XOR Logical exlusive-NOR of 2 qubits whose result is stored in the target qubit. :param qi1: qubit 1 :param qi2: qubit 2 :param qo: target qubit :raises RuntimeError: QrackSimulator raised an exception. .. py:method:: cland(ci, qi, qo) Classical AND Logical AND with one qubit and one classical bit whose result is stored in target qubit. :param qi1: qubit 1 :param qi2: qubit 2 :param qo: target qubit :raises RuntimeError: QrackSimulator raised an exception. .. py:method:: clor(ci, qi, qo) Classical OR Logical OR with one qubit and one classical bit whose result is stored in target qubit. :param qi1: qubit 1 :param qi2: qubit 2 :param qo: target qubit :raises RuntimeError: QrackSimulator raised an exception. .. py:method:: clxor(ci, qi, qo) Classical XOR Logical exlusive-OR with one qubit and one classical bit whose result is stored in target qubit. :param qi1: qubit 1 :param qi2: qubit 2 :param qo: target qubit :raises RuntimeError: QrackSimulator raised an exception. .. py:method:: clnand(ci, qi, qo) Classical NAND Logical NAND with one qubit and one classical bit whose result is stored in target qubit. :param qi1: qubit 1 :param qi2: qubit 2 :param qo: target qubit :raises RuntimeError: QrackSimulator raised an exception. .. py:method:: clnor(ci, qi, qo) Classical NOR Logical NOR with one qubit and one classical bit whose result is stored in target qubit. :param qi1: qubit 1 :param qi2: qubit 2 :param qo: target qubit :raises RuntimeError: QrackSimulator raised an exception. .. py:method:: clxnor(ci, qi, qo) Classical XNOR Logical exlusive-NOR with one qubit and one classical bit whose result is stored in target qubit. :param qi1: qubit 1 :param qi2: qubit 2 :param qo: target qubit :raises RuntimeError: QrackSimulator raised an exception. .. py:method:: qft(qs) Quantum Fourier Transform Applies Quantum Fourier Transform on the list of qubits provided. :param qs: list of qubits :raises RuntimeError: QrackSimulator raised an exception. .. py:method:: iqft(qs) Inverse-quantum Fourier Transform Applies Inverse-quantum Fourier Transform on the list of qubits provided. :param qs: list of qubits :raises RuntimeError: QrackSimulator raised an exception. .. py:method:: allocate_qubit(qid) Allocate Qubit Allocate 1 new qubit with the given qubit ID. :param qid: qubit id :raises RuntimeError: QrackSimulator raised an exception. .. py:method:: release(q) Release Qubit Release qubit given by the given qubit ID. :param q: qubit id :raises RuntimeError: QrackSimulator raised an exception. :returns: If the qubit was in `|0>` state with small tolerance. .. py:method:: num_qubits() Get Qubit count Returns the qubit count of the simulator. :param q: qubit id :raises RuntimeError: QrackSimulator raised an exception. :returns: Qubit count of the simulator .. py:method:: compose(other, q) Compose qubits Compose quantum description of given qubit with the current system. :param q: qubit id :raises RuntimeError: QrackSimulator raised an exception. :raises RuntimeError: QrackSimulator with isTensorNetwork=True option cannot compose()! (Turn off just this option, in the constructor.) .. py:method:: decompose(q) Decompose system Decompose the given qubit out of the system. Warning: The qubit subsystem state must be separable, or the behavior of this method is undefined. :param q: qubit id :raises RuntimeError: QrackSimulator raised an exception. :raises RuntimeError: QrackSimulator with isTensorNetwork=True option cannot decompose()! (Turn off just this option, in the constructor.) :returns: State of the systems. .. py:method:: dispose(q) Dispose qubits Minimally decompose a set of contiguous bits from the separably composed unit, and discard the separable bits. Warning: The qubit subsystem state must be separable, or the behavior of this method is undefined. :param q: qubit :raises RuntimeError: QrackSimulator raised an exception. :raises RuntimeError: QrackSimulator with isTensorNetwork=True option cannot dispose()! (Turn off just this option, in the constructor.) :returns: State of the systems. .. py:method:: dump_ids() Dump all IDs Dump all IDs from the selected simulator ID into the callback. :returns: List of ids .. py:method:: dump_ids_callback() C callback function .. py:method:: dump() Dump state vector Dump state vector from the selected simulator ID into the callback. :returns: State vector list .. py:method:: dump_callback(i) C callback function .. py:method:: in_ket(ket) Set state vector Set state vector for the selected simulator ID. Warning: State vector is not always the internal representation leading to sub-optimal performance of the method. :param ket: the state vector to which simulator will be set :raises RuntimeError: QrackSimulator raised an exception. .. py:method:: out_ket() Set state vector Returns the raw state vector of the simulator. Warning: State vector is not always the internal representation leading to sub-optimal performance of the method. :raises RuntimeError: QrackSimulator raised an exception. :returns: list representing the state vector. .. py:method:: prob(q) Probability of `|1>` Get the probability that a qubit is in the `|1>` state. :param q: qubit id :raises RuntimeError: QrackSimulator raised an exception. :returns: probability of qubit being in `|1>` .. py:method:: prob_rdm(q) Probability of `|1>`, (tracing out the reduced density matrix without stabilizer ancillary qubits) Get the probability that a qubit is in the `|1>` state. :param q: qubit id :raises RuntimeError: QrackSimulator raised an exception. :returns: probability of qubit being in `|1>` .. py:method:: prob_perm(q, c) Probability of permutation Get the probability that the qubit IDs in "q" have the truth values in "c", directly corresponding by list index. :param q: list of qubit ids :param c: list of qubit truth values bools :raises RuntimeError: QrackSimulator raised an exception. :returns: probability that each qubit in "q[i]" has corresponding truth value in "c[i]", at once .. py:method:: prob_perm_rdm(q, c, r=True) Probability of permutation, (tracing out the reduced density matrix without stabilizer ancillary qubits) Get the probability that the qubit IDs in "q" have the truth values in "c", directly corresponding by list index. :param q: list of qubit ids :param c: list of qubit truth values bools :param r: round Rz gates down from T^(1/2) :raises RuntimeError: QrackSimulator raised an exception. :returns: probability that each qubit in "q[i]" has corresponding truth value in "c[i]", at once .. py:method:: permutation_expectation(q) Permutation expectation value Get the permutation expectation value, based upon the order of input qubits. :param q: qubits, from low to high :raises RuntimeError: QrackSimulator raised an exception. :returns: Expectation value .. py:method:: permutation_expectation_rdm(q, r=True) Permutation expectation value, (tracing out the reduced density matrix without stabilizer ancillary qubits) Get the permutation expectation value, based upon the order of input qubits. :param q: qubits, from low to high :param r: round Rz gates down from T^(1/2) :raises RuntimeError: QrackSimulator raised an exception. :returns: Expectation value .. py:method:: factorized_expectation(q, c) Factorized expectation value Get the factorized expectation value, where each entry in "c" is an expectation value for corresponding "q" being false, then true, repeated for each in "q". :param q: qubits, from low to high :param c: qubit falsey/truthy values, from low to high :raises RuntimeError: QrackSimulator raised an exception. :returns: Expectation value .. py:method:: factorized_expectation_rdm(q, c, r=True) Factorized expectation value, (tracing out the reduced density matrix without stabilizer ancillary qubits) Get the factorized expectation value, where each entry in "c" is an expectation value for corresponding "q" being false, then true, repeated for each in "q". :param q: qubits, from low to high :param c: qubit falsey/truthy values, from low to high :param r: round Rz gates down from T^(1/2) :raises RuntimeError: QrackSimulator raised an exception. :returns: Expectation value .. py:method:: factorized_expectation_fp(q, c) Factorized expectation value (floating-point) Get the factorized expectation value, where each entry in "c" is an expectation value for corresponding "q" being false, then true, repeated for each in "q". :param q: qubits, from low to high :param c: qubit falsey/truthy values, from low to high :raises RuntimeError: QrackSimulator raised an exception. :returns: Expectation value .. py:method:: factorized_expectation_fp_rdm(q, c, r=True) Factorized expectation value, (tracing out the reduced density matrix without stabilizer ancillary qubits) Get the factorized expectation value, where each entry in "c" is an expectation value for corresponding "q" being false, then true, repeated for each in "q". :param q: qubits, from low to high :param c: qubit falsey/truthy values, from low to high :param r: round Rz gates down from T^(1/2) :raises RuntimeError: QrackSimulator raised an exception. :returns: Expectation value .. py:method:: joint_ensemble_probability(b, q) Ensemble probability Find the joint probability for all specified qubits under the respective Pauli basis transformations. :param b: pauli basis :param q: specified qubits :raises RuntimeError: QrackSimulator raised an exception. :returns: Expectation value .. py:method:: phase_parity(la, q) Phase to odd parity Applies `e^(i*la)` phase factor to all combinations of bits with odd parity, based upon permutations of qubits. :param la: phase :param q: specified qubits :raises RuntimeError: QrackSimulator raised an exception. :raises RuntimeError: QrackSimulator with isTensorNetwork=True option cannot phase_parity()! (Turn off just this option, in the constructor.) .. py:method:: try_separate_1qb(qi1) Manual seperation Exposes manual control for schmidt decomposition which attempts to decompose the qubit with possible performance improvement :param qi1: qubit to be decomposed :raises RuntimeError: QrackSimulator raised an exception. :returns: State of the qubit. .. py:method:: try_separate_2qb(qi1, qi2) Manual two-qubits seperation two-qubits counterpart of `try_separate_1qb`. :param qi1: first qubit to be decomposed :param qi2: second qubit to be decomposed :raises Runtimeerror: QrackSimulator raised an exception. :returns: State of both the qubits. .. py:method:: try_separate_tolerance(qs, t) Manual multi-qubits seperation Multi-qubits counterpart of `try_separate_1qb`. :param qs: list of qubits to be decomposed :param t: allowed tolerance :raises Runtimeerror: QrackSimulator raised an exception. :returns: State of all the qubits. .. py:method:: get_unitary_fidelity() Get fidelity estimate When using "Schmidt decomposition rounding parameter" ("SDRP") approximate simulation, QrackSimulator() can make an excellent estimate of its overall fidelity at any time, tested against a nearest-neighbor variant of quantum volume circuits. Resetting the fidelity calculation to 1.0 happens automatically when calling `mall` are can be done manually with `reset_unitary_fidelity()`. :raises RuntimeError: QrackSimulator raised an exception. :returns: Fidelity estimate .. py:method:: reset_unitary_fidelity() Reset fidelity estimate When using "Schmidt decomposition rounding parameter" ("SDRP") approximate simulation, QrackSimulator() can make an excellent estimate of its overall fidelity at any time, tested against a nearest-neighbor variant of quantum volume circuits. Resetting the fidelity calculation to 1.0 happens automatically when calling `m_all` or can be done manually with `reset_unitary_fidelity()`. :raises RuntimeError: QrackSimulator raised an exception. .. py:method:: set_sdrp(sdrp) Set "Schmidt decomposition rounding parameter" When using "Schmidt decomposition rounding parameter" ("SDRP") approximate simulation, QrackSimulator() can make an excellent estimate of its overall fidelity at any time, tested against a nearest-neighbor variant of quantum volume circuits. Resetting the fidelity calculation to 1.0 happens automatically when calling `m_all` or can be done manually with `reset_unitary_fidelity()`. :raises RuntimeError: QrackSimulator raised an exception. .. py:method:: set_reactive_separate(irs) Set reactive separation option If reactive separation is available, then this method turns it off/on. Note that reactive separation is on by default. :param irs: is aggresively separable :raises RuntimeError: QrackSimulator raised an exception. .. py:method:: set_t_injection(iti) Set t-injection option If t-injection is available, then this method turns it off/on. Note that t-injection is on by default. :param iti: use "reverse t-injection gadget" :raises RuntimeError: QrackSimulator raised an exception. .. py:method:: out_to_file(filename) Output state to file (stabilizer only!) Outputs the hybrid stabilizer state to file. :param filename: Name of file .. py:method:: in_from_file(is_binary_decision_tree=False, is_paged=True, is_cpu_gpu_hybrid=True, is_opencl=True, is_host_pointer=False) Input state from file (stabilizer only!) Reads in a hybrid stabilizer state from file. :param filename: Name of file .. py:method:: file_to_qiskit_circuit(is_hardware_encoded=False) Convert an output state file to a Qiskit circuit Reads in an (optimized) circuit from a file named according to the "filename" parameter and outputs a Qiskit circuit. :param filename: Name of file :raises RuntimeErorr: Before trying to file_to_qiskit_circuit() with QrackCircuit, you must install Qiskit, numpy, and math! .. py:method:: file_to_optimized_qiskit_circuit() Convert an output state file to a Qiskit circuit Reads in a circuit from a file named according to the "filename" parameter and outputs a 'hyper-optimized' Qiskit circuit that favors maximum reduction in gate count and depth at the potential expense of additional non-Clifford gates. (Ancilla qubits are left included in the output, though they probably have no gates.) :param filename: Name of file :raises RuntimeErorr: Before trying to file_to_qiskit_circuit() with QrackCircuit, you must install Qiskit, numpy, and math! .. py:method:: _apply_pyzx_op(gate) .. py:method:: run_pyzx_gates(gates) PYZX Gates Converts PYZX gates to `QRackSimulator` and immediately executes them. :param gates: list of PYZX gates :raises RuntimeError: QrackSimulator raised an exception. .. py:method:: _apply_op(operation) .. py:method:: _add_sample_measure(sample_qubits, sample_clbits, num_samples) Generate data samples from current statevector. Taken almost straight from the terra source code. :param measure_params: List of (qubit, clbit) values for measure instructions to sample. :type measure_params: list :param num_samples: The number of data samples to generate. :type num_samples: int :returns: A list of data values in hex format. :rtype: list .. py:method:: run_qiskit_circuit(experiment, shots=1) .. py:class:: QrackNeuron(simulator, controls, target, activation_fn=NeuronActivationFn.Sigmoid, alpha=1.0, tolerance=sys.float_info.epsilon, _init=True) Class that exposes the QNeuron class of Qrack This model of a "quantum neuron" is based on the concept of a "uniformly controlled" rotation of a single output qubit around the Pauli Y axis, and has been developed by others. In our case, the primary relevant gate could also be called a single-qubit-target multiplexer. (See https://arxiv.org/abs/quant-ph/0407010 for an introduction to "uniformly controlled gates.) QrackNeuron is meant to be interchangeable with a single classical neuron, as in conventional neural net software. It differs from classical neurons in conventional neural nets, in that the "synaptic cleft" is modelled as a single qubit. Hence, this neuron can train and predict in superposition. .. attribute:: nid Qrack ID of this neuron :type: int .. attribute:: simulator Simulator instance for all synaptic clefts of the neuron :type: QrackSimulator .. attribute:: controls Indices of all "control" qubits, for neuron input :type: list(int) .. attribute:: target Index of "target" qubit, for neuron output :type: int .. attribute:: tolerance Rounding tolerance :type: double .. py:method:: _get_error() .. py:method:: _throw_if_error() .. py:method:: __del__() .. py:method:: clone() Clones this neuron. Create a new, independent neuron instance with identical angles, inputs, output, and tolerance, for the same QrackSimulator. :raises RuntimeError: QrackNeuron C++ library raised an exception. .. py:method:: _ulonglong_byref(a) .. py:method:: _real1_byref(a) .. py:method:: set_angles(a) Directly sets the neuron parameters. Set all synaptic parameters of the neuron directly, by a list enumerated over the integer permutations of input qubits. :param a: List of input permutation angles :type a: list(double) :raises ValueError: Angles 'a' in QrackNeuron.set_angles() must contain at least (2 ** len(self.controls)) elements. :raises RuntimeError: QrackSimulator raised an exception. .. py:method:: get_angles() Directly gets the neuron parameters. Get all synaptic parameters of the neuron directly, as a list enumerated over the integer permutations of input qubits. :raises RuntimeError: QrackNeuron C++ library raised an exception. .. py:method:: set_alpha(a) Set the neuron 'alpha' parameter. To enable nonlinear activation, `QrackNeuron` has an 'alpha' parameter that is applied as a power to its angles, before learning and prediction. This makes the activation function sharper (or less sharp). :raises RuntimeError: QrackNeuron C++ library raised an exception. .. py:method:: set_activation_fn(f) Sets the activation function of this QrackNeuron Nonlinear activation functions can be important to neural net applications, like DNN. The available activation functions are enumerated in `NeuronActivationFn`. :raises RuntimeError: QrackNeuron C++ library raised an exception. .. py:method:: predict(e=True, r=True) Predict based on training "Predict" the anticipated output, based on input and training. By default, "predict()" will initialize the output qubit as by resetting to |0> and then acting a Hadamard gate. From that state, the method amends the output qubit upon the basis of the state of its input qubits, applying a rotation around Pauli Y axis according to the angle learned for the input. :param e: If False, predict the opposite :type e: bool :param r: If True, start by resetting the output to 50/50 :type r: bool :raises RuntimeError: QrackNeuron C++ library raised an exception. .. py:method:: unpredict(e=True) Uncompute a prediction Uncompute a 'prediction' of the anticipated output, based on input and training. :param e: If False, unpredict the opposite :type e: bool :raises RuntimeError: QrackNeuron C++ library raised an exception. .. py:method:: learn_cycle(e=True) Run a learning cycle A learning cycle consists of predicting a result, saving the classical outcome, and uncomputing the prediction. :param e: If False, predict the opposite :type e: bool :raises RuntimeError: QrackNeuron C++ library raised an exception. .. py:method:: learn(eta, e=True, r=True) Learn from current qubit state "Learn" to associate current inputs with output. Based on input qubit states and volatility 'eta,' the input state synaptic parameter is updated to prefer the "e" ("expected") output. :param eta: Training volatility, 0 to 1 :type eta: double :param e: If False, predict the opposite :type e: bool :param r: If True, start by resetting the output to 50/50 :type r: bool :raises RuntimeError: QrackNeuron C++ library raised an exception. .. py:method:: learn_permutation(eta, e=True, r=True) Learn from current classical state Learn to associate current inputs with output, under the assumption that the inputs and outputs are "classical." Based on input qubit states and volatility 'eta,' the input state angle is updated to prefer the "e" ("expected") output. :param eta: Training volatility, 0 to 1 :type eta: double :param e: If False, predict the opposite :type e: bool :param r: If True, start by resetting the output to 50/50 :type r: bool :raises RuntimeError: QrackNeuron C++ library raised an exception. .. py:class:: QrackCircuit(is_collapse=True, clone_cid=-1, is_inverse=False, past_light_cone=[]) Class that exposes the QCircuit class of Qrack QrackCircuit allows the user to specify a unitary circuit, before running it. Upon running the state, the result is a QrackSimulator state. Currently, measurement is not supported, but measurement can be run on the resultant QrackSimulator. .. attribute:: cid Qrack ID of this circuit :type: int .. py:method:: __del__() .. py:method:: _ulonglong_byref(a) .. py:method:: _double_byref(a) .. py:method:: _complex_byref(a) .. py:method:: clone() Make a new circuit that is an exact clone of this circuit :raises RuntimeError: QrackCircuit C++ library raised an exception. .. py:method:: inverse() Make a new circuit that is the exact inverse of this circuit :raises RuntimeError: QrackCircuit C++ library raised an exception. .. py:method:: past_light_cone(q) Make a new circuit with just this circuits' past light cone for certain qubits. :param q: list of qubit indices to include at beginning of past light cone :raises RuntimeError: QrackCircuit C++ library raised an exception. .. py:method:: get_qubit_count() Get count of qubits in circuit :raises RuntimeError: QrackCircuit C++ library raised an exception. .. py:method:: swap(q1, q2) Add a 'Swap' gate to the circuit :param q1: qubit index #1 :param q2: qubit index #2 :raises RuntimeError: QrackCircuit C++ library raised an exception. .. py:method:: mtrx(m, q) Operation from matrix. Applies arbitrary operation defined by the given matrix. :param m: row-major complex list representing the operator. :param q: the qubit number on which the gate is applied to. :raises ValueError: 2x2 matrix 'm' in QrackCircuit.mtrx() must contain at least 4 elements. :raises RuntimeError: QrackSimulator raised an exception. .. py:method:: ucmtrx(c, m, q, p) Multi-controlled single-target-qubit gate Specify a controlled gate by its control qubits, its single-qubit matrix "payload," the target qubit, and the permutation of qubits that activates the gate. :param c: list of controlled qubits :param m: row-major complex list representing the operator. :param q: target qubit :param p: permutation of target qubits :raises ValueError: 2x2 matrix 'm' in QrackCircuit.ucmtrx() must contain at least 4 elements. :raises RuntimeError: QrackSimulator raised an exception. .. py:method:: run(qsim) Run circuit on simulator Run the encoded circuit on a specific simulator. The result will remain in this simulator. :param qsim: QrackSimulator on which to run circuit :raises RuntimeError: QrackCircuit raised an exception. .. py:method:: out_to_file(filename) Output optimized circuit to file Outputs the (optimized) circuit to a file named according to the "filename" parameter. :param filename: Name of file .. py:method:: in_from_file() Read in optimized circuit from file Reads in an (optimized) circuit from a file named according to the "filename" parameter. :param filename: Name of file .. py:method:: file_to_qiskit_circuit() Convert an output file to a Qiskit circuit Reads in an (optimized) circuit from a file named according to the "filename" parameter and outputs a Qiskit circuit. :param filename: Name of file :raises RuntimeErorr: Before trying to file_to_qiskit_circuit() with QrackCircuit, you must install Qiskit, numpy, and math! .. py:method:: in_from_qiskit_circuit() Read a Qiskit circuit into a QrackCircuit Reads in a circuit from a Qiskit `QuantumCircuit` :param circ: Qiskit circuit :raises RuntimeErorr: Before trying to file_to_qiskit_circuit() with QrackCircuit, you must install Qiskit, numpy, and math! .. py:method:: file_to_quimb_circuit(circuit_type=QuimbCircuitType.Circuit, psi0=None, gate_opts=None, tags=None, psi0_dtype='complex128', psi0_tag='PSI0', bra_site_ind_id='b{}') Convert an output file to a Quimb circuit Reads in an (optimized) circuit from a file named according to the "filename" parameter and outputs a Quimb circuit. :param filename: Name of file :param circuit_type: "QuimbCircuitType" enum value specifying type of Quimb circuit :param psi0: The initial state, assumed to be |00000....0> if not given. The state is always copied and the tag PSI0 added :param gate_opts: Default keyword arguments to supply to each gate_TN_1D() call during the circuit :param tags: Tag(s) to add to the initial wavefunction tensors (whether these are propagated to the rest of the circuit’s tensors :param psi0_dtype: Ensure the initial state has this dtype. :param psi0_tag: Ensure the initial state has this tag. :param bra_site_ind_id: Use this to label ‘bra’ site indices when creating certain (mostly internal) intermediate tensor networks. :raises RuntimeErorr: Before trying to file_to_quimb_circuit() with QrackCircuit, you must install quimb, Qiskit, numpy, and math! .. py:method:: file_to_tensorcircuit(inputs=None, circuit_params=None, binding_params=None) Convert an output file to a TensorCircuit circuit Reads in an (optimized) circuit from a file named according to the "filename" parameter and outputs a TensorCircuit circuit. :param filename: Name of file :param inputs: pass-through to tensorcircuit.Circuit.from_qiskit :param circuit_params: pass-through to tensorcircuit.Circuit.from_qiskit :param binding_params: pass-through to tensorcircuit.Circuit.from_qiskit :raises RuntimeErorr: Before trying to file_to_quimb_circuit() with QrackCircuit, you must install TensorCircuit, Qiskit, numpy, and math! .. py:method:: in_from_tensorcircuit(enable_instruction=False, enable_inputs=False) Convert a TensorCircuit circuit to a QrackCircuit Accepts a TensorCircuit circuit and outputs an equivalent QrackCircuit :param tcirc: TensorCircuit circuit :param enable_instruction: whether to also export measurement and reset instructions :param enable_inputs: whether to also export the inputs :raises RuntimeErorr: Before trying to in_from_tensorcircuit() with QrackCircuit, you must install TensorCircuit, Qiskit, numpy, and math! .. py:class:: Pauli Bases: :py:obj:`enum.IntEnum` Enum where members are also (and must be) ints .. py:attribute:: PauliI :value: 0 .. py:attribute:: PauliX :value: 1 .. py:attribute:: PauliY :value: 3 .. py:attribute:: PauliZ :value: 2 .. py:class:: NeuronActivationFn Bases: :py:obj:`enum.IntEnum` Enum where members are also (and must be) ints .. py:attribute:: Sigmoid :value: 0 .. py:attribute:: ReLU :value: 1 .. py:attribute:: GeLU :value: 2 .. py:attribute:: Generalized_Logistic :value: 3 .. py:attribute:: LeakyReLU :value: 4 .. py:class:: QuimbCircuitType Bases: :py:obj:`enum.IntEnum` Enum where members are also (and must be) ints .. py:attribute:: Circuit :value: 0 .. py:attribute:: CircuitDense :value: 1 .. py:attribute:: CircuitMPS :value: 3