<SYSTEM_TASK:>
Solve the following problem using Python, implementing the functions described below, one line at a time
<END_TASK>
<USER_TASK:>
Description:
 def compute_trajectories(self):
 """Compute the N trajectories that constitute the current genealogy. Compute and add attribute ``B`` to ``self`` where ``B`` is an array such that ``B[t,n]`` is the index of ancestor at time t of particle X_T^n, where T is the current length of history. """

        self.B = np.empty((self.T, self.N), 'int')
        self.B[-1, :] = self.A[-1]
        for t in reversed(range(self.T - 1)):
            self.B[t, :] = self.A[t + 1][self.B[t + 1]]