From cb15964bfd7c4513bb15e411de70cf611488fa81 Mon Sep 17 00:00:00 2001 From: kalmar Date: Tue, 20 Dec 2016 17:57:42 +0100 Subject: [PATCH] Warn in multiplication of elts of K[G], when discarding a product --- GroupAlgebras.jl | 12 +++++++++--- 1 file changed, 9 insertions(+), 3 deletions(-) diff --git a/GroupAlgebras.jl b/GroupAlgebras.jl index cff32e1..e1740f3 100644 --- a/GroupAlgebras.jl +++ b/GroupAlgebras.jl @@ -71,9 +71,15 @@ function group_star_multiplication{T<:Number}(X::GroupAlgebraElement{T}, result = zeros(X.coordinates) for (i,x) in enumerate(X.coordinates), (j,y) in enumerate(Y.coordinates) - index = X.product_matrix[i,j] - if index != 0 - result[index]+= x*y + if x*y == 0 + nothing + else + index = X.product_matrix[i,j] + if index == 0 + throw(DomainError("The product don't seem to belong to the span of basis!")) + else + result[index]+= x*y + end end end return GroupAlgebraElement(result, X.product_matrix)