Skip to content

Commit 99b3da1

Browse files
authored
try github actions for CI (#298)
* try github actions for CI * fix doctests
1 parent fa05447 commit 99b3da1

File tree

7 files changed

+105
-74
lines changed

7 files changed

+105
-74
lines changed

.github/workflows/ci.yml

Lines changed: 68 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,68 @@
1+
name: CI
2+
on:
3+
pull_request:
4+
branches:
5+
- master
6+
push:
7+
branches:
8+
- master
9+
tags: '*'
10+
jobs:
11+
test:
12+
name: Julia ${{ matrix.version }} - ${{ matrix.os }} - ${{ matrix.arch }} - ${{ github.event_name }}
13+
runs-on: ${{ matrix.os }}
14+
strategy:
15+
fail-fast: false
16+
matrix:
17+
version:
18+
- '1.0' # Replace this with the minimum Julia version that your package supports. E.g. if your package requires Julia 1.5 or higher, change this to '1.5'.
19+
- '1' # Leave this line unchanged. '1' will automatically expand to the latest stable 1.x release of Julia.
20+
- 'nightly'
21+
os:
22+
- ubuntu-latest
23+
arch:
24+
- x64
25+
steps:
26+
- uses: actions/checkout@v2
27+
- uses: julia-actions/setup-julia@v1
28+
with:
29+
version: ${{ matrix.version }}
30+
arch: ${{ matrix.arch }}
31+
- uses: actions/cache@v1
32+
env:
33+
cache-name: cache-artifacts
34+
with:
35+
path: ~/.julia/artifacts
36+
key: ${{ runner.os }}-test-${{ env.cache-name }}-${{ hashFiles('**/Project.toml') }}
37+
restore-keys: |
38+
${{ runner.os }}-test-${{ env.cache-name }}-
39+
${{ runner.os }}-test-
40+
${{ runner.os }}-
41+
- uses: julia-actions/julia-buildpkg@v1
42+
- uses: julia-actions/julia-runtest@v1
43+
- uses: julia-actions/julia-processcoverage@v1
44+
- uses: codecov/codecov-action@v1
45+
with:
46+
file: lcov.info
47+
docs:
48+
name: Documentation
49+
runs-on: ubuntu-latest
50+
steps:
51+
- uses: actions/checkout@v2
52+
- uses: julia-actions/setup-julia@v1
53+
with:
54+
version: '1'
55+
- run: |
56+
julia --project=docs -e '
57+
using Pkg
58+
Pkg.develop(PackageSpec(path=pwd()))
59+
Pkg.instantiate()'
60+
- run: |
61+
julia --project=docs -e '
62+
using Documenter: doctest
63+
using Polynomials
64+
doctest(Polynomials)'
65+
- run: julia --project=docs docs/make.jl
66+
env:
67+
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
68+
DOCUMENTER_KEY: ${{ secrets.DOCUMENTER_KEY }}

.travis.yml

Lines changed: 0 additions & 46 deletions
This file was deleted.

Project.toml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@ name = "Polynomials"
22
uuid = "f27b6e38-b328-58d1-80ce-0feddd5e7a45"
33
license = "MIT"
44
author = "JuliaMath"
5-
version = "1.1.12"
5+
version = "1.1.13"
66

77
[deps]
88
GenericLinearAlgebra = "14197337-ba66-59df-a3e3-ca00e7dcff7a"

docs/Project.toml

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,3 @@
1-
21
[deps]
32
Documenter = "e30172f5-a6a5-5a46-863b-614d45cd2de4"
43
Plots = "91a5bcdd-55d7-5caf-9e0b-520d859cae80"

src/pade.jl

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -91,6 +91,7 @@ Evaluate the Pade approximant at the given point.
9191
julia> using Polynomials, Polynomials.PolyCompat, SpecialFunctions
9292
9393
94+
9495
julia> p = Polynomial(@.(1 // BigInt(gamma(1:17))));
9596
9697

src/polynomials/LaurentPolynomial.jl

Lines changed: 18 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -13,7 +13,7 @@ Laurent polynomials and standard basis polynomials promote to Laurent polynomi
1313
Integration will fail if there is a `x⁻¹` term in the polynomial.
1414
1515
Example:
16-
```jldoctest
16+
```jldoctest laurent
1717
julia> using Polynomials
1818
1919
julia> P = LaurentPolynomial
@@ -74,7 +74,7 @@ struct LaurentPolynomial{T <: Number} <: StandardBasisPolynomial{T}
7474
m::Int,
7575
var::Symbol=:x) where {T <: Number}
7676

77-
77+
7878
# trim zeros from front and back
7979
lnz = findlast(!iszero, coeffs)
8080
fnz = findfirst(!iszero, coeffs)
@@ -184,7 +184,7 @@ Base.:(==)(p1::LaurentPolynomial, p2::LaurentPolynomial) =
184184
check_same_variable(p1, p2) && (degreerange(p1) == degreerange(p2)) && (coeffs(p1) == coeffs(p2))
185185
Base.hash(p::LaurentPolynomial, h::UInt) = hash(p.var, hash(degreerange(p), hash(coeffs(p), h)))
186186

187-
isconstant(p::LaurentPolynomial) = iszero(lastindex(p)) && iszero(firstindex(p))
187+
isconstant(p::LaurentPolynomial) = iszero(lastindex(p)) && iszero(firstindex(p))
188188
basis(P::Type{<:LaurentPolynomial{T}}, n::Int, var::SymbolLike=:x) where{T} = LaurentPolynomial(ones(T,1), n, var)
189189
basis(P::Type{LaurentPolynomial}, n::Int, var::SymbolLike=:x) = LaurentPolynomial(ones(Float64, 1), n, var)
190190

@@ -307,12 +307,15 @@ end
307307
This satisfies `conj(p(x)) = conj(p)(conj(x)) = p̄(conj(x))` or `p̄(x) = (conj ∘ p ∘ conj)(x)`
308308
309309
Examples
310-
```jldoctest
310+
311+
```jldoctest laurent
312+
julia> using Polynomials;
313+
311314
julia> z = variable(LaurentPolynomial, :z)
312315
LaurentPolynomial(z)
313316
314-
julia> p = LaurentPolynomial([im, 1+im, 2 + im], -1:1, :z)
315-
LaurentPolynomial(im*z⁻¹ + (1 + 1im) + (2 + 1im)*z)
317+
julia> p = LaurentPolynomial([im, 1+im, 2 + im], -1, :z)
318+
LaurentPolynomial(im*z⁻¹ + 1 + im + (2 + im)z)
316319
317320
julia> conj(p)(conj(z)) ≈ conj(p(z))
318321
true
@@ -334,7 +337,9 @@ Call `p̂ = paraconj(p)` and `p̄` = conj(p)`, then this satisfies
334337
335338
Examples:
336339
337-
```jldoctest
340+
```jldoctest laurent
341+
julia> using Polynomials;
342+
338343
julia> z = variable(LaurentPolynomial, :z)
339344
LaurentPolynomial(z)
340345
@@ -372,11 +377,13 @@ This satisfies for *imaginary* `s`: `conj(p(s)) = p̃(s) = (conj ∘ p)(s) = cco
372377
[ref](https://github.com/hurak/PolynomialEquations.jl#symmetrix-conjugate-equation-continuous-time-case)
373378
374379
Examples:
375-
```jldoctest
380+
```jldoctest laurent
381+
julia> using Polynomials;
382+
376383
julia> s = 2im
377384
0 + 2im
378385
379-
julia> p = LaurentPolynomial([im,-1, -im, 1], 1:2, :s)
386+
julia> p = LaurentPolynomial([im,-1, -im, 1], 1, :s)
380387
LaurentPolynomial(im*s - s² - im*s³ + s⁴)
381388
382389
julia> Polynomials.cconj(p)(s) ≈ conj(p(s))
@@ -508,6 +515,8 @@ The roots of a function (Laurent polynomial in this case) `a(z)` are the values
508515
# Example
509516
510517
```julia
518+
julia> using Polynomials;
519+
511520
julia> p = LaurentPolynomial([24,10,-15,0,1],-2:1,:z)
512521
LaurentPolynomial(24*z⁻² + 10*z⁻¹ - 15 + z²)
513522

src/polynomials/multroot.jl

Lines changed: 17 additions & 17 deletions
Original file line numberDiff line numberDiff line change
@@ -15,7 +15,7 @@ to identify roots of polynomials with suspected multiplicities over
1515
1616
Example:
1717
18-
```jldoctest
18+
```
1919
julia> using Polynomials
2020
2121
julia> p = fromroots([sqrt(2), sqrt(2), sqrt(2), 1, 1])
@@ -30,7 +30,7 @@ julia> roots(p)
3030
1.4142350577588885 + 3.72273772278647e-5im
3131
3232
julia> Polynomials.Multroot.multroot(p)
33-
(values = [0.9999999999999993, 1.4142135623730958], multiplicities = [2, 3], κ = 5.218455674370637, ϵ = 2.8736226244218195e-16)
33+
(values = [0.9999999999999993, 1.4142135623730958], multiplicities = [2, 3], κ = 5.218455674370636, ϵ = 2.8736226244218195e-16)
3434
```
3535
3636
The algorithm has two stages. First it uses `pejorative_manifold` to
@@ -60,7 +60,7 @@ multiplicity structure:
6060
recursively, this allows the residual tolerance to scale up to match
6161
increasing numeric errors.
6262
63-
Returns a named tuple with
63+
Returns a named tuple with
6464
6565
* `values`: the identified roots
6666
* `multiplicities`: the corresponding multiplicities
@@ -78,15 +78,15 @@ is misidentified.
7878
"""
7979
function multroot(p::Polynomials.StandardBasisPolynomial{T}; verbose=false,
8080
kwargs...) where {T}
81-
81+
8282
z, l = pejorative_manifold(p; kwargs...)
8383
= pejorative_root(p, z, l)
8484
κ, ϵ = stats(p, z̃, l)
85-
85+
8686
verbose && show_stats(κ, ϵ)
8787

8888
(values = z̃, multiplicities = l, κ = κ, ϵ = ϵ)
89-
89+
9090
end
9191

9292
# The multiplicity structure, `l`, gives rise to a pejorative manifold `Πₗ = {Gₗ(z) | z∈ Cᵐ}`.
@@ -99,11 +99,11 @@ function pejorative_manifold(p::Polynomials.StandardBasisPolynomial{T};
9999
u, v, w, θ′, κ = Polynomials.ngcd(p, derivative(p),
100100
atol=ρ*norm(p), satol = θ*norm(p),
101101
rtol = zT, srtol = zT)
102-
102+
103103
zs = roots(v)
104104
nrts = length(zs)
105105
ls = ones(Int, nrts)
106-
106+
107107
while !Polynomials.isconstant(u)
108108

109109
normp = 1 + norm(u, 2)
@@ -127,7 +127,7 @@ function pejorative_manifold(p::Polynomials.StandardBasisPolynomial{T};
127127
zs, ls # estimate for roots, multiplicities
128128

129129
end
130-
130+
131131
"""
132132
pejorative_root(p, zs, ls; kwargs...)
133133
@@ -158,7 +158,7 @@ function pejorative_root(p, zs::Vector{S}, ls::Vector{Int};
158158

159159
# storage
160160
a = p[2:end]./p[1] # a ~ (p[n-1], p[n-2], ..., p[0])/p[n]
161-
W = Diagonal([min(1, 1/abs(aᵢ)) for aᵢ in a])
161+
W = Diagonal([min(1, 1/abs(aᵢ)) for aᵢ in a])
162162
J = zeros(S, m, n)
163163
G = zeros(S, 1 + m)
164164
Δₖ = zeros(S, n)
@@ -167,37 +167,37 @@ function pejorative_root(p, zs::Vector{S}, ls::Vector{Int};
167167
cvg = false
168168
δₖ₀ = -Inf
169169
for ctr in 1:maxsteps
170-
170+
171171
evalJ!(J, zₖs, ls)
172172
evalG!(G, zₖs, ls)
173-
173+
174174
Δₖ .= (W*J) \ (W*(view(G, 2:1+m) .- a)) # weighted least squares
175175

176176
δₖ₁ = norm(Δₖ, 2)
177177
Δ = δₖ₀ - δₖ₁
178178

179-
if ctr > 10 && δₖ₁ >= δₖ₀
179+
if ctr > 10 && δₖ₁ >= δₖ₀
180180
δₖ₀ < δₖ₁ && @warn "Increasing Δ, terminating search"
181181
cvg = true
182182
break
183183
end
184184

185185
zₖs .-= Δₖ
186186

187-
if δₖ₁^2 <= (δₖ₀ - δₖ₁) * τ
187+
if δₖ₁^2 <= (δₖ₀ - δₖ₁) * τ
188188
cvg = true
189189
break
190190
end
191191

192192
δₖ₀ = δₖ₁
193193
end
194194
verbose && show_stats(stats(p, zₖs, ls)...)
195-
195+
196196
if cvg
197197
return zₖs
198198
else
199199
@info ("""
200-
The multiplicity count may be in error: the initial guess for the roots failed
200+
The multiplicity count may be in error: the initial guess for the roots failed
201201
to converge to a pejorative root.
202202
""")
203203
return(zₘs)
@@ -242,7 +242,7 @@ function evalJ!(J, zs::Vector{T}, ls::Vector) where {T}
242242
for (k, zₖ) in enumerate(zs)
243243
k == j && continue
244244
for i in n-1:-1:1
245-
J[1+i,j] -= zₖ * J[i,j]
245+
J[1+i,j] -= zₖ * J[i,j]
246246
end
247247
end
248248
end

0 commit comments

Comments
 (0)