I am trying to write a function in Julia, which tests, whether to given Lie algebras of common dimension are isomorphic or not. What exactly a Lie algebra is shouldn't be important, all you need to now is, that a Lie algebra can be stored in the computer as a 3-dimensional matrix of constants.
So in the following, I am trying to debug the first part of my function, which already gives me a BoundsError. I have absolutely no idea, where it comes from, since, as far as I can see, all indices are in the correct ranges. Can anybody help me with that?
In the following, n is some positive integer, A and B are 3-dimensional quadratic matrices of size n, so (n\times n\times n)-arrays.
Here is the function:
begin
using HomotopyContinuation
function isom(A,B,n)
C = [HomotopyContinuation.Variable(:C, i, j) for i in 1:n, j in 1:n]
test = 0
termsEqualToZero = []
for i in 1:(n-1)
for j in (i+1):n
for m in 1:n
s1 = sum(sum(C[i][k] * C[j][r] * B[k][r][m] for r = 1:n) for k = 1:n)
s2 = sum(A[i][j][l] * C[l][m] for l = 1:n)
push!(equations, s1 - s2)
end
end
end
system = HomotopyContinuation.System(termsEqualToZero)
solutions = HomotopyContinuation.solve(system)
print(solutions)
end
end
and here my test example with the error message:
begin
L_32 = [[[0,0,0],[0,0,1],[0,0,0]],
[[0,0,-1],[0,0,0],[0,0,0]],
[[0,0,0],[0,0,0],[0,0,0]]]
isom(L_32,L_32,3)
end
BoundsError
1. [email protected]:98[inlined]
2. (::Main.workspace#4.var"#3#7"{Int64, Vector{Vector{Vector{Int64}}}, Matrix{HomotopyContinuation.ModelKit.Variable}, Int64, Int64, Int64})(::Int64)@none:0
3. [email protected]:95[inlined]
4. _foldl_impl(::Base.MappingRF{Main.workspace#4.var"#3#7"{Int64, Vector{Vector{Vector{Int64}}}, Matrix{HomotopyContinuation.ModelKit.Variable}, Int64, Int64, Int64}, Base.BottomRF{typeof(Base.add_sum)}}, ::Base._InitialValue, ::UnitRange{Int64})@reduce.jl:62
5. [email protected]:48[inlined]
6. [email protected]:44[inlined]
7. #mapfoldl#[email protected]:162[inlined]
8. [email protected]:162[inlined]
9. #mapreduce#[email protected]:289[inlined]
10. [email protected]:289[inlined]
11. #sum#[email protected]:503[inlined]
12. [email protected]:503[inlined]
13. #sum#[email protected]:532[inlined]
14. [email protected]:532[inlined]
15. #2@none:0[inlined]
16. [email protected]:95[inlined]
17. _foldl_impl(::Base.MappingRF{Main.workspace#4.var"#2#6"{Vector{Vector{Vector{Int64}}}, Int64, Matrix{HomotopyContinuation.ModelKit.Variable}, Int64, Int64, Int64}, Base.BottomRF{typeof(Base.add_sum)}}, ::Base._InitialValue, ::UnitRange{Int64})@reduce.jl:58
18. foldl_impl(::Base.MappingRF{Main.workspace#4.var"#2#6"{Vector{Vector{Vector{Int64}}}, Int64, Matrix{HomotopyContinuation.ModelKit.Variable}, Int64, Int64, Int64}, Base.BottomRF{typeof(Base.add_sum)}}, ::Base._InitialValue, ::UnitRange{Int64})@reduce.jl:48
19. mapfoldl_impl(::typeof(identity), ::typeof(Base.add_sum), ::Base._InitialValue, ::Base.Generator{UnitRange{Int64}, Main.workspace#4.var"#2#6"{Vector{Vector{Vector{Int64}}}, Int64, Matrix{HomotopyContinuation.ModelKit.Variable}, Int64, Int64, Int64}})@reduce.jl:44
20. var"#mapfoldl#244"(::Base._InitialValue, ::typeof(mapfoldl), ::Function, ::Function, ::Base.Generator{UnitRange{Int64}, Main.workspace#4.var"#2#6"{Vector{Vector{Vector{Int64}}}, Int64, Matrix{HomotopyContinuation.ModelKit.Variable}, Int64, Int64, Int64}})@reduce.jl:162
21. [email protected]:162[inlined]
22. var"#mapreduce#248"(::Base.Pairs{Symbol, Union{}, Tuple{}, NamedTuple{(), Tuple{}}}, ::typeof(mapreduce), ::Function, ::Function, ::Base.Generator{UnitRange{Int64}, Main.workspace#4.var"#2#6"{Vector{Vector{Vector{Int64}}}, Int64, Matrix{HomotopyContinuation.ModelKit.Variable}, Int64, Int64, Int64}})@reduce.jl:289
23. [email protected]:289[inlined]
24. var"#sum#251"(::Base.Pairs{Symbol, Union{}, Tuple{}, NamedTuple{(), Tuple{}}}, ::typeof(sum), ::Function, ::Base.Generator{UnitRange{Int64}, Main.workspace#4.var"#2#6"{Vector{Vector{Vector{Int64}}}, Int64, Matrix{HomotopyContinuation.ModelKit.Variable}, Int64, Int64, Int64}})@reduce.jl:503
25. [email protected]:503[inlined]
26. var"#sum#252"(::Base.Pairs{Symbol, Union{}, Tuple{}, NamedTuple{(), Tuple{}}}, ::typeof(sum), ::Base.Generator{UnitRange{Int64}, Main.workspace#4.var"#2#6"{Vector{Vector{Vector{Int64}}}, Int64, Matrix{HomotopyContinuation.ModelKit.Variable}, Int64, Int64, Int64}})@reduce.jl:532
27. [email protected]:532[inlined]
28. isom(::Vector{Vector{Vector{Int64}}}, ::Vector{Vector{Vector{Int64}}}, ::Int64)@Other: 12
29. top-level scope@Local: 5[inlined]
I would very much appreciate any help, since I am also rather new to Julia, thank you!