SciML / SciML/RecursiveArrayTools.jl
`mul!(::Matrix, ::ArrayPartition, ::Adjoint(ArrayPartition))`
Open
Nobody has claimed this yet.
- Dominant language
- Julia
- Stars
- 233
- Forks
- 76
- Avg merge
- 2h 17m
- Merged PRs (30d)
- 9
Description
https://github.com/JuliaNLSolvers/Optim.jl/pull/972
MWE
using RecursiveArrayTools, LinearAlgebra
u = ArrayPartition(rand(2), rand(1))
v = copy(u)
H = u * v' # works
mul!(H, u, v') # error
julia> mul!(H,u,v')
ERROR: BoundsError: attempt to access Tuple{Vector{Float64}, Vector{Float64}} at index [3]
Stacktrace:
[1] getindex
@ ~/.julia/dev/RecursiveArrayTools.jl/src/array_partition.jl:151 [inlined]
[2] copy_transpose!(B::Matrix{Float64}, ir_dest::UnitRange{Int64}, jr_dest::UnitRange{Int64}, A::ArrayPartition{Float64, Tuple{Vector{Float64}, Vector{Float64}}}, ir_src::UnitRange{Int64}, jr_src::UnitRange{Int64})
@ LinearAlgebra /Applications/Julia-1.7.app/Contents/Resources/julia/share/julia/stdlib/v1.7/LinearAlgebra/src/transpose.jl:197
[3] copy_transpose!
@ /Applications/Julia-1.7.app/Contents/Resources/julia/share/julia/stdlib/v1.7/LinearAlgebra/src/matmul.jl:693 [inlined]
[4] _generic_matmatmul!(C::Matrix{Float64}, tA::Char, tB::Char, A::ArrayPartition{Float64, Tuple{Vector{Float64}, Vector{Float64}}}, B::ArrayPartition{Float64, Tuple{Vector{Float64}, Vector{Float64}}}, _add::LinearAlgebra.MulAddMul{true,
true, Bool, Bool})
@ LinearAlgebra /Applications/Julia-1.7.app/Contents/Resources/julia/share/julia/stdlib/v1.7/LinearAlgebra/src/matmul.jl:834
[5] generic_matmatmul!
@ /Applications/Julia-1.7.app/Contents/Resources/julia/share/julia/stdlib/v1.7/LinearAlgebra/src/matmul.jl:801 [inlined]
[6] mul!
@ /Applications/Julia-1.7.app/Contents/Resources/julia/share/julia/stdlib/v1.7/LinearAlgebra/src/matmul.jl:478 [inlined]
[7] mul!(C::Matrix{Float64}, A::ArrayPartition{Float64, Tuple{Vector{Float64}, Vector{Float64}}}, B::Adjoint{Float64, ArrayPartition{Float64, Tuple{Vector{Float64}, Vector{Float64}}}})
@ LinearAlgebra /Applications/Julia-1.7.app/Contents/Resources/julia/share/julia/stdlib/v1.7/LinearAlgebra/src/matmul.jl:275
[8] top-level scope
@ REPL[134]:1
in LinearAlgebra/transpose.jl, v is being treated as an AbstractVecOrMat and is being accessed as follows v[3,1]
julia> checkbounds(Bool,v,3,1)
true
julia> v[3,1]
ERROR: BoundsError: attempt to access Tuple{Vector{Float64}, Vector{Float64}} at index [3]
Stacktrace:
[1] getindex(A::ArrayPartition{Float64, Tuple{Vector{Float64}, Vector{Float64}}}, i::Int64, j::Int64)
@ RecursiveArrayTools ~/.julia/dev/RecursiveArrayTools.jl/src/array_partition.jl:151
Contributor guide
First steps
- Read the whole issue, then the project's contributing guide.
- Comment on the issue to say you are picking it up — it saves two people doing the same work.
- Fork the repository and make your change on a branch.
- Open a pull request that references the issue number.
Research direction
Start by running the MWE and comparing the working u * v' call with mul!(H, u, v'). Inspect src/array_partition.jl around line 151 and the LinearAlgebra transpose stack trace, especially the two-dimensional indexing and bounds check. Done means the in-place multiplication completes without the reported BoundsError for the shown ArrayPartition values.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- julia
- Domain
- data
- Issue type
- Bug
- Difficulty
- 3/5
- Estimated time
- 1-2 days
- Activity status
- Stale
- Clarity
- Mostly clear
- Newbie friendliness
- 42/100