Skip to content

Commit

Permalink
replace further uses of basis(parent(…))
Browse files Browse the repository at this point in the history
  • Loading branch information
kalmarek committed May 30, 2024
1 parent f5473ac commit 45ef71f
Show file tree
Hide file tree
Showing 5 changed files with 7 additions and 7 deletions.
6 changes: 3 additions & 3 deletions src/algebra_elts.jl
Original file line number Diff line number Diff line change
Expand Up @@ -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

Expand Down
2 changes: 1 addition & 1 deletion src/arithmetic.jl
Original file line number Diff line number Diff line change
Expand Up @@ -103,7 +103,7 @@ function MA.operate_to!(
Y::AlgebraElement,
)
@assert parent(res) == parent(X) == parent(Y)
mstr = mstructure(basis(parent(res)))
mstr = mstructure(basis(res))
MA.operate_to!(coeffs(res), mstr, coeffs(X), coeffs(Y))
return res
end
Expand Down
2 changes: 1 addition & 1 deletion src/star.jl
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@ Base.adjoint(a::AlgebraElement) = star(a)
star(x::Any) = x'

function star(X::AlgebraElement)
res = star(basis(parent(X)), coeffs(X))
res = star(basis(X), coeffs(X))
return AlgebraElement(res, parent(X))
end

Expand Down
2 changes: 1 addition & 1 deletion src/types.jl
Original file line number Diff line number Diff line change
Expand Up @@ -90,7 +90,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
Expand Down
2 changes: 1 addition & 1 deletion test/group_algebra.jl
Original file line number Diff line number Diff line change
Expand Up @@ -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]

Expand Down

0 comments on commit 45ef71f

Please sign in to comment.