Skip to content

backing doesn't allow for undef fields #392

Open
@mcabbott

Description

@mcabbott
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

Metadata

Metadata

Assignees

No one assigned

    Labels

    Structural TangentRelated to the `Tangent` type for structured (composite) valuesgood first issueGood for newcomers

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions