Skip to content

Commit

Permalink
Improve performance of bracket for AbstractLieAlgebraElem (oscar-…
Browse files Browse the repository at this point in the history
  • Loading branch information
lgoettgens authored and HechtiDerLachs committed Oct 30, 2024
1 parent 2dd1416 commit 9f358f5
Showing 1 changed file with 9 additions and 6 deletions.
15 changes: 9 additions & 6 deletions experimental/LieAlgebras/src/AbstractLieAlgebra.jl
Original file line number Diff line number Diff line change
Expand Up @@ -68,12 +68,15 @@ function bracket(
) where {C<:FieldElem}
check_parent(x, y)
L = parent(x)
mat = sum(
cxi * cyj * _struct_consts(L)[i, j] for (i, cxi) in enumerate(coefficients(x)),
(j, cyj) in enumerate(coefficients(y));
init=sparse_row(coefficient_ring(L)),
)
return L(mat)
vec = sparse_row(coefficient_ring(L))
for (i, cxi) in enumerate(coefficients(x))
iszero(cxi) && continue
for (j, cyj) in enumerate(coefficients(y))
iszero(cyj) && continue
Hecke.add_scaled_row!(_struct_consts(L)[i, j], vec, cxi * cyj)
end
end
return L(vec)
end

###############################################################################
Expand Down

0 comments on commit 9f358f5

Please sign in to comment.