Skip to content

Commit 0e886d6

Browse files
authored
Merge pull request #14 from JuliaAlgebra/1.0
Make things pass on 1.0
2 parents 7408ecf + fdd4495 commit 0e886d6

File tree

6 files changed

+20
-32
lines changed

6 files changed

+20
-32
lines changed

.travis.yml

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,8 @@ os:
44
- linux
55
#- osx
66
julia:
7-
- 0.6
7+
- 0.7
8+
- 1.0
89
- nightly
910
notifications:
1011
email: false
@@ -13,9 +14,9 @@ git:
1314

1415
## uncomment the following lines to allow failures on nightly julia
1516
## (tests will run but not make your overall status red)
16-
# matrix:
17-
# allow_failures:
18-
# - julia: nightly
17+
matrix:
18+
allow_failures:
19+
- julia: nightly
1920

2021
## uncomment and modify the following lines to manually install system packages
2122
#addons:
@@ -26,8 +27,7 @@ git:
2627
# - if [ $TRAVIS_OS_NAME = osx ]; then brew install gcc; fi
2728

2829
## uncomment the following lines to override the default test script
29-
script:
30-
- julia -e 'Pkg.clone(pwd()); Pkg.build("FixedPolynomials"); Pkg.test("FixedPolynomials"; coverage=true)'
30+
3131
after_success:
3232
# push coverage results to Coveralls
3333
#- julia -e 'cd(Pkg.dir("FixedPolynomials")); Pkg.add("Coverage"); using Coverage; Coveralls.submit(Coveralls.process_folder())'

REQUIRE

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,2 @@
1-
julia 0.6
2-
Compat 0.70
3-
MultivariatePolynomials 0.1.1
1+
julia 0.7
2+
MultivariatePolynomials 0.2

src/FixedPolynomials.jl

Lines changed: 0 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -8,10 +8,6 @@ module FixedPolynomials
88
abstract type AbstractPolySystem{T} end
99
export AbstractPolySystem
1010

11-
using Compat
12-
13-
#import Base: gradient
14-
1511
include("poly.jl")
1612
include("show.jl")
1713
include("convert_promote.jl")

src/poly.jl

Lines changed: 10 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -148,27 +148,21 @@ degree(p::Polynomial) = sum(exponents(p)[:,1])
148148

149149
==(p::Polynomial, q::Polynomial) = exponents(p) == exponents(q) && coefficients(p) == coefficients(q)
150150
Base.isequal(p::Polynomial, q::Polynomial) = exponents(p) == exponents(q) && coefficients(p) == coefficients(q)
151-
function Base.deepcopy(f::Polynomial{T}) where T
152-
Polynomial{T}(
153-
f.exponents,
154-
f.coefficients,
155-
f.variables,
156-
f.homogenized)
157-
end
158151

159152
# ITERATOR
160-
Base.start(p::Polynomial) = (1, nterms(p))
161-
function Base.next(p::Polynomial, state::Tuple{Int,Int})
162-
(i, limit) = state
163-
newstate = (i + 1, limit)
164-
val = (coefficients(p)[i], exponents(p)[:,i])
153+
function Base.iterate(p::Polynomial, state...)
154+
n = nterms(p)
155+
istate = iterate(1:n, state...)
156+
istate === nothing && return nothing
165157

166-
(val, newstate)
158+
i, state = istate
159+
(coefficients(p)[i], exponents(p)[:,i]), state
167160
end
168-
Base.done(p::Polynomial, state) = state[1] > state[2]
169161
Base.length(p::Polynomial) = nterms(p)
170162
Base.eltype(p::Polynomial{T}) where {T} = T
171163

164+
Base.broadcastable(p::Polynomial) = Ref(p)
165+
172166
@inline pow(x::AbstractFloat, k::Integer) = Base.FastMath.pow_fast(x, k)
173167
#@inline pow(x::Complex, k::Integer) = k == 1 ? x : x^k
174168
# simplified from Base.power_by_squaring
@@ -339,7 +333,7 @@ Checks whether `p` is a homogenous polynomial. Note that this is unaffected from
339333
value of `homogenized(p)`.
340334
"""
341335
function ishomogenous(p::Polynomial)
342-
monomials_degree = Compat.sum(exponents(p), dims=1)
336+
monomials_degree = sum(exponents(p), dims=1)
343337
max_deg = monomials_degree[1]
344338
all(x -> x == max_deg, monomials_degree)
345339
end
@@ -354,7 +348,7 @@ function homogenize(p::Polynomial, variable::Symbol=:x0; respect_homogenous=true
354348
if p.homogenized || (respect_homogenous && ishomogenous(p))
355349
p
356350
else
357-
monomials_degree = Compat.sum(exponents(p), dims=1)
351+
monomials_degree = sum(exponents(p), dims=1)
358352
max_deg = monomials_degree[1]
359353
Polynomial([max_deg .- monomials_degree; exponents(p)], coefficients(p), [variable; variables(p)], true)
360354
end

test/runtests.jl

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,5 @@
11
using FixedPolynomials
2-
using Compat.Test
3-
using Compat
2+
using Test
43

54
import DynamicPolynomials
65
const Impl = DynamicPolynomials

test/system_test.jl

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
using Compat.LinearAlgebra
1+
using LinearAlgebra
22

33
@testset "System" begin
44
Impl.@polyvar x y z

0 commit comments

Comments
 (0)