Skip to content

Commit

Permalink
Merge pull request #14 from JuliaAlgebra/1.0
Browse files Browse the repository at this point in the history
Make things pass on 1.0
  • Loading branch information
saschatimme authored Aug 9, 2018
2 parents 7408ecf + fdd4495 commit 0e886d6
Show file tree
Hide file tree
Showing 6 changed files with 20 additions and 32 deletions.
12 changes: 6 additions & 6 deletions .travis.yml
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,8 @@ os:
- linux
#- osx
julia:
- 0.6
- 0.7
- 1.0
- nightly
notifications:
email: false
Expand All @@ -13,9 +14,9 @@ git:

## uncomment the following lines to allow failures on nightly julia
## (tests will run but not make your overall status red)
# matrix:
# allow_failures:
# - julia: nightly
matrix:
allow_failures:
- julia: nightly

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

## uncomment the following lines to override the default test script
script:
- julia -e 'Pkg.clone(pwd()); Pkg.build("FixedPolynomials"); Pkg.test("FixedPolynomials"; coverage=true)'

after_success:
# push coverage results to Coveralls
#- julia -e 'cd(Pkg.dir("FixedPolynomials")); Pkg.add("Coverage"); using Coverage; Coveralls.submit(Coveralls.process_folder())'
Expand Down
5 changes: 2 additions & 3 deletions REQUIRE
Original file line number Diff line number Diff line change
@@ -1,3 +1,2 @@
julia 0.6
Compat 0.70
MultivariatePolynomials 0.1.1
julia 0.7
MultivariatePolynomials 0.2
4 changes: 0 additions & 4 deletions src/FixedPolynomials.jl
Original file line number Diff line number Diff line change
Expand Up @@ -8,10 +8,6 @@ module FixedPolynomials
abstract type AbstractPolySystem{T} end
export AbstractPolySystem

using Compat

#import Base: gradient

include("poly.jl")
include("show.jl")
include("convert_promote.jl")
Expand Down
26 changes: 10 additions & 16 deletions src/poly.jl
Original file line number Diff line number Diff line change
Expand Up @@ -148,27 +148,21 @@ degree(p::Polynomial) = sum(exponents(p)[:,1])

==(p::Polynomial, q::Polynomial) = exponents(p) == exponents(q) && coefficients(p) == coefficients(q)
Base.isequal(p::Polynomial, q::Polynomial) = exponents(p) == exponents(q) && coefficients(p) == coefficients(q)
function Base.deepcopy(f::Polynomial{T}) where T
Polynomial{T}(
f.exponents,
f.coefficients,
f.variables,
f.homogenized)
end

# ITERATOR
Base.start(p::Polynomial) = (1, nterms(p))
function Base.next(p::Polynomial, state::Tuple{Int,Int})
(i, limit) = state
newstate = (i + 1, limit)
val = (coefficients(p)[i], exponents(p)[:,i])
function Base.iterate(p::Polynomial, state...)
n = nterms(p)
istate = iterate(1:n, state...)
istate === nothing && return nothing

(val, newstate)
i, state = istate
(coefficients(p)[i], exponents(p)[:,i]), state
end
Base.done(p::Polynomial, state) = state[1] > state[2]
Base.length(p::Polynomial) = nterms(p)
Base.eltype(p::Polynomial{T}) where {T} = T

Base.broadcastable(p::Polynomial) = Ref(p)

@inline pow(x::AbstractFloat, k::Integer) = Base.FastMath.pow_fast(x, k)
#@inline pow(x::Complex, k::Integer) = k == 1 ? x : x^k
# simplified from Base.power_by_squaring
Expand Down Expand Up @@ -339,7 +333,7 @@ Checks whether `p` is a homogenous polynomial. Note that this is unaffected from
value of `homogenized(p)`.
"""
function ishomogenous(p::Polynomial)
monomials_degree = Compat.sum(exponents(p), dims=1)
monomials_degree = sum(exponents(p), dims=1)
max_deg = monomials_degree[1]
all(x -> x == max_deg, monomials_degree)
end
Expand All @@ -354,7 +348,7 @@ function homogenize(p::Polynomial, variable::Symbol=:x0; respect_homogenous=true
if p.homogenized || (respect_homogenous && ishomogenous(p))
p
else
monomials_degree = Compat.sum(exponents(p), dims=1)
monomials_degree = sum(exponents(p), dims=1)
max_deg = monomials_degree[1]
Polynomial([max_deg .- monomials_degree; exponents(p)], coefficients(p), [variable; variables(p)], true)
end
Expand Down
3 changes: 1 addition & 2 deletions test/runtests.jl
Original file line number Diff line number Diff line change
@@ -1,6 +1,5 @@
using FixedPolynomials
using Compat.Test
using Compat
using Test

import DynamicPolynomials
const Impl = DynamicPolynomials
Expand Down
2 changes: 1 addition & 1 deletion test/system_test.jl
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
using Compat.LinearAlgebra
using LinearAlgebra

@testset "System" begin
Impl.@polyvar x y z
Expand Down

0 comments on commit 0e886d6

Please sign in to comment.