mirror of
https://github.com/kalmarek/GroupRings.jl.git
synced 2024-07-17 19:00:30 +02:00
add ProductNotDefined error
This commit is contained in:
parent
a1f5f0a24c
commit
5caa4facbb
@ -13,6 +13,21 @@ _product(::Val{true}, g, h) = star(g) * h
|
|||||||
# additionally it may implement
|
# additionally it may implement
|
||||||
# * basis(ms)
|
# * basis(ms)
|
||||||
|
|
||||||
|
struct ProductNotDefined <: Exception
|
||||||
|
i::Any
|
||||||
|
j::Any
|
||||||
|
msg::Any
|
||||||
|
end
|
||||||
|
|
||||||
|
function Base.showerror(io::IO, ex::ProductNotDefined)
|
||||||
|
print(io, "Product of elements $(ex.i) and $(ex.j) is not defined on the basis")
|
||||||
|
print(io, " or the multiplicative structure could not be completed")
|
||||||
|
if isdefined(ex, :msg)
|
||||||
|
print(io, ": $(ex.msg)")
|
||||||
|
end
|
||||||
|
print(io, ".")
|
||||||
|
end
|
||||||
|
|
||||||
struct TrivialMStructure{Tw,I,B<:AbstractBasis} <: MultiplicativeStructure{Tw,I}
|
struct TrivialMStructure{Tw,I,B<:AbstractBasis} <: MultiplicativeStructure{Tw,I}
|
||||||
basis::B
|
basis::B
|
||||||
end
|
end
|
||||||
@ -28,5 +43,6 @@ Base.@propagate_inbounds function Base.getindex(mstr::TrivialMStructure, i::Inte
|
|||||||
b = basis(mstr)
|
b = basis(mstr)
|
||||||
g, h = b[i], b[j]
|
g, h = b[i], b[j]
|
||||||
gh = _product(mstr, g, h)
|
gh = _product(mstr, g, h)
|
||||||
|
gh in b || throw(ProductNotDefined(i, j, "$g · $h = $gh"))
|
||||||
return b[gh]
|
return b[gh]
|
||||||
end
|
end
|
||||||
|
Loading…
Reference in New Issue
Block a user