Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Miscellaneous collected minor changes #177

Merged
merged 3 commits into from
Feb 11, 2025
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
39 changes: 23 additions & 16 deletions src/DeformationBases/ArcDiagDeformBasis.jl
Original file line number Diff line number Diff line change
Expand Up @@ -45,37 +45,39 @@

extra_data = Dict{DeformationMap{elem_type(sp)}, Set{ArcDiagram}}()

n_cases = div(length(V_nice_summands) * (length(V_nice_summands) + 1), 2)
n_sum_cases = div(length(V_nice_summands) * (length(V_nice_summands) + 1), 2)
lens = Int[]
iters = []
for d in degs
case = 0
sum_case = 0
for (i_l, V_nice_summand_i_l) in enumerate(V_nice_summands),
(i_r, V_nice_summand_i_r) in enumerate(V_nice_summands)

if i_l > i_r
continue
end

case += 1
sum_case += 1

proj_to_summand_l = compose(h, canonical_projection(V_nice, i_l))
proj_to_summand_r = compose(h, canonical_projection(V_nice, i_r))

W = if i_l == i_r
exterior_power_obj(V_nice_summand_i_l, 2)
if i_l == i_r
W = exterior_power_obj(V_nice_summand_i_l, 2)
case = :exterior_power
else
tensor_product(V_nice_summand_i_l, V_nice_summand_i_r)
W = tensor_product(V_nice_summand_i_l, V_nice_summand_i_r)
case = :tensor_product

Check warning on line 70 in src/DeformationBases/ArcDiagDeformBasis.jl

View check run for this annotation

Codecov / codecov/patch

src/DeformationBases/ArcDiagDeformBasis.jl#L69-L70

Added lines #L69 - L70 were not covered by tests
end

diag_iter = pbw_arc_diagrams(LieType, W, d)
len = length(diag_iter)
prog_meter = ProgressMeter.Progress(len; output=stderr, enabled=true, desc="Basis generation: deg $d, case $(case)/$(n_cases)")
prog_meter = ProgressMeter.Progress(len; output=stderr, enabled=true, desc="Basis generation: deg $d, case $(sum_case)/$(n_sum_cases)")
generate_showvalues(counter, diag) = () -> [("iteration", (counter, diag))]
iter = (
begin
# @vprintln :PBWDeformations 2 "Basis generation deg $(lpad(d, maximum(ndigits, degs))), case $(lpad(case, ndigits(n_cases)))/$(n_cases), $(lpad(floor(Int, 100*counter / len), 3))%, $(lpad(counter, ndigits(len)))/$(len)"
_basis_elem = arcdiag_to_deformationmap(LieType, diag, sp, W)
# @vprintln :PBWDeformations 2 "Basis generation deg $(lpad(d, maximum(ndigits, degs))), case $(lpad(sum_case, ndigits(n_sum_cases)))/$(n_sum_cases), $(lpad(floor(Int, 100*counter / len), 3))%, $(lpad(counter, ndigits(len)))/$(len)"
_basis_elem = arcdiag_to_deformationmap(LieType, diag, sp, W, case)
basis_elem = matrix(proj_to_summand_l) * _basis_elem * transpose(matrix(proj_to_summand_r))
if i_l != i_r
basis_elem -= transpose(basis_elem)
Expand All @@ -99,6 +101,7 @@
collected = collect(iter)
push!(lens, length(collected))
push!(iters, collected)
ProgressMeter.finish!(prog_meter)
end
end
len = sum(lens)
Expand Down Expand Up @@ -399,15 +402,17 @@
diag::ArcDiagramDirected,
sp::SmashProductLie{C},
W::LieAlgebraModule=exterior_power_obj(base_module(sp), 2),
case::Symbol=:exterior_power
) where {C <: RingElem}
return arcdiag_to_deformationmap(T, arc_diagram(Undirected, diag), sp, W)
return arcdiag_to_deformationmap(T, arc_diagram(Undirected, diag), sp, W, case)

Check warning on line 407 in src/DeformationBases/ArcDiagDeformBasis.jl

View check run for this annotation

Codecov / codecov/patch

src/DeformationBases/ArcDiagDeformBasis.jl#L407

Added line #L407 was not covered by tests
end

function arcdiag_to_deformationmap(
T::Union{SO, GL},
diag::ArcDiagramUndirected,
sp::SmashProductLie{C},
W::LieAlgebraModule=exterior_power_obj(base_module(sp), 2),
case::Symbol=:exterior_power
) where {C <: RingElem}
@req !_is_direct_sum(W)[1] "Not permitted for direct sums."
ind_map = basis_index_mapping(W)
Expand All @@ -416,15 +421,17 @@

iso_pair_to_L = arc_diagram_lower_pair_to_L(T, dim_stdmod_V)

case = :unknown

if ((fl, Wbase, k) = _is_exterior_power(W); fl)
if case == :exterior_power
fl, Wbase, k = _is_exterior_power(W)
@assert fl
@assert k == 2
nrows_kappa = ncols_kappa = dim(Wbase)
case = :exterior_power
elseif ((fl, W_factors) = _is_tensor_product(W); fl)
elseif case == :tensor_product
fl, W_factors = _is_tensor_product(W)
@assert fl

Check warning on line 431 in src/DeformationBases/ArcDiagDeformBasis.jl

View check run for this annotation

Codecov / codecov/patch

src/DeformationBases/ArcDiagDeformBasis.jl#L429-L431

Added lines #L429 - L431 were not covered by tests
nrows_kappa, ncols_kappa = dim.(W_factors)
case = :tensor_product
else
error("Unknown case")

Check warning on line 434 in src/DeformationBases/ArcDiagDeformBasis.jl

View check run for this annotation

Codecov / codecov/patch

src/DeformationBases/ArcDiagDeformBasis.jl#L434

Added line #L434 was not covered by tests
end

kappa = zero_matrix(sp, nrows_kappa, ncols_kappa)
Expand Down
2 changes: 2 additions & 0 deletions src/PBWDeformations.jl
Original file line number Diff line number Diff line change
Expand Up @@ -100,6 +100,8 @@ export lower_vertex, is_lower_vertex
export lower_vertices
export matrix_repr_basis
export n_edges
export n_lower_vertices
export n_upper_vertices
export n_vertices
export neighbor
export neighbors
Expand Down
Loading