The example in the README is confusing
I maintainer di solito rispondono entro 1 giorno
Nessuno ha ancora preso questa issue.
Valutazione
- Difficoltà
- 3/5
- Tempo stimato
- 1-2 giorni
- Idoneità per principianti
- 38/100
- Tipo di issue
- Documentazione
- Chiarezza
- Abbastanza chiara
- Stato di attività
- Ferma
- Stack tecnologico
- julia
- Ambito
- documentation
Direzione di ricerca
Esamina innanzitutto l'esempio nel README e il setup e l'output di BenchmarkTools riportati. Correggi i commenti fuorvianti sugli argomenti e sulle allocazioni, assicurati che il confronto tra matrici simmetriche sia corretto e documenta gli argomenti e il comportamento di mutazione di ArrayLayouts.muladd! utilizzati dall'esempio.
Scritto dal modello di indicizzazione a partire dal testo della issue.
Descrizione
The README shows the following example:
julia> using ArrayLayouts
julia> A = randn(10_000,10_000); x = randn(10_000); y = similar(x);
julia> V = view(Symmetric(A),:,:)';
julia> @time mul!(y, A, x); # Julia does not recognize that V is symmetric
0.040255 seconds (4 allocations: 160 bytes)
julia> @time muladd!(1.0, V, x, 0.0, y); # ArrayLayouts does and is 3x faster as it calls BLAS
0.017677 seconds (4 allocations: 160 bytes)
Specifically this line:
julia> @time mul!(y, A, x); # Julia does not recognize that V is symmetric
The argument A is used instead of V, so the comment is irrelevant, Julia cannot figure out that the matrix is symmetric, because A 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 if V argument is used instead and without global variables. At least on my computer.
@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) # Make an actual symmetric matrix
V = 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) # Make an actual symmetric matrix
V = Symmetric(A)
end
with the output
BenchmarkTools.Trial: 2 samples with 1 evaluation.
Range (min … max): 9.245 ms … 9.855 ms ┊ GC (min … max): 0.00% … 0.00%
Time (median): 9.550 ms ┊ GC (median): 0.00%
Time (mean ± σ): 9.550 ms ± 431.100 μs ┊ GC (mean ± σ): 0.00% ± 0.00%
█ █
█▁▁▁▁▁▁▁▁▁▁▁▁▁▁▁▁▁▁▁▁▁▁▁▁▁▁▁▁▁▁▁▁▁▁▁▁▁▁▁▁▁▁▁▁▁▁▁▁▁▁▁▁▁▁▁▁▁█ ▁
9.24 ms Histogram: frequency by time 9.85 ms <
Memory estimate: 0 bytes, allocs estimate: 0.
BenchmarkTools.Trial: 2 samples with 1 evaluation.
Range (min … max): 9.057 ms … 9.130 ms ┊ GC (min … max): 0.00% … 0.00%
Time (median): 9.093 ms ┊ GC (median): 0.00%
Time (mean ± σ): 9.093 ms ± 51.707 μs ┊ GC (mean ± σ): 0.00% ± 0.00%
█ █
█▁▁▁▁▁▁▁▁▁▁▁▁▁▁▁▁▁▁▁▁▁▁▁▁▁▁▁▁▁▁▁▁▁▁▁▁▁▁▁▁▁▁▁▁▁▁▁▁▁▁▁▁▁▁▁▁█ ▁
9.06 ms Histogram: frequency by time 9.13 ms <
Memory estimate: 0 bytes, allocs estimate: 0.
A small note to that: there is also no documentation for the muladd! from ArrayLayouts 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.
Julia Version 1.9.0
Commit 8e630552924 (2023-05-07 11:25 UTC)
Platform Info:
OS: macOS (arm64-apple-darwin22.4.0)
CPU: 10 × Apple M2 Pro
WORD_SIZE: 64
LIBM: libopenlibm
LLVM: libLLVM-14.0.6 (ORCJIT, apple-m1)
Threads: 2 on 6 virtual cores
Environment:
JULIA_IMAGE_THREADS = 1
- Lingua principale
- Julia
- Stelle
- 57
- Fork
- 10
- Merge medio
- 1g 9h
- PR unite (30g)
- 11
Preparare l'ambiente
Questo progetto non fornisce container di sviluppo, Dockerfile né guida per i contributori, quindi l'ambiente è a tuo carico: parti dal suo README e consulta la nostra guida al primo contributo per i passaggi generali.
Come iniziare
- Leggi tutta la issue e poi la guida ai contributi del progetto.
- Commenta sulla issue per dire che te ne occupi tu — evita che due persone facciano lo stesso lavoro.
- Fai un fork del repository e lavora su un branch.
- Apri una pull request che faccia riferimento al numero della issue.
Altre issue di JuliaLinearAlgebra/ArrayLayouts.jl
-
Difficoltà 4/5 3-5 giorni Idoneità per principianti 45/100
JuliaLinearAlgebra/ArrayLayouts.jl#277 ·
I maintainer di solito rispondono entro 1 giorno
-
Difficoltà 4/5 3-5 giorni Idoneità per principianti 38/100
JuliaLinearAlgebra/ArrayLayouts.jl#253 · 5 commenti ·
I maintainer di solito rispondono entro 1 giorno
-
Difficoltà 3/5 1-2 giorni Idoneità per principianti 48/100
JuliaLinearAlgebra/ArrayLayouts.jl#243 ·
I maintainer di solito rispondono entro 1 giorno
-
Add RectDiagonalLayoutAperta
Difficoltà 5/5 Più di una settimana Idoneità per principianti 15/100
JuliaLinearAlgebra/ArrayLayouts.jl#185 ·
I maintainer di solito rispondono entro 1 giorno
-
Difficoltà 2/5 1-3 ore Idoneità per principianti 35/100
JuliaLinearAlgebra/ArrayLayouts.jl#157 · 2 commenti ·
I maintainer di solito rispondono entro 1 giorno
Tutte le issue di JuliaLinearAlgebra/ArrayLayouts.jl
Issue simili
-
mul! with a Symmetric or Hermitian factor throws for a matrix view whose columns are not contiguousAperta
Difficoltà 2/5 1-3 ore Idoneità per principianti 72/100
JuliaLang/LinearAlgebra.jl#1829 ·
I maintainer di solito rispondono entro 1 giorno
-
Difficoltà 2/5 1-3 ore Idoneità per principianti 78/100
MagneticResonanceImaging/MRIReco.jl#320 ·
I maintainer di solito rispondono entro 1 giorno
-
Difficoltà 2/5 1-3 ore Idoneità per principianti 78/100
rfordatascience/tidytuesday#1098 ·
-
Difficoltà 2/5 1-3 ore Idoneità per principianti 78/100
ClapeyronThermo/Clapeyron.jl#662 · 2 commenti ·
-
ci system:windows test
Difficoltà 1/5 Meno di un'ora Idoneità per principianti 76/100
I maintainer di solito rispondono entro 1 giorno