Parametric type which contains the abstract type it subtypes

struct Map{T<:Real, M<:AbstractMatrix{T}} <: AbstractMatrix{T}
    data::M
    lb
    ub
end

You might want to give lb and ub a type as well, to avoid a type instability. The default for non-annotated fields in structs is Any after all.

Additionally, this will be helpful:

2 Likes