-
Notifications
You must be signed in to change notification settings - Fork 42
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Stashing user variable(s) in a LinearMap struct? #53
Comments
That sounds good to me, in principle, but the devil is in the details, as always. Since there is no inheritance of properties/fields, one would have to introduce that for all concrete types of the abstract type Have you tried to build your own struct in your own package(s)? Something like struct NamedLinearMap{T, A<:LinearMap, At<:Union{Nothing,NamedTuple}}
lmap::A
attribute::At
end and then, for a |
Thanks for the great feedback. Once again the type issues will be the challenge for me... |
In case anyone else wants to store user variables in a |
#52 involves stashing some quantities in the
BlockMap
struct, which reminds me of a feature request that I have been thinking about for a while.In many applications, a
LinearMap
corresponds to some physical system that has attributes that went into the definition of the map. It would be convenient to allow the user to provide a single variable (e.g., aNamedTuple
or a struct) that would be stashed in the LinearMap struct so that the user can access it later. Something like thisL = LinearMap(f, fa, M, N, user=(density=0.5, temperature=100))
then later the user could retrieve those values via something like
L.density
or
L.user.density
It would be pretty easy to do with
Base.getproperty
I think.If there is willingness to consider such an enhancement I might give it a try.
The text was updated successfully, but these errors were encountered: