Skip to content
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

adjust compat; check typos; readme #540

Merged
merged 3 commits into from
Nov 9, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
13 changes: 13 additions & 0 deletions .github/workflows/SpellCheck.yml
Original file line number Diff line number Diff line change
@@ -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
3 changes: 2 additions & 1 deletion Project.toml
Original file line number Diff line number Diff line change
Expand Up @@ -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"
Expand All @@ -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"
Expand Down
2 changes: 1 addition & 1 deletion docs/src/index.md
Original file line number Diff line number Diff line change
Expand Up @@ -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

Expand Down
5 changes: 5 additions & 0 deletions src/Polynomials.jl
Original file line number Diff line number Diff line change
@@ -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
Expand Down
2 changes: 1 addition & 1 deletion src/abstract-polynomial.jl
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
6 changes: 3 additions & 3 deletions src/common.jl
Original file line number Diff line number Diff line change
Expand Up @@ -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

=#
"""
Expand Down Expand Up @@ -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}}
Expand Down Expand Up @@ -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
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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))
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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.

Expand Down
2 changes: 1 addition & 1 deletion src/polynomials/standard-basis/immutable-polynomial.jl
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
8 changes: 4 additions & 4 deletions src/polynomials/standard-basis/standard-basis.jl
Original file line number Diff line number Diff line change
Expand Up @@ -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]
Expand Down
Loading