diff --git a/src/bases.jl b/src/bases.jl index 9825080..b7ccadd 100644 --- a/src/bases.jl +++ b/src/bases.jl @@ -102,3 +102,7 @@ function adjoint_coeffs!(res, cfs, source::AbstractBasis, target::AbstractBasis) end return res end + +function adjoint_coeffs(a::AlgebraElement, target::AbstractBasis) + return adjoint_coeffs(coeffs(a), target, basis(a)) +end diff --git a/test/abstract_coeffs.jl b/test/abstract_coeffs.jl index efc6826..bda4bd3 100644 --- a/test/abstract_coeffs.jl +++ b/test/abstract_coeffs.jl @@ -13,6 +13,10 @@ y = AlgebraElement(ACoeffs(coeffs(b, basis(fRG))), fRG) x, y end + @test coeffs(α - β, SA.FixedBasis(basis(RG); n = 2)) == [1, -1] + @test_throws KeyError coeffs(α - β, SA.FixedBasis(basis(RG); n = 1)) + @test SA.adjoint_coeffs(α - β, SA.FixedBasis(basis(RG); n = 2)) == [1, -1] + @test SA.adjoint_coeffs(α - β, SA.FixedBasis(basis(RG); n = 1)) == [1] @test coeffs(2α) isa ACoeffs{Int} @test coeffs(α - β) isa ACoeffs @test coeffs(α - β // 3) isa ACoeffs{<:Rational}