JuliaDiff / JuliaDiff/ChainRulesCore.jl

`backing` doesn't allow for undef fields

Open
#392 1 comment 0 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

good first issue Structural Tangent
Dominant language
Julia
Stars
267
Forks
66
PR merge metrics
No merged PRs in 30d

Description

julia> x = LinearAlgebra.Tridiagonal(rand(4,4))
4×4 Tridiagonal{Float64, Vector{Float64}}:
 0.527801  0.950961   ⋅         ⋅ 
 0.729178  0.702784  0.941096   ⋅ 
  ⋅        0.853609  0.652989  0.635001
  ⋅         ⋅        0.37831   0.755058

julia> backing(x) # UndefRefError: access to undefined reference
ERROR: UndefRefError: access to undefined reference
Stacktrace:
 [1] macro expansion
   @ ~/.julia/dev/ChainRulesCore/src/differentials/composite.jl:0 [inlined]
 [2] backing(x::Tridiagonal{Float64, Vector{Float64}})
   @ ChainRulesCore ~/.julia/dev/ChainRulesCore/src/differentials/composite.jl:137
 [3] top-level scope
   @ REPL[246]:1

julia> dump(x)
Tridiagonal{Float64, Vector{Float64}}
  dl: Array{Float64}((3,)) [0.7291777614996582, 0.8536091270458613, 0.3783098625198864]
  d: Array{Float64}((4,)) [0.5278007508415407, 0.7027844764212322, 0.652989419144927, 0.7550584891088709]
  du: Array{Float64}((3,)) [0.9509613254638279, 0.9410963947920769, 0.6350012077461873]
  du2: #undef

julia> fieldnames(typeof(x))
(:dl, :d, :du, :du2)

julia> isdefined(x, :du)
true

julia> isdefined(x, :du2)
false

Contributor guide

No contributing guide indexed for this repository

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

Research direction

Reproduce the Tridiagonal example and inspect backing in src/differentials/composite.jl around line 137, as shown in the stack trace. Determine how the undef du2 field is accessed; done means backing(x) handles this object without raising UndefRefError, with coverage added if the repository provides a relevant test location.

Written by the indexing model from the issue text.

Assessment

Tech stack
julia
Domain
devtools
Issue type
Bug
Difficulty
3/5
Estimated time
1-2 days
Activity status
Stale
Clarity
Mostly clear
Newbie friendliness
35/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.