def __init__(self, state_vector: np.ndarray, buffer: np.ndarray | None = None):
        """Initializes the object with the inputs.

        This initializer creates the buffer if necessary.

        Args:
            state_vector: The state vector, must be correctly formatted. The data is not checked
                for validity here due to performance concerns.
            buffer: Optional, must be same shape as the state vector. If not provided, a buffer
                will be created automatically.
        """
        self._state_vector = state_vector
        if buffer is None:
            buffer = np.empty_like(state_vector)
        self._buffer = buffer
        self._qid_shape = state_vector.shape
Initializes the object with the inputs.

        This initializer creates the buffer if necessary.

        Args:
            state_vector: The state vector, must be correctly formatted. The data is not checked
                for validity here due to performance concerns.
            buffer: Optional, must be same shape as the state vector. If not provided, a buffer
                will be created automatically.
        
cirq-core/cirq/sim/state_vector_simulation_state.py