(self, qubits, **options)
return change_to_basis - qubits
qubits: a set of qubits (Qubit)
        Returns: quantum object (quantum expression - QExpr)
qubits: a set of qubits (Qubit)
        Returns: quantum object (quantum expression - QExpr)
qubits : a set of qubits ( Qubit ) Returns : quantum object ( quantum expression - QExpr )
def _apply_operator_Qubit(self, qubits, **options):
        """
        qubits: a set of qubits (Qubit)
        Returns: quantum object (quantum expression - QExpr)
        """
        if qubits.nqubits != self.nqubits:
            raise QuantumError(
                'WGate operates on %r qubits, got: %r'
                % (self.nqubits, qubits.nqubits)
            )

        # See 'Quantum Computer Science' by David Mermin p.92 -> W|a> result
        # Return (2/(sqrt(2^n)))|phi> - |a> where |a> is the current basis
        # state and phi is the superposition of basis states (see function
        # create_computational_basis above)
        basis_states = superposition_basis(self.nqubits)
        change_to_basis = (2/sqrt(2**self.nqubits))*basis_states
        return change_to_basis - qubits
def _apply_operator_Qubit ( self , qubits , * * options ) : if qubits . nqubits != self . nqubits : raise QuantumError ( 'WGate operates on %r qubits, got: %r' % ( self . nqubits , qubits . nqubits ) ) # See 'Quantum Computer Science' by David Mermin p.92 -> W|a> result # Return (2/(sqrt(2^n)))|phi> - |a> where |a> is the current basis # state and phi is the superposition of basis states (see function # create_computational_basis above) basis_states = superposition_basis ( self . nqubits ) change_to_basis = ( 2 / sqrt ( 2 ** self . nqubits ) ) * basis_states return change_to_basis - qubits