From a3888b3588dcf2dcf5f38230a4f23bc76fadc897 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Beno=C3=AEt=20Legat?= Date: Sat, 6 Jul 2024 00:51:57 +0200 Subject: [PATCH] Fix star for SubBasis (#44) * Fix star for SubBasis * Update test/runtests.jl * Update test/runtests.jl --- src/monomial.jl | 3 +++ test/runtests.jl | 1 + 2 files changed, 4 insertions(+) diff --git a/src/monomial.jl b/src/monomial.jl index 0f1876b..e24f593 100644 --- a/src/monomial.jl +++ b/src/monomial.jl @@ -435,3 +435,6 @@ function SA.coeffs( return SA.coeffs!(res, cfs, source, target) end end + +# FIXME this assumes that the basis is invariant under adjoint +SA.star(::SubBasis, coeffs) = SA.star.(coeffs) diff --git a/test/runtests.jl b/test/runtests.jl index e411565..92e8e14 100644 --- a/test/runtests.jl +++ b/test/runtests.jl @@ -65,6 +65,7 @@ function api_test(B::Type{<:MB.AbstractMonomialIndexed}, degree) #@test polynomial(i -> 0.0, basis) isa polynomial_type(basis, Float64) a = MB.algebra_element(ones(length(basis)), basis) _test_op(MB.implicit, a) + @test SA.star(a) == a end mono = x[1]^2 * x[2]^3 p = MB.Polynomial{B}(mono)