Skip to content

Commit

Permalink
increase coverage by removing old methods
Browse files Browse the repository at this point in the history
  • Loading branch information
kalmarek committed May 15, 2024
1 parent cfaca65 commit 7f17590
Show file tree
Hide file tree
Showing 7 changed files with 11 additions and 7 deletions.
2 changes: 0 additions & 2 deletions src/bases.jl
Original file line number Diff line number Diff line change
Expand Up @@ -47,8 +47,6 @@ Explicit bases are stored e.g. in an `AbstractVector` and hence immutable
"""
abstract type ExplicitBasis{T,I} <: AbstractBasis{T,I} end

Base.keys(ib::ExplicitBasis) = Base.OneTo(length(ib))

function zero_coeffs(::Type{S}, eb::ExplicitBasis{T,I}) where {S,T,I}
return spzeros(S, I, length(eb))
end
Expand Down
1 change: 0 additions & 1 deletion src/bases_fixed.jl
Original file line number Diff line number Diff line change
Expand Up @@ -32,7 +32,6 @@ Base.length(b::FixedBasis) = length(b.elts)

Base.iterate(b::FixedBasis) = iterate(b.elts)
Base.iterate(b::FixedBasis, state) = iterate(b.elts, state)
Base.IndexStyle(::Type{<:FixedBasis{T,I,V}}) where {T,I,V} = Base.IndexStyle(V)

# To break ambiguity
Base.@propagate_inbounds Base.getindex(
Expand Down
4 changes: 3 additions & 1 deletion src/coefficients.jl
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@ For general types either all necessary arithmetic operations need to be
implemented, or fallbacks using the framework of `MutableArithmetics` are
provided based on random indexing. Additionally one needs to provide:
* `Base.similar(ac, T::)` with the same semantics as the one for vectors
* `Base.similar(ac, T::Type)` with the same semantics as the one for vectors
* `Base.getindex(ac, idx)`
* `Base.setindex!(ac, val, idx)`
* `MutableArithmetics.operate!(ms::UnsafeAddMul, ac, v::C, w::C) where C<:SA.AbstractCoefficients`
Expand All @@ -36,6 +36,8 @@ key_type(v::SparseArrays.SparseVector) = key_type(typeof(v))

Base.iszero(ac::AbstractCoefficients) = isempty(keys(ac))

Base.similar(ac::AbstractCoefficients) = similar(ac, valtype(ac))

"""
canonical(ac::AbstractCoefficients)
Compute the canonical form of `ac` (e.g. grouping coefficients together, etc).
Expand Down
2 changes: 0 additions & 2 deletions src/mstructures.jl
Original file line number Diff line number Diff line change
Expand Up @@ -83,8 +83,6 @@ struct DiracMStructure{Op} <: MultiplicativeStructure
op::Op
end

DiracMStructure() = DiracMStructure(*)

function (mstr::DiracMStructure)(x::T, y::T) where {T}
xy = mstr.op(x, y)
return SparseCoefficients((xy,), (1,))
Expand Down
1 change: 0 additions & 1 deletion src/star.jl
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,6 @@ function star(X::AlgebraElement)
end

star(::AbstractBasis, x) = star(x)
star(basis::ImplicitBasis, i::Integer) = basis[-i]

function star(basis::AbstractBasis, d::SparseCoefficients)
k = star.(Ref(basis), keys(d))
Expand Down
3 changes: 3 additions & 0 deletions test/abstract_coeffs.jl
Original file line number Diff line number Diff line change
Expand Up @@ -75,6 +75,9 @@ end
fP2 =+ β) // 2
@test coeffs(fP2) isa ACoeffs{<:Rational}

@test SA.key_type(coeffs(fP2)) == UInt32
@test zero(coeffs(fP2)) == ACoeffs(coeffs(zero(P), basis(fRG)))

P3 = 2 * sum(RG(g) for g in basis(RG) if sign(g) > 0) // l
fP3 = AlgebraElement(ACoeffs(coeffs(P3, basis(fRG))), fRG)
@test AlgebraElement(coeffs(fP3, basis(RG)), RG) == P3
Expand Down
5 changes: 5 additions & 0 deletions test/caching_allocations.jl
Original file line number Diff line number Diff line change
Expand Up @@ -36,6 +36,10 @@ end
@test Y * one(fRG) == Y
@test one(fRG) * Y == Y

@test_throws SA.UndefRefError all(!iszero, SA.mstructure(fRG).table)
mstr = deepcopy(SA.mstructure(fRG))
SA.complete!(mstr)
@test all(!iszero(mstr.table))
@test_throws SA.UndefRefError all(!iszero, SA.mstructure(fRG).table)

@static if v"1.10" VERSION < v"1.11"
Expand All @@ -52,6 +56,7 @@ end

@test all(!iszero, SA.mstructure(fRG).table)


@static if v"1.10" VERSION < v"1.11"
YY = deepcopy(Y)
_alloc_test(YY, *, Y, Y, 25)
Expand Down

0 comments on commit 7f17590

Please sign in to comment.