Hacktoberfest 2026: los issues que los mantenedores marcaron para octubre, abiertos y aptos para principiantes. Explorar issues de Hacktoberfest

The example in the README is confusing

Abierto
#135 2 comentarios 0 reacciones 0 asignados Ver en GitHub

Los mantenedores suelen responder en 1 día

Nadie ha tomado este issue todavía.

Evaluación

Dificultad
3/5
Tiempo estimado
1-2 días
Aptitud para principiantes
38/100
Tipo de issue
Documentación
Claridad
Bastante claro
Estado de actividad
Estancado
Stack tecnológico
julia

Línea de trabajo

Revisa primero el ejemplo del README y la configuración y salida de BenchmarkTools reportadas. Corrige los comentarios engañosos sobre los argumentos y las asignaciones, asegúrate de que la comparación de matrices simétricas sea correcta y documenta los argumentos y el comportamiento de mutación de ArrayLayouts.muladd! utilizados por el ejemplo.

Escrito por el modelo de indexación a partir del texto del issue.

Descripción

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
Lenguaje dominante
Julia
Estrellas
57
Forks
10
Merge medio
1 d 9 h
PR fusionados (30 d)
11

Preparar el entorno

Este proyecto no incluye contenedor de desarrollo, Dockerfile ni guía de contribución, así que la configuración corre por tu cuenta: empieza por su README y consulta nuestra guía para la primera contribución para los pasos generales.

Primeros pasos

  1. Lee el issue completo y luego la guía de contribución del proyecto.
  2. Comenta en el issue que vas a ocuparte — evita que dos personas hagan lo mismo.
  3. Haz un fork del repositorio y trabaja en una rama.
  4. Abre un pull request que haga referencia al número del issue.

Más de JuliaLinearAlgebra/ArrayLayouts.jl

Todos los issues de JuliaLinearAlgebra/ArrayLayouts.jl

Issues similares

Más issues de Julia

Recibe los nuevos issues en tu correo

Un resumen breve de issues de GitHub para principiantes.