Open nrontsis opened 1 year ago
@jonniedie sorry for the broken tests, these are passing now in my machine.
Why not just overload getindex
for the adjoint?
Why not just overload getindex for the adjoint?
ComponentArrays
either way allows for ComponentMatrix{Float64, Adjoint{Float64, Matrix{Float64}}
that can be created like: ComponentMatrix(ones(2, 2)', Axis(:a, :b), FlatAxis())
. There were thus two kind of adjoints: ComponentMatrix{Float64, Adjoint{Float64, Matrix{Float64}}
and adjoint(::ComponentMatrix{Float64, Matrix{Float64}
, resulting in confusion about which one to be used.getindex
issue, broadcasting seems to give incorrect results in the following example, as detailed in this comment:
julia> a = ComponentVector(ones(2), Axis(:a, :b))
julia> a .* a'
2×2 ComponentMatrix{Float64} with axes Axis(a = 1, b = 2) × Axis(a = 1, b = 2)
It's unclear what other edge cases we might be missing.
Thanks a lot for the review @jonniedie!
I am happy to add any tests you feel sensible. However I think some of the old tests were actually incorrect, as I argue in this thread. Can you reply to this thread with what you think on my argument?
This PR aims to avoid issues like:
by wrapping adjoint operations in the underlying data of the ComponentArray structure.
By not having to care about adjoints of ComponentArray, we arguably also reduce overall cognitive load.