def calculate()

in src/braket/default_simulator/result_types.py [0:0]


    def calculate(self, simulation: Simulation) -> np.ndarray:
        """Return the given density matrix of the simulation.

        Args:
            simulation (Simulation): The simulation whose (full or reduced)
                density matrix will be returned.

        Returns:
            np.ndarray: The density matrix (before observables) of the simulation
        """
        if self._targets is None or len(self._targets) == simulation.qubit_count:
            return simulation.density_matrix
        else:
            if not all(ta in list(range(simulation.qubit_count)) for ta in self._targets):
                raise IndexError(
                    "Input target qubits must be within the range of the qubits in the circuit."
                )
            return partial_trace(
                simulation.density_matrix.reshape(np.array([2] * 2 * simulation.qubit_count)),
                self._targets,
            )