Skip to content

Commit

Permalink
Implement == for algebra
Browse files Browse the repository at this point in the history
  • Loading branch information
blegat committed May 27, 2024
1 parent 8255fe5 commit 48ab7c1
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 2 deletions.
4 changes: 2 additions & 2 deletions src/arithmetic.jl
Original file line number Diff line number Diff line change
Expand Up @@ -91,7 +91,7 @@ function MA.operate_to!(
X::AlgebraElement,
Y::AlgebraElement,
)
@assert parent(res) === parent(X) === parent(Y)
@assert parent(res) == parent(X) == parent(Y)
MA.operate_to!(coeffs(res), -, coeffs(Y))
MA.operate_to!(coeffs(res), +, coeffs(res), coeffs(X))
return res
Expand All @@ -103,7 +103,7 @@ function MA.operate_to!(
X::AlgebraElement,
Y::AlgebraElement,
)
@assert parent(res) === parent(X) === parent(Y)
@assert parent(res) == parent(X) == parent(Y)
mstr = mstructure(basis(parent(res)))
MA.operate_to!(coeffs(res), mstr, coeffs(X), coeffs(Y))
return res
Expand Down
3 changes: 3 additions & 0 deletions src/types.jl
Original file line number Diff line number Diff line change
Expand Up @@ -26,6 +26,9 @@ end

basis(A::StarAlgebra) = A.basis
object(A::StarAlgebra) = A.object
function Base.:(==)(a::StarAlgebra, b::StarAlgebra)
return a.basis == b.basis
end

struct AlgebraElement{A,T,V} <: MA.AbstractMutable
coeffs::V
Expand Down

0 comments on commit 48ab7c1

Please sign in to comment.