Skip to content

Commit

Permalink
data_from_trajectory now also accepts views
Browse files Browse the repository at this point in the history
  • Loading branch information
axsk committed Feb 16, 2024
1 parent 4e0404a commit 9fbe425
Showing 1 changed file with 2 additions and 2 deletions.
4 changes: 2 additions & 2 deletions src/data.jl
Original file line number Diff line number Diff line change
Expand Up @@ -101,9 +101,9 @@ end
Generate the lag-1 data from the trajectory `xs`.
If `reverse` is true, also take the time-reversed lag-1 data.
"""
function data_from_trajectory(xs::Matrix; reverse=false)
function data_from_trajectory(xs::AbstractMatrix; reverse=false)
if reverse
ys = stack([xs[:, 3:end], xs[:, 1:end-2]])
@views ys = stack([xs[:, 3:end], xs[:, 1:end-2]])
xs = xs[:, 2:end-1]
else
ys = xs[:, 2:end]
Expand Down

0 comments on commit 9fbe425

Please sign in to comment.