qiskit/providers/basicaer/qasm_simulator.py
def _initialize_statevector(self):
        """Set the initial statevector for simulation"""
        if self._initial_statevector is None:
            # Set to default state of all qubits in |0>
            self._statevector = np.zeros(2 ** self._number_of_qubits,
                                         dtype=complex)
            self._statevector[0] = 1
        else:
            self._statevector = self._initial_statevector.copy()
        # Reshape to rank-N tensor
        self._statevector = np.reshape(self._statevector,
                                       self._number_of_qubits * [2])
def _initialize_statevector(self):
        if self._initial_statevector is None:
            # Set to default state of all qubits in |0>
            self._statevector = np.zeros(2 ** self._number_of_qubits,
                                         dtype=complex)
            self._statevector[0] = 1
        else:
            self._statevector = self._initial_statevector.copy()
        # Reshape to rank-N tensor
        self._statevector = np.reshape(self._statevector,
                                       self._number_of_qubits * [2])
def _initialize_statevector ( self ) : if self . _initial_statevector is None : # Set to default state of all qubits in |0> self . _statevector = np . zeros ( 2 ** self . _number_of_qubits , dtype = complex ) self . _statevector [ 0 ] = 1 else : self . _statevector = self . _initial_statevector . copy ( ) # Reshape to rank-N tensor self . _statevector = np . reshape ( self . _statevector , self . _number_of_qubits * [ 2 ] )
Set the initial statevector for simulation
Set the initial statevector for simulation