-
Notifications
You must be signed in to change notification settings - Fork 3
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Fixes for Chebyshev #23
Conversation
@kalmarek I found the issue with the tests, |
julia> v = sparsevec(UInt16[1, 2], Int[2, 3])
2-element SparseVector{Int64, UInt16} with 2 stored entries:
[1] = 2
[2] = 3
julia> SparseArrays.indtype(v)
UInt16
julia> SparseArrays.indtype(typeof(v))
ERROR: MethodError: no method matching indtype(::Type{SparseVector{Int64, UInt16}})
Closest candidates are:
indtype(::SubArray{Tv, 1, <:AbstractSparseVector{Tv, Ti}, Tuple{Base.Slice{Base.OneTo{Int64}}}, false} where {Tv, Ti})
@ SparseArrays ~/.julia/juliaup/julia-1.10.1+0.x64.linux.gnu/share/julia/stdlib/v1.10/SparseArrays/src/sparsevector.jl:151
indtype(::SubArray{Tv, 1, <:SparseArrays.AbstractSparseMatrixCSC{Tv, Ti}, Tuple{Base.Slice{Base.OneTo{Int64}}, Int64}, false} where {Tv, Ti})
@ SparseArrays ~/.julia/juliaup/julia-1.10.1+0.x64.linux.gnu/share/julia/stdlib/v1.10/SparseArrays/src/sparsevector.jl:150
indtype(::Union{LowerTriangular{var"#s2", var"#s1"}, UnitLowerTriangular{var"#s2", var"#s1"}, UnitUpperTriangular{var"#s2", var"#s1"}, UpperTriangular{var"#s2", var"#s1"}} where {var"#s2", var"#s1"<:AbstractSparseArray})
@ SparseArrays ~/.julia/juliaup/julia-1.10.1+0.x64.linux.gnu/share/julia/stdlib/v1.10/SparseArrays/src/abstractsparse.jl:79
...
Stacktrace:
[1] top-level scope
@ REPL[34]:1
julia> keytype(v)
Int64
julia> keytype(typeof(v))
Int64
julia> SparseArrays.indtype([1, 3])
ERROR: MethodError: no method matching indtype(::Vector{Int64})
Closest candidates are:
indtype(::SubArray{Tv, 1, <:AbstractSparseVector{Tv, Ti}, Tuple{Base.Slice{Base.OneTo{Int64}}}, false} where {Tv, Ti})
@ SparseArrays ~/.julia/juliaup/julia-1.10.1+0.x64.linux.gnu/share/julia/stdlib/v1.10/SparseArrays/src/sparsevector.jl:151
indtype(::SubArray{Tv, 1, <:SparseArrays.AbstractSparseMatrixCSC{Tv, Ti}, Tuple{Base.Slice{Base.OneTo{Int64}}, Int64}, false} where {Tv, Ti})
@ SparseArrays ~/.julia/juliaup/julia-1.10.1+0.x64.linux.gnu/share/julia/stdlib/v1.10/SparseArrays/src/sparsevector.jl:150
indtype(::Union{LowerTriangular{var"#s2", var"#s1"}, UnitLowerTriangular{var"#s2", var"#s1"}, UnitUpperTriangular{var"#s2", var"#s1"}, UpperTriangular{var"#s2", var"#s1"}} where {var"#s2", var"#s1"<:AbstractSparseArray})
@ SparseArrays ~/.julia/juliaup/julia-1.10.1+0.x64.linux.gnu/share/julia/stdlib/v1.10/SparseArrays/src/abstractsparse.jl:79
...
Stacktrace:
[1] top-level scope
@ REPL[37]:1
julia> SparseArrays.indtype(Vector{Int})
ERROR: MethodError: no method matching indtype(::Type{Vector{Int64}})
Closest candidates are:
indtype(::SubArray{Tv, 1, <:AbstractSparseVector{Tv, Ti}, Tuple{Base.Slice{Base.OneTo{Int64}}}, false} where {Tv, Ti})
@ SparseArrays ~/.julia/juliaup/julia-1.10.1+0.x64.linux.gnu/share/julia/stdlib/v1.10/SparseArrays/src/sparsevector.jl:151
indtype(::SubArray{Tv, 1, <:SparseArrays.AbstractSparseMatrixCSC{Tv, Ti}, Tuple{Base.Slice{Base.OneTo{Int64}}, Int64}, false} where {Tv, Ti})
@ SparseArrays ~/.julia/juliaup/julia-1.10.1+0.x64.linux.gnu/share/julia/stdlib/v1.10/SparseArrays/src/sparsevector.jl:150
indtype(::Union{LowerTriangular{var"#s2", var"#s1"}, UnitLowerTriangular{var"#s2", var"#s1"}, UnitUpperTriangular{var"#s2", var"#s1"}, UpperTriangular{var"#s2", var"#s1"}} where {var"#s2", var"#s1"<:AbstractSparseArray})
@ SparseArrays ~/.julia/juliaup/julia-1.10.1+0.x64.linux.gnu/share/julia/stdlib/v1.10/SparseArrays/src/abstractsparse.jl:79
...
Stacktrace:
[1] top-level scope
@ REPL[38]:1 so we'll have to create our own. |
Codecov ReportAttention: Patch coverage is
❗ Your organization needs to install the Codecov GitHub app to enable full functionality. Additional details and impacted files@@ Coverage Diff @@
## mk/non_monomial_basis #23 +/- ##
=========================================================
- Coverage 51.83% 51.82% -0.01%
=========================================================
Files 15 15
Lines 463 465 +2
=========================================================
+ Hits 240 241 +1
- Misses 223 224 +1
Flags with carried forward coverage won't be shown. Click here to find out more. ☔ View full report in Codecov by Sentry. |
* Fixes for Chebyshev * Add key_type
* remove CachedMTable * introduce ImplicitBasis and ExplicitBasis * rename TrivialMStructure → LazyMStructure * remove baseless StarAlgebras * AlgebraElement coefficients don't need to be vector * first try on coefficients * Fixes * rename Basis → Fixed Basis * introduce DiracBasis <: ImplicitBasis * move mul! to mstructures * fix the order {K,V} of params in AbstractCoefficients * fix printing of LazyMStructure * add keytype, valtype for AbstractCoefficients * add getindex for LazyMStructure over DiracBasis * add == for AbstractCoefficients * make DiracBasis threadsafe * give it a try with different parametrization of MStructures * Fixes * move star_of to FixedBasis * return DiracDeltas on indexing DiracBasis * dispatch star through star(basis, coeffs) * move fmac! so that StarAlgebras actually load * implement basic canonicalize * more star dispatch * simplify AlgebraElement * fix: define MA.operate!(zero, ::SparseVector) * fix show methods * fix getindex for LazyMStructure * move coefficients to their separate files * move Dirac/FixedBases to their separate files * add (Dirac|Augmented)MStructure * reimplement MTables * fix the definitions of of StarAlgebra/AlgebraElements * add a new implementation of star * reimplement augmentation * various small fixes * add fmac! for AbstractVector * remove show for DiracMStructure now that it is basis free * quickly fix one * commit tmp.jl as an example of what works * move tmp.jl to test/perm_grp_algebra.jl * turn demo perm_grp_algebra.jl into testset * disable the old test for now * move compat section for Groups etc to test/Project.toml * Let AlgebraElement be an AbstractMutable * zero!(.) -> MA.operate!(zero, .) * neg! -> operate_to!(- * add! -> operate_to!(+ * mul! -> MA.operate_to! * mul! with mstruct to MA * sub! -> MA * fmac -> MA * Check for alias * unsafe_add! -> UnsafeAddMul * Document UnsafeAddMul * Fixes for Chebyshev (#23) * Fixes for Chebyshev * Add key_type * replace keytype → key_type * rename _nzpairs → nonzero_pairs * implement canonicalization via MA.operate!!(canonical, ...) * move the mutable API to coefficients * remove Dirac and use GroupElements directly This is akin to using monomials * rename AugmentedDirac to Augmented * fix: == for SparseCoefficients * reorganize defs for star, aug and norm/dot * implement MA API for SparseCoefficients * add zero_coeffs(::Type, ::AbstractBasis) currently defaults to * SparseCoefficients (ImplicitBasis) * SparseVectir (ExplicitBasis) * fix: use nonzero_pairs instead of pairs * fix: logic for canonical(::SparseCoefficients) * add getindex/setindex! for SparseCoefficients * reshuffle definitions in types.jl (this file needs to be broken down anyway) * one/zero & isone/iszero are surprisingly hard... * various small fixes/convenience additions * fix: use getindex instead of broadcasting * [tests] implement iteration over free words * [test] rewrite testset Arithmetic in group algebra * [tests] rewrite tests with free monoid algebra * [tests] rewrite tests for chaching multiplication * [tests] update constructors and sohs in group algebra * [tests] reenable tests * fix: test LinearAlgebra.dot * fix includes * bump version to 0.3 * [tests] fix: @Allocations exist in julia ≥ 1.9 * tidy up aug, star and adjoint * allow no cache in FixedBasis * document minimal AbstractCoefficients API * de-randomize !isone test * add default cache parameter (UInt32(0)) for FixedBasis * fix: compute hash on canonicalized coeffs * add Comparable to pass < for sorting in sparse coeffs * caching for MTables does not work for isbits elements This is because isbits elements may not track isdefined / isassigned status. As a consequence Matrix{T}(undef, dims) is initialized to garbage. * fix: use proper (double) indexing when evaluating AlgebraElement * enable canonical for Vectors * add += with MTable for AbstractVectors * fix: MA.operate!(zero, ...) failed for SparseVector{Rational...} Most probably due to Rationals initialized from random memory * remove old/unused functions * add Base.keys(b::ExplicitBasis) * expand docstring for AbstractBasis * inlining nonzero_pairs saves lots of allocations * test aug for Augmented basis * reduce allocations by hinting size * unbreak tests with MutableArithmetics 1.4.3 * test allocations only on 1.10 the number of allocations on nightly increased due to the introduction of Memory{T} in base julia * rearrange tests * lock complete! of MTable behind a SpinLock * Unbreak broken tests * Exclude on Julia latest * Missing newline * remove Comparable * update README with working examples * fix (?) for multithreading access to MTable cache * make augmented stuff a self-contained file * don't export supp * fix nonzero_pairs for a vector * add tests for arithmetic on coeffs * add tests for using dense vector as coeffs * add test for abstract coeffs * add a bit of docs what AbstractCoefficients is * formatting * increase coverage by removing old methods * fix norm/dot and provide coverage * fix iteration on AugmentedBasis and add tests * move the generic MA.operate! from ACoeffs to the lib * one more broken test * Base._return_type -> MA.promote_operation * Fix broken all tests but one * Turn last broken test into a passable test * Add eachindex back * Assume mutability for canonical (#31) * Assume mutability for canonical * Fix allocation test * Debug for Julia v1.6 * Use 0.7 --------- Co-authored-by: Benoît Legat <benoit.legat@gmail.com>
This is to help
MultivariatePolynomials.AbstractPolynomial
be used as well for coefficients