diff --git a/.github/workflows/SpellCheck.yml b/.github/workflows/SpellCheck.yml new file mode 100644 index 00000000..3d62423c --- /dev/null +++ b/.github/workflows/SpellCheck.yml @@ -0,0 +1,13 @@ +name: Spell Check + +on: [pull_request] + +jobs: + typos-check: + name: Spell Check with Typos + runs-on: ubuntu-latest + steps: + - name: Checkout Actions Repository + uses: actions/checkout@v4 + - name: Check spelling + uses: crate-ci/typos@master \ No newline at end of file diff --git a/Project.toml b/Project.toml index bea9439a..7bb0b278 100644 --- a/Project.toml +++ b/Project.toml @@ -2,7 +2,7 @@ name = "Polynomials" uuid = "f27b6e38-b328-58d1-80ce-0feddd5e7a45" license = "MIT" author = "JuliaMath" -version = "4.0.4" +version = "4.0.5" [deps] LinearAlgebra = "37e2e46d-f89d-539d-b4ee-838fcccc9c8e" @@ -26,6 +26,7 @@ PolynomialsMutableArithmeticsExt = "MutableArithmetics" [compat] ChainRulesCore = "1" FFTW = "1" +LinearAlgebra = "1.6" MakieCore = "0.6" MutableArithmetics = "1" RecipesBase = "0.7, 0.8, 1" diff --git a/docs/src/index.md b/docs/src/index.md index a221f9f6..005a8a43 100644 --- a/docs/src/index.md +++ b/docs/src/index.md @@ -841,7 +841,7 @@ savefig("rational_function.svg"); nothing # hide * [MultiPoly.jl](https://github.com/daviddelaat/MultiPoly.jl) for sparse multivariate polynomials -* [DynamicPolynomals.jl](https://github.com/JuliaAlgebra/DynamicPolynomials.jl) Multivariate polynomials implementation of commutative and non-commutative variables +* [DynamicPolynomials.jl](https://github.com/JuliaAlgebra/DynamicPolynomials.jl) Multivariate polynomials implementation of commutative and non-commutative variables * [MultivariatePolynomials.jl](https://github.com/JuliaAlgebra/MultivariatePolynomials.jl) for multivariate polynomials and moments of commutative or non-commutative variables diff --git a/src/Polynomials.jl b/src/Polynomials.jl index 61ab46f2..af6de8ec 100644 --- a/src/Polynomials.jl +++ b/src/Polynomials.jl @@ -1,3 +1,8 @@ +""" + Polynomials.jl + +Basic arithmetic, integration, differentiation, evaluation, root finding, and fitting for [univariate polynomials](https://en.wikipedia.org/wiki/Polynomial) in [Julia](https://julialang.org/). +""" module Polynomials # using GenericLinearAlgebra ## remove for now. cf: https://github.com/JuliaLinearAlgebra/GenericLinearAlgebra.jl/pull/71#issuecomment-743928205 diff --git a/src/abstract-polynomial.jl b/src/abstract-polynomial.jl index 16eca0c8..26090bef 100644 --- a/src/abstract-polynomial.jl +++ b/src/abstract-polynomial.jl @@ -57,7 +57,7 @@ basis_symbol(::Type{AbstractUnivariatePolynomial{B,T,X}}) where {B,T,X} = "Χ($( ## idea is vector space stuff (scalar_add, scalar_mult, vector +/-, ^) goes here ## connection (convert, transform) is specific to a basis (storage) -## ⊗(p::P{T,X}, q::P{S,Y}) is specic to basis/storage +## ⊗(p::P{T,X}, q::P{S,Y}) is specific to basis/storage # type of basis basistype(p::AbstractUnivariatePolynomial{B,T,X}) where {B,T,X} = B diff --git a/src/common.jl b/src/common.jl index b23ee6a1..f53bee56 100644 --- a/src/common.jl +++ b/src/common.jl @@ -1005,7 +1005,7 @@ basis(p::P, k::Int, _var=indeterminate(p); var=_var) where {P<:AbstractPolynomia #= composition -cf. https://github.com/JuliaMath/Polynomials.jl/issues/511 for a paper with implentations +cf. https://github.com/JuliaMath/Polynomials.jl/issues/511 for a paper with implementations =# """ @@ -1062,7 +1062,7 @@ Base.:+(p::P, c::T) where {T,X, P<:AbstractPolynomial{T,X}} = scalar_add(c, p) Base.:+(p::P, c::S) where {T,X, P<:AbstractPolynomial{T,X}, S} = scalar_add(c,p) ## polynomial + polynomial when different types -## - each polynomial container type implents PB{B,T,X} + PB{B,S,X} +## - each polynomial container type implements PB{B,T,X} + PB{B,S,X} ## - this handles case X ≠ Y unless constant ## - when PB₁ ≠ PB₂ we promote both polynomials function Base.:+(p::P, q::Q) where {T,X,P <: AbstractPolynomial{T,X}, S,Y,Q <: AbstractPolynomial{S,Y}} @@ -1126,7 +1126,7 @@ Base.:^(p::AbstractPolynomial, n::Integer) = Base.power_by_squaring(p, n) -# Th ⊕ methd below is used in Special Polynomials, but not here, as it was removed for +# Th ⊕ method below is used in Special Polynomials, but not here, as it was removed for # similar methods in the polynomial-basetypes # addition of polynomials is just vector space addition, so can be done regardless # of basis, as long as the same. These ⊕ methods try to find a performant means to add diff --git a/src/polynomial-container-types/immutable-dense-polynomial.jl b/src/polynomial-container-types/immutable-dense-polynomial.jl index d8fb2b96..69d542b9 100644 --- a/src/polynomial-container-types/immutable-dense-polynomial.jl +++ b/src/polynomial-container-types/immutable-dense-polynomial.jl @@ -23,7 +23,7 @@ ImmutableDensePolynomial{B,T,X,N}(check::Type{Val{false}}, cs::NTuple{N,T}) wher ImmutableDensePolynomial{B,T,X,N}(check::Type{Val{true}}, cs::NTuple{N,T}) where {B,N, T,X} = ImmutableDensePolynomial{B,T,X,N}(cs) -# tuple with mis-matched size +# tuple with mismatched size function ImmutableDensePolynomial{B,T,X,N}(xs::NTuple{M,S}) where {B,T,S,X,N,M} p = ImmutableDensePolynomial{B,S,X,M}(xs) convert(ImmutableDensePolynomial{B,T,X,N}, ImmutableDensePolynomial{B,T,X,M}(xs)) diff --git a/src/polynomial-container-types/mutable-dense-laurent-polynomial.jl b/src/polynomial-container-types/mutable-dense-laurent-polynomial.jl index c26c2f25..ffa70b8b 100644 --- a/src/polynomial-container-types/mutable-dense-laurent-polynomial.jl +++ b/src/polynomial-container-types/mutable-dense-laurent-polynomial.jl @@ -3,7 +3,7 @@ This polynomial type essentially uses an offset vector (`Vector{T}`,`order`) to store the coefficients of a polynomial relative to the basis `B` with indeterminate `X`. -The typical offset is to have `0` as the order, but, say, to accomodate Laurent polynomials, or more efficient storage of basis elements any order may be specified. +The typical offset is to have `0` as the order, but, say, to accommodate Laurent polynomials, or more efficient storage of basis elements any order may be specified. This type trims trailing zeros and the leading zeros on construction. diff --git a/src/polynomials/standard-basis/immutable-polynomial.jl b/src/polynomials/standard-basis/immutable-polynomial.jl index 7da9e13b..4dbf60b8 100644 --- a/src/polynomials/standard-basis/immutable-polynomial.jl +++ b/src/polynomials/standard-basis/immutable-polynomial.jl @@ -114,7 +114,7 @@ end # julia> @time Base.power_by_squaring(p,15); # 0.000145 seconds (7 allocations: 6.547 KiB) -# This is not inferrable, as `n` is not a compile time constant +# This is not inferable, as `n` is not a compile time constant Base.:^(p::ImmutablePolynomial, n::Integer) = immutable_power(p, n) function immutable_power(p::ImmutablePolynomial{T,X,N}, n::Integer) where {T,X,N} iszero(p) && return p diff --git a/src/polynomials/standard-basis/standard-basis.jl b/src/polynomials/standard-basis/standard-basis.jl index fcd8d48c..c8169f49 100644 --- a/src/polynomials/standard-basis/standard-basis.jl +++ b/src/polynomials/standard-basis/standard-basis.jl @@ -312,13 +312,13 @@ function _gcd_noda_sasaki(a::Vector{T}, b::Vector{S}; tol = atol + rtol # determine the degree of GCD as the nullity of the Sylvester matrix - # this computation can be replaced by simply setting nd = 1, in which case the Sylvester matrix is not formed + # this computation can be replaced by simply setting nᵣ = 1, in which case the Sylvester matrix is not formed - nd = na1 + nb1 - 2 - rank([NGCD.convmtx(a1,nb1-1) NGCD.convmtx(b1,na1-1)], atol = tol) # julia 1.1 - nd == 0 && (return [one(R)]) + nᵣ = na1 + nb1 - 2 - rank([NGCD.convmtx(a1,nb1-1) NGCD.convmtx(b1,na1-1)], atol = tol) # julia 1.1 + nᵣ == 0 && (return [one(R)]) sc = one(R) - while na1 > nd + while na1 > nᵣ na1 < nb1 && ((a1, b1, na1, nb1) = (b1, a1, nb1, na1)) @inbounds for i in na1:-1:nb1 s = -a1[i] / b1[nb1]