Skip to content

Commit

Permalink
Update basic_interface.md
Browse files Browse the repository at this point in the history
  • Loading branch information
ranocha committed Mar 6, 2024
1 parent 004157c commit 60160b6
Showing 1 changed file with 3 additions and 3 deletions.
6 changes: 3 additions & 3 deletions docs/src/tutorials/basic_interface.md
Original file line number Diff line number Diff line change
Expand Up @@ -33,7 +33,7 @@ As you can see above, calling `D * u` allocates a new vector for the
result. If you want to apply an SBP operator multiple times and need
good performance, you should consider using pre-allocating the output
and using in-place update instead. This strategy is also described in
the[performance tips in the Julia manual](https://docs.julialang.org/en/v1/manual/performance-tips/#Pre-allocating-outputs).
the [performance tips in the Julia manual](https://docs.julialang.org/en/v1/manual/performance-tips/#Pre-allocating-outputs).
Julia provides the function `mul!` for this purpose.

```@repl
Expand Down Expand Up @@ -190,15 +190,15 @@ let du_dx = zero(u)
# The derivative of x*y^2 with respect to x is just y^2.
# Thus, the result is constant in each column and varies
# in the rows.
display(du_dx)
du_dx
end
let du_dy = zero(u)
for i in axes(u, 1)
mul!(view(du_dy, i, :), D, view(u, i, :))
end
# The derivative of x*y^2 with respect to y is 2*x*y.
display(du_dy)
du_dy
end
2 .* x .* y'
Expand Down

0 comments on commit 60160b6

Please sign in to comment.