919919#
920920# ##############################################################################
921921
922- function * (x:: Union{Integer, Rational, AbstractFloat} , y:: MatrixElem{T} ) where T <: NCRingElement
922+ function * (x:: JuliaRingElement , y:: MatrixElem{T} ) where T <: NCRingElement
923923 z = similar (y)
924924 for i = 1 : nrows (y)
925925 for j = 1 : ncols (y)
@@ -939,7 +939,7 @@ function *(x::T, y::MatrixElem{T}) where {T <: NCRingElem}
939939 return z
940940end
941941
942- function * (x:: MatrixElem{T} , y:: Union{Integer, Rational, AbstractFloat} ) where T <: NCRingElement
942+ function * (x:: MatrixElem{T} , y:: JuliaRingElement ) where T <: NCRingElement
943943 z = similar (x)
944944 for i = 1 : nrows (x)
945945 for j = 1 : ncols (x)
@@ -959,12 +959,7 @@ function *(x::MatrixElem{T}, y::T) where {T <: NCRingElem}
959959 return z
960960end
961961
962- @doc raw """
963- +(x::Union{Integer, Rational, AbstractFloat}, y::MatrixElem)
964-
965- Return $S(x) + y$ where $S$ is the parent of $y$.
966- """
967- function + (x:: Union{Integer, Rational, AbstractFloat} , y:: MatrixElem{T} ) where T <: NCRingElement
962+ function + (x:: JuliaRingElement , y:: MatrixElem{T} ) where T <: NCRingElement
968963 z = similar (y)
969964 R = base_ring (y)
970965 for i = 1 : nrows (y)
@@ -979,15 +974,10 @@ function +(x::Union{Integer, Rational, AbstractFloat}, y::MatrixElem{T}) where T
979974 return z
980975end
981976
982- @doc raw """
983- +(x::MatrixElem{T}, y::Union{Integer, Rational, AbstractFloat}) where T <: NCRingElement
984-
985- Return $x + S(y)$ where $S$ is the parent of $x$.
986- """
987- + (x:: MatrixElem{T} , y:: Union{Integer, Rational, AbstractFloat} ) where T <: NCRingElement = y + x
977+ + (x:: MatrixElem{T} , y:: JuliaRingElement ) where T <: NCRingElement = y + x
988978
989979@doc raw """
990- +(x::T , y::MatrixElem{T}) where {T <: NCRingElem}
980+ +(x::NCRingElement , y::MatrixElem{<:NCRingElement})
991981
992982Return $S(x) + y$ where $S$ is the parent of $y$.
993983"""
@@ -1006,18 +996,13 @@ function +(x::T, y::MatrixElem{T}) where {T <: NCRingElem}
1006996end
1007997
1008998@doc raw """
1009- +(x::MatrixElem{T }, y::T) where {T <: RingElem}
999+ +(x::MatrixElem{<:NCRingElement }, y::NCRingElement)
10101000
1011- Return $x + S(y)$ where $S$ is the parent of $x $.
1001+ Return $x + S(y)$, where $S$ is the parent of $a $.
10121002"""
10131003+ (x:: MatrixElem{T} , y:: T ) where {T <: NCRingElem } = y + x
10141004
1015- @doc raw """
1016- -(x::Union{Integer, Rational, AbstractFloat}, y::MatrixElem{T}) where T <: NCRingElement
1017-
1018- Return $S(x) - y$ where $S$ is the parent of $y$.
1019- """
1020- function - (x:: Union{Integer, Rational, AbstractFloat} , y:: MatrixElem{T} ) where T <: NCRingElement
1005+ function - (x:: JuliaRingElement , y:: MatrixElem{T} ) where T <: NCRingElement
10211006 z = similar (y)
10221007 R = base_ring (y)
10231008 for i = 1 : nrows (y)
@@ -1032,12 +1017,7 @@ function -(x::Union{Integer, Rational, AbstractFloat}, y::MatrixElem{T}) where T
10321017 return z
10331018end
10341019
1035- @doc raw """
1036- -(x::MatrixElem{T}, y::Union{Integer, Rational, AbstractFloat}) where T <: NCRingElement
1037-
1038- Return $x - S(y)$, where $S$ is the parent of $x$.
1039- """
1040- function - (x:: MatrixElem{T} , y:: Union{Integer, Rational, AbstractFloat} ) where T <: NCRingElement
1020+ function - (x:: MatrixElem{T} , y:: JuliaRingElement ) where T <: NCRingElement
10411021 z = similar (x)
10421022 R = base_ring (x)
10431023 for i = 1 : nrows (x)
@@ -1053,7 +1033,7 @@ function -(x::MatrixElem{T}, y::Union{Integer, Rational, AbstractFloat}) where T
10531033end
10541034
10551035@doc raw """
1056- -(x::T , y::MatrixElem{T}) where {T <: NCRingElem}
1036+ -(x::NCRingElement , y::MatrixElem{<:NCRingElement})
10571037
10581038Return $S(x) - y$ where $S$ is the parent of $y$.
10591039"""
@@ -1073,7 +1053,7 @@ function -(x::T, y::MatrixElem{T}) where {T <: NCRingElem}
10731053end
10741054
10751055@doc raw """
1076- -(x::MatrixElem{T }, y::T) where {T <: NCRingElem}
1056+ -(x::MatrixElem{<:NCRingElem }, y::NCRingElement)
10771057
10781058Return $x - S(y)$, where $S$ is the parent of $a$.
10791059"""
@@ -1338,13 +1318,7 @@ end
13381318#
13391319# ##############################################################################
13401320
1341- @doc raw """
1342- ==(x::MatrixElem{T}, y::Union{Integer, Rational, AbstractFloat}) where T <: NCRingElement
1343-
1344- Return `true` if $x == S(y)$ arithmetically, where $S$ is the parent of $x$,
1345- otherwise return `false`.
1346- """
1347- function == (x:: MatrixElem{T} , y:: Union{Integer, Rational, AbstractFloat} ) where T <: NCRingElement
1321+ function == (x:: MatrixElem{T} , y:: JuliaRingElement ) where T <: NCRingElement
13481322 for i = 1 : min (nrows (x), ncols (x))
13491323 if x[i, i] != y
13501324 return false
@@ -1360,16 +1334,10 @@ function ==(x::MatrixElem{T}, y::Union{Integer, Rational, AbstractFloat}) where
13601334 return true
13611335end
13621336
1363- @doc raw """
1364- ==(x::Union{Integer, Rational, AbstractFloat}, y::MatrixElem{T}) where T <: NCRingElement
1365-
1366- Return `true` if $S(x) == y$ arithmetically, where $S$ is the parent of $y$,
1367- otherwise return `false`.
1368- """
1369- == (x:: Union{Integer, Rational, AbstractFloat} , y:: MatrixElem{T} ) where T <: NCRingElement = y == x
1337+ == (x:: JuliaRingElement , y:: MatrixElem{T} ) where T <: NCRingElement = y == x
13701338
13711339@doc raw """
1372- ==(x::MatrixElem{T }, y::T) where {T <: NCRingElem}
1340+ ==(x::MatrixElem{<:NCRingElement }, y::NCRingElement)
13731341
13741342Return `true` if $x == S(y)$ arithmetically, where $S$ is the parent of $x$,
13751343otherwise return `false`.
@@ -1391,7 +1359,7 @@ function ==(x::MatrixElem{T}, y::T) where {T <: NCRingElem}
13911359end
13921360
13931361@doc raw """
1394- ==(x::T , y::MatrixElem{T}) where {T <: NCRingElem}
1362+ ==(x::NCRingElement , y::MatrixElem{<:NCRingElement})
13951363
13961364Return `true` if $S(x) == y$ arithmetically, where $S$ is the parent of $y$,
13971365otherwise return `false`.
@@ -1404,7 +1372,7 @@ otherwise return `false`.
14041372#
14051373# ##############################################################################
14061374
1407- function divexact (x:: MatrixElem{T} , y:: Union{Integer, Rational, AbstractFloat} ; check:: Bool = true ) where T <: NCRingElement
1375+ function divexact (x:: MatrixElem{T} , y:: JuliaRingElement ; check:: Bool = true ) where T <: NCRingElement
14081376 z = similar (x)
14091377 for i = 1 : nrows (x)
14101378 for j = 1 : ncols (x)
0 commit comments