store basis in hashtable while creating product matrix

This commit is contained in:
kalmar 2017-03-13 11:19:40 +01:00
parent af87477068
commit fd1eb40e29
1 changed files with 7 additions and 4 deletions

View File

@ -5,13 +5,16 @@ using GroupAlgebras
function create_product_matrix(basis, limit) function create_product_matrix(basis, limit)
product_matrix = zeros(Int, (limit,limit)) product_matrix = zeros(Int, (limit,limit))
basis_dict = Dict{Array, Int}(x => i
for (i,x) in enumerate(basis))
for i in 1:limit for i in 1:limit
x_inv::eltype(basis) = inv(basis[i]) x_inv::eltype(basis) = inv(basis[i])
Threads.@threads for j in 1:limit for j in 1:limit
w = x_inv*basis[j] w = x_inv*basis[j]
index = findfirst(basis, w) product_matrix[i,j] = basis_dict[w]
index 0 || throw(ArgumentError("Product is not supported on basis: $w")) # index = findfirst(basis, w)
product_matrix[i,j] = index # index ≠ 0 || throw(ArgumentError("Product is not supported on basis: $w"))
# product_matrix[i,j] = index
end end
end end
return product_matrix return product_matrix