mirror of
https://github.com/kalmarek/GroupRings.jl.git
synced 2024-08-17 02:11:57 +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
|
||||
# * 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}
|
||||
basis::B
|
||||
end
|
||||
@ -28,5 +43,6 @@ Base.@propagate_inbounds function Base.getindex(mstr::TrivialMStructure, i::Inte
|
||||
b = basis(mstr)
|
||||
g, h = b[i], b[j]
|
||||
gh = _product(mstr, g, h)
|
||||
gh in b || throw(ProductNotDefined(i, j, "$g · $h = $gh"))
|
||||
return b[gh]
|
||||
end
|
||||
|
Loading…
Reference in New Issue
Block a user