Skip to content

Commit

Permalink
Add diagonal hom_direct_sum
Browse files Browse the repository at this point in the history
  • Loading branch information
lgoettgens committed Sep 14, 2023
1 parent 8aea20b commit 3d4a213
Showing 1 changed file with 16 additions and 0 deletions.
16 changes: 16 additions & 0 deletions experimental/LieAlgebras/src/LieAlgebraModuleHom.jl
Original file line number Diff line number Diff line change
Expand Up @@ -416,11 +416,14 @@ end

@doc raw"""
hom_direct_sum(V::LieAlgebraModule{C}, W::LieAlgebraModule{C}, hs::Matrix{<:LieAlgebraModuleHom}) -> LieAlgebraModuleHom
hom_direct_sum(V::LieAlgebraModule{C}, W::LieAlgebraModule{C}, hs::Vector{<:LieAlgebraModuleHom}) -> LieAlgebraModuleHom
Given modules `V` and `W` which are direct sums with `r` respective `s` summands,
say $M = M_1 \oplus \cdots \oplus M_r$, $N = N_1 \oplus \cdots \oplus N_s$, and given a $r \times s$ matrix
`hs` of homomorphisms $h_{ij} : V_i \to W_j$, return the homomorphism
$V \to W$ with $ij$-components $h_{ij}$.
If `hs` is a vector, then it is interpreted as a diagonal matrix.
"""
function hom_direct_sum(
V::LieAlgebraModule{C}, W::LieAlgebraModule{C}, hs::Matrix{<:LieAlgebraModuleHom}
Expand Down Expand Up @@ -448,6 +451,19 @@ function hom_direct_sum(
return hom(V, W, map(map_basis, basis(V)); check=false)
end

function hom_direct_sum(
V::LieAlgebraModule{C}, W::LieAlgebraModule{C}, hs::Vector{<:LieAlgebraModuleHom}
) where {C<:RingElement}
@req is_direct_sum(V) "First module must be a direct sum"
@req is_direct_sum(W) "Second module must be a direct sum"
Vs = base_modules(V)
Ws = base_modules(W)
@req length(Vs) == length(Ws) == length(hs) "Length mismatch"
@req all(i -> domain(hs[i]) === Vs[i] && codomain(hs[i]) === Ws[i], 1:length(hs)) "Domain/codomain mismatch"

return hom(V, W, diagonal_matrix(matrix.(hs)); check=false)
end

@doc raw"""
hom_tensor(V::LieAlgebraModule{C}, W::LieAlgebraModule{C}, hs::Vector{<:LieAlgebraModuleHom}) -> LieAlgebraModuleHom
Expand Down

0 comments on commit 3d4a213

Please sign in to comment.