1
0
mirror of https://github.com/kalmarek/Groups.jl.git synced 2024-12-26 02:20:30 +01:00

add literal_pow(^, s::GSymbol, ::Val{-1}) = inv(s)

This commit is contained in:
Marek Kaluba 2021-05-07 18:16:58 +02:00
parent 6e14d30903
commit 31a0620da3
No known key found for this signature in database
GPG Key ID: 8BF1A3855328FC15

View File

@ -9,6 +9,7 @@ Base.length(s::GSymbol) = first(size(s))
Base.eltype(s::GS) where GS<:GSymbol = GS Base.eltype(s::GS) where GS<:GSymbol = GS
Base.isone(s::GSymbol) = iszero(s.pow) Base.isone(s::GSymbol) = iszero(s.pow)
Base.literal_pow(::typeof(^), s::Groups.GSymbol, ::Val{-1}) = inv(s)
Base.inv(s::GSymbol) = change_pow(s, -s.pow) Base.inv(s::GSymbol) = change_pow(s, -s.pow)
Base.hash(s::S, h::UInt) where S<:GSymbol = hash(s.id, hash(s.pow, hash(S, h))) Base.hash(s::S, h::UInt) where S<:GSymbol = hash(s.id, hash(s.pow, hash(S, h)))