Skip to content

Commit

Permalink
tidy up aug, star and adjoint
Browse files Browse the repository at this point in the history
  • Loading branch information
kalmarek committed Apr 14, 2024
1 parent 1632be4 commit f22b273
Show file tree
Hide file tree
Showing 4 changed files with 3 additions and 5 deletions.
2 changes: 0 additions & 2 deletions src/algebra_elts.jl
Original file line number Diff line number Diff line change
Expand Up @@ -27,8 +27,6 @@ end

aug(a::AlgebraElement) = aug(coeffs(a))

Base.adjoint(a::AlgebraElement) = star(a)

function LinearAlgebra.norm(a::AlgebraElement, p::Real)
return LinearAlgebra.norm(coeffs(a), p)
end
Expand Down
3 changes: 1 addition & 2 deletions src/coefficients.jl
Original file line number Diff line number Diff line change
Expand Up @@ -68,12 +68,11 @@ function nonzero_pairs(v::AbstractSparseVector)
return zip(SparseArrays.nonzeroinds(v), SparseArrays.nonzeros(v))
end

aug(cfs::Any) = sum(values(cfs))
function aug(ac::AbstractCoefficients)
isempty(keys(ac)) && return zero(valtype(ac))
return sum(c * aug(x) for (x, c) in nonzero_pairs(ac))
end
aug(v::AbstractVector) = sum(v)
aug(x::Any) = 1 # ???? dubious...

function LinearAlgebra.norm(sc::AbstractCoefficients, p::Real)
isempty(keys(sc)) && return (0^p)^1 / p
Expand Down
2 changes: 2 additions & 0 deletions src/star.jl
Original file line number Diff line number Diff line change
@@ -1,4 +1,6 @@
Base.adjoint(a::AlgebraElement) = star(a)
star(x::Any) = x'

function star(X::AlgebraElement)
res = star(basis(parent(X)), coeffs(X))
return AlgebraElement(res, parent(X))
Expand Down
1 change: 0 additions & 1 deletion test/runtests.jl
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,6 @@ begin

# generalities for meaningful *-algebras
SA.star(g::GroupElement) = inv(g)
SA.aug(::GroupElement) = 1
end

# implementations of the free monoid over an alphabet
Expand Down

0 comments on commit f22b273

Please sign in to comment.