diff --git a/src/algebra_elts.jl b/src/algebra_elts.jl index e2e160b..44954df 100644 --- a/src/algebra_elts.jl +++ b/src/algebra_elts.jl @@ -15,13 +15,13 @@ function Base.deepcopy_internal(a::AlgebraElement, id::IdDict) end # call overload: -(a::AlgebraElement)(x) = coeffs(a)[basis(parent(a))[x]] -Base.setindex!(a::AlgebraElement, v, idx) = a.coeffs[basis(parent(a))[idx]] = v +(a::AlgebraElement)(x) = coeffs(a)[basis(a)[x]] +Base.setindex!(a::AlgebraElement, v, idx) = a.coeffs[basis(a)[idx]] = v # AlgebraElement specific functions function supp(a::AlgebraElement) - b = basis(parent(a)) + b = basis(a) return [b[i] for (i, _) in nonzero_pairs(coeffs(a))] end diff --git a/src/types.jl b/src/types.jl index 11a37d5..b3e9b59 100644 --- a/src/types.jl +++ b/src/types.jl @@ -36,8 +36,9 @@ Base.parent(a::AlgebraElement) = a.parent Base.eltype(a::AlgebraElement) = valtype(coeffs(a)) coeffs(a::AlgebraElement) = a.coeffs function coeffs(x::AlgebraElement, b::AbstractBasis) - return coeffs(coeffs(x), basis(parent(x)), b) + return coeffs(coeffs(x), basis(x), b) end +basis(a::AlgebraElement) = basis(parent(a)) function AlgebraElement(coeffs, A::AbstractStarAlgebra) _sanity_checks(coeffs, A) @@ -87,7 +88,7 @@ function Base.isone(a::AlgebraElement) if basis(A) isa DiracBasis return c == cfs1 else - dc = coeffs(c, basis(parent(a)), DiracBasis{UInt}(object(parent(a)))) + dc = coeffs(c, basis(a), DiracBasis{UInt}(object(parent(a)))) return dc == cfs1 end end diff --git a/test/group_algebra.jl b/test/group_algebra.jl index 0dc2c25..6804b6b 100644 --- a/test/group_algebra.jl +++ b/test/group_algebra.jl @@ -115,7 +115,7 @@ z = sum((one(RG) - RG(g)) * star(one(RG) - RG(g)) for g in G) @test SA.aug(z) == 0 - @test SA.supp(z) == sort(collect(basis(parent(z)))) + @test SA.supp(z) == sort(collect(basis(z))) @test SA.supp(RG(1) + RG(g)) == [one(G), g] @test SA.supp(a) == [one(G), h, g]