The performant version of group_star_multiplication

This commit is contained in:
kalmar 2016-12-22 00:59:06 +01:00
parent 5dc0dff3ff
commit 5bc90f49e1
1 changed files with 11 additions and 9 deletions

View File

@ -64,15 +64,17 @@ function group_star_multiplication{T<:Number}(X::GroupAlgebraElement{T},
X.product_matrix == Y.product_matrix || ArgumentError(
"Elements don't seem to belong to the same Group Algebra!")
result = zeros(X.coordinates)
for (i,x) in enumerate(X.coordinates), (j,y) in enumerate(Y.coordinates)
if x*y == 0
nothing
else
index = X.product_matrix[i,j]
if index == 0
throw(ArgumentError("The product don't seem to belong to the span of basis!"))
else
result[index]+= x*y
for (i,x) in enumerate(X.coordinates)
if x != 0
for (j,y) in enumerate(Y.coordinates)
if y != 0
index = X.product_matrix[i,j]
if index == 0
throw(ArgumentError("The product don't seem to belong to the span of basis!"))
else
result[index]+= x*y
end
end
end
end
end