qiskit/providers/basicaer/unitary_simulator.py
def _add_unitary_single(self, gate, qubit):
        """Apply an arbitrary 1-qubit unitary matrix.

        Args:
            gate (matrix_like): a single qubit gate matrix
            qubit (int): the qubit to apply gate to
        """
        # Convert to complex rank-2 tensor
        gate_tensor = np.array(gate, dtype=complex)
        # Compute einsum index string for 1-qubit matrix multiplication
        indexes = einsum_matmul_index([qubit], self._number_of_qubits)
        # Apply matrix multiplication
        self._unitary = np.einsum(indexes, gate_tensor, self._unitary,
                                  dtype=complex, casting='no')
def _add_unitary_single(self, gate, qubit):
        """Apply an arbitrary 1-qubit unitary matrix.

        Args:
            gate (matrix_like): a single qubit gate matrix
            qubit (int): the qubit to apply gate to
        """
        # Convert to complex rank-2 tensor
        gate_tensor = np.array(gate, dtype=complex)
        # Compute einsum index string for 1-qubit matrix multiplication
        indexes = einsum_matmul_index([qubit], self._number_of_qubits)
        # Apply matrix multiplication
        self._unitary = np.einsum(indexes, gate_tensor, self._unitary,
                                  dtype=complex, casting='no')
def _add_unitary_single ( self , gate , qubit ) : # Convert to complex rank-2 tensor gate_tensor = np . array ( gate , dtype = complex ) # Compute einsum index string for 1-qubit matrix multiplication indexes = einsum_matmul_index ( [ qubit ] , self . _number_of_qubits ) # Apply matrix multiplication self . _unitary = np . einsum ( indexes , gate_tensor , self . _unitary , dtype = complex , casting = 'no' )
Apply an arbitrary 1-qubit unitary matrix.

        Args:
            gate (matrix_like): a single qubit gate matrix
            qubit (int): the qubit to apply gate to
Apply an arbitrary 1 - qubit unitary matrix .