I have a struct made as:
# Main Struct for Gradient Values
@with_kw struct ∇ᵢWᵢⱼStruct{T,ST}
NL::Base.RefValue{Int}
# Input for calculation
xᵢⱼ ::AbstractVector{SVector{ST,T}} = zeros(SVector{ST,T},NL[])
xᵢⱼ² ::AbstractVector{T} = similar(xᵢⱼ,T,NL[])
dᵢⱼ ::AbstractVector{T} = similar(xᵢⱼ,T,NL[])
qᵢⱼ ::AbstractVector{T} = similar(xᵢⱼ,T,NL[])
∇ᵢWᵢⱼ ::AbstractVector{SVector{ST,T}} = similar(xᵢⱼ,NL[])
end
Where NL is the variable determining the length of each array. When I update NL, I wish for all other arrays to update in size as well.
To me this would be neat if it was done through updating “NL” automatically
The reason I use BaseValue.Ref etc. is explained more here:
So I was hoping that by updating NL I could trigger a “reaction” updating everything which is an AbstractArray in the struct to the new size
Kind regards