Skip to content

Commit

Permalink
Resolve ambiguity
Browse files Browse the repository at this point in the history
  • Loading branch information
lgoettgens committed Oct 7, 2024
1 parent 8e6312e commit 95b38b8
Showing 1 changed file with 18 additions and 0 deletions.
18 changes: 18 additions & 0 deletions src/generic/MatRing.jl
Original file line number Diff line number Diff line change
Expand Up @@ -146,6 +146,24 @@ function (a::MatRing{T})(b::S) where {S <: NCRingElement, T <: NCRingElement}
return z
end

# to resolve ambiguity for MatRing{MatRing{...}}
function (a::MatRing{T})(b::T) where {S <: NCRingElement, T <: MatRingElem{S}}
R = base_ring(a)
entries = Matrix{T}(undef, a.n, a.n)
rb = R(b)
for i = 1:a.n
for j = 1:a.n
if i != j
entries[i, j] = zero(R)
else
entries[i, j] = rb
end
end
end
z = MatRingElem{T}(R, entries)
return z
end

function (a::MatRing{T})(b::MatRingElem{T}) where {T <: NCRingElement}
parent(b) != a && error("Unable to coerce matrix")
return b
Expand Down

0 comments on commit 95b38b8

Please sign in to comment.