You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
I think we should change the implementation of Generic.MatRingElem from
struct MatRingElem{T <:NCRingElement} <:AbstractAlgebra.MatRingElem{T}
base_ring::NCRing
entries::Matrix{T}functionMatRingElem{T}(R::NCRing, A::Matrix{T}) where T <:NCRingElement@assertelem_type(R) === T
returnnew{T}(R, A)
endend
to something more like this (untested, but I hope at least the principle idea gets across)
struct MatRingElem{T <:NCRingElement} <:AbstractAlgebra.MatRingElem{T}
data::MatElem{T}functionMatRingElem{T}(A::MatElem{T}) where T <:NCRingElement@assert A isadense_matrix_type(T)
returnnew{T}(A)
endendfunctiondata(M::MatRingElem{T}) where T
return M.data::dense_matrix_type(T)
end
This way those MatRingElem are less useless / more efficient. After a quick glance a bunch of code should actually become simpler. And some code that currently is implement for Generic.MatRingElem and Generic.Mat simultaneously needs to be untangled, but that's fine, e.g.
number_of_rows(a::Union{Mat, MatRingElem}) =size(a.entries, 1)
number_of_columns(a::Union{Mat,MatRingElem}) =size(a.entries, 2)
Base.@propagate_inboundsgetindex(a::Union{Mat, MatRingElem}, r::Int, c::Int) = a.entries[r, c]
Base.@propagate_inboundsfunctionsetindex!(a::Union{Mat, MatRingElem}, d::NCRingElement,
r::Int, c::Int)
a.entries[r, c] =base_ring(a)(d)
end
Base.isassigned(a::Union{Mat,MatRingElem}, i, j) =isassigned(a.entries, i, j)
The text was updated successfully, but these errors were encountered:
I think we should change the implementation of
Generic.MatRingElem
fromto something more like this (untested, but I hope at least the principle idea gets across)
This way those
MatRingElem
are less useless / more efficient. After a quick glance a bunch of code should actually become simpler. And some code that currently is implement forGeneric.MatRingElem
andGeneric.Mat
simultaneously needs to be untangled, but that's fine, e.g.The text was updated successfully, but these errors were encountered: