Skip to content

Commit

Permalink
add comment
Browse files Browse the repository at this point in the history
  • Loading branch information
Remi-Gau committed Apr 3, 2024
1 parent 2eeddc6 commit 2ecd9ff
Showing 1 changed file with 5 additions and 0 deletions.
5 changes: 5 additions & 0 deletions nilearn/glm/first_level/first_level.py
Original file line number Diff line number Diff line change
Expand Up @@ -113,7 +113,12 @@ def _yule_walker(x, order):
r[:, k] += (y[:, np.newaxis, 0:-k] @ y[:, k:, np.newaxis])[:, 0, 0]
r /= denom * x.shape[-1]
rt = np.array([toeplitz(rr[:-1]) for rr in r], np.float64)

# extra dimension added to r for compatibility with numpy <2 and >2
# see https://numpy.org/devdocs/release/2.0.0-notes.html
# section removed-ambiguity-when-broadcasting-in-np-solve
rho = np.linalg.solve(rt, r[:, 1:, None])[..., 0]

rho.shape = x.shape[:-1] + (order,)
return rho

Expand Down

0 comments on commit 2ecd9ff

Please sign in to comment.