Skip to content

Commit

Permalink
Add broken tests
Browse files Browse the repository at this point in the history
  • Loading branch information
blegat committed Nov 7, 2024
1 parent d023e28 commit ad67331
Showing 1 changed file with 26 additions and 8 deletions.
34 changes: 26 additions & 8 deletions test/perm_grp_algebra.jl
Original file line number Diff line number Diff line change
@@ -1,3 +1,6 @@
using Test
using PermutationGroups
import StarAlgebras as SA
@testset "POC: group algebra" begin
G = PermGroup(perm"(1,2,3,4,5,6)", perm"(1,2)")
g = Permutation(perm"(1,4,3,6)(2,5)", G)
Expand All @@ -17,7 +20,7 @@
zcfs = SA.SparseCoefficients([one(G), h], [1, -1])
xzcfs = SA.SparseCoefficients([one(G), g, h, g * h], [1, -1, -1, 1])

RG = SA.StarAlgebra(G, db)
RG = SA.StarAlgebra(G, db)

x = SA.AlgebraElement(xcfs, RG)
y = SA.AlgebraElement(ycfs, RG)
Expand Down Expand Up @@ -116,12 +119,27 @@
SA.AlgebraElement(z, sbRG)
end

dx = SA.AlgebraElement(SA.coeffs(x, basis(RG)), RG)
dy = SA.AlgebraElement(SA.coeffs(y, basis(RG)), RG)

@test dx + dy == SA.AlgebraElement(SA.coeffs(x + y, basis(RG)), RG)

@test dx * dy == SA.AlgebraElement(SA.coeffs(x * y, basis(RG)), RG)
dx = SA.AlgebraElement(SA.coeffs(x, SA.basis(RG)), RG)
dy = SA.AlgebraElement(SA.coeffs(y, SA.basis(RG)), RG)

@test dx + dy == SA.AlgebraElement(SA.coeffs(x + y, SA.basis(RG)), RG)

@test dx * dy == SA.AlgebraElement(SA.coeffs(x * y, SA.basis(RG)), RG)

a = SA.AlgebraElement([2], SA.StarAlgebra(G, SA.SubBasis([g], db)))
b = SA.AlgebraElement([-3], SA.StarAlgebra(G, SA.SubBasis([h], db)))
# `Base.+` assumes that using the basis of the first argument will suffice
# We should redefine `Base.:+(a::SubBasis, b::SubBasis)` to first
# convert `a` and `b` to their implicit basis equivalent and then
# do `+` and then convert the result back
# `MultivariateBases` defines an `implicit` function.
# Why not having an `explicit` as well ?
# My dream implementation would be
# Base.:+(a::SubBasis, b::SubBasis) = explicit(implicit(a) + implicit(b))
# so we just need to implement `implicit` and `explicit` 👼
@test_broken SA.explicit(SA.implicit(a)) == a
@test_broken SA.explicit(SA.implicit(b)) == b
@test_broken a + b == SA.explicit(SA.implicit(a) + SA.implicit(b))
@test_broken a * b == SA.explicit(SA.implicit(a) * SA.implicit(b))
end
end

0 comments on commit ad67331

Please sign in to comment.