-
Notifications
You must be signed in to change notification settings - Fork 10
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
The example in the README is confusing #135
Comments
I noticed, that I forgot the @benchmark LinearAlgebra.mul!(y, V, x) setup = begin
rng = StableRNG(123)
y = randn(rng, 10_000)
x = randn(rng, 10_000)
L = randn(rng, 10_000, 10_000)
A = L * L' + I(10_000)
V = view(Symmetric(A), :, :)'
end
@benchmark ArrayLayouts.muladd!(1.0, V, x, 0.0, y) setup = begin
rng = StableRNG(123)
y = randn(rng, 10_000)
x = randn(rng, 10_000)
L = randn(rng, 10_000, 10_000)
A = L * L' + I(10_000)
V = view(Symmetric(A), :, :)'
end with the following output
The default julia is indeed slower in this case. I think the example in the documentation can be clarified better and the wrong argument |
Thanks for this! Would you be willing to make a PR updating the README? |
The README shows the following example:
Specifically this line:
The argument
A
is used instead ofV
, so the comment is irrelevant, Julia cannot figure out that the matrix is symmetric, becauseA
matrix is not really symmetric. Also both function should not allocate anything, the reported allocations are possible due to use of global variables in the REPL.Here is an updated benchmark (with
BenchmarkTools
), which does not really show any difference ifV
argument is used instead and without global variables. At least on my computer.with the output
A small note to that: there is also no documentation for the
muladd!
fromArrayLayouts
even though it is used as a first example. It's hard to guess what argument stores the result of the operation. I assume the usage of!
means that the function mutates its arguments.The text was updated successfully, but these errors were encountered: