Skip to content

Commit

Permalink
DirectSumLieAlgebras work
Browse files Browse the repository at this point in the history
  • Loading branch information
lgoettgens committed Feb 7, 2025
1 parent b69f952 commit ba265fc
Showing 1 changed file with 9 additions and 4 deletions.
13 changes: 9 additions & 4 deletions experimental/LieAlgebras/src/serialization.jl
Original file line number Diff line number Diff line change
Expand Up @@ -67,9 +67,14 @@ end

@register_serialization_type DirectSumLieAlgebra uses_id lie_algebra_serialization_attributes

type_params(L::DirectSumLieAlgebra) = TypeParams(
DirectSumLieAlgebra,
:base_ring => coefficient_ring(L),
type_params_root_system_data(L)...,
)

function save_object(s::SerializerState, L::DirectSumLieAlgebra)
save_data_dict(s) do
save_typed_object(s, coefficient_ring(L), :base_ring)
save_data_array(s, :summands) do
for summand in L.summands
ref = save_as_ref(s, summand)
Expand All @@ -80,16 +85,16 @@ function save_object(s::SerializerState, L::DirectSumLieAlgebra)
end
end

function load_object(s::DeserializerState, ::Type{<:DirectSumLieAlgebra})
R = load_typed_object(s, :base_ring)
function load_object(s::DeserializerState, ::Type{<:DirectSumLieAlgebra}, d::Dict)
R = d[:base_ring]
summands = Vector{LieAlgebra{elem_type(R)}}(
load_array_node(s, :summands) do _
load_ref(s)
end,
)

L = direct_sum(R, summands)
load_root_system_data(s, L)
load_root_system_data(s, L, d)
return L
end

Expand Down

0 comments on commit ba265fc

Please sign in to comment.