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

Fixes for Julia 1.0 #15

Open
wants to merge 1 commit into
base: master
Choose a base branch
from
Open
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
8 changes: 5 additions & 3 deletions .travis.yml
Original file line number Diff line number Diff line change
Expand Up @@ -5,9 +5,11 @@ os:
- osx

julia:
- 0.4
- 0.5
- 0.6
- 1.0
- 1.1
- 1.2
- 1.3
- 1.4
- nightly

matrix:
Expand Down
138 changes: 138 additions & 0 deletions Manifest.toml
Original file line number Diff line number Diff line change
@@ -0,0 +1,138 @@
[[Base64]]
uuid = "2a0f44e3-6c83-55bd-87e4-b1978d98bd5f"

[[BinaryProvider]]
deps = ["Libdl", "Logging", "SHA"]
git-tree-sha1 = "ecdec412a9abc8db54c0efc5548c64dfce072058"
uuid = "b99e7846-7c00-51b0-8f62-c81ae34c0232"
version = "0.5.10"

[[Compat]]
deps = ["Base64", "Dates", "DelimitedFiles", "Distributed", "InteractiveUtils", "LibGit2", "Libdl", "LinearAlgebra", "Markdown", "Mmap", "Pkg", "Printf", "REPL", "Random", "SHA", "Serialization", "SharedArrays", "Sockets", "SparseArrays", "Statistics", "Test", "UUIDs", "Unicode"]
git-tree-sha1 = "7c7f4cda0d58ec999189d70f5ee500348c4b4df1"
uuid = "34da2185-b29b-5c13-b0c7-acf172513d20"
version = "3.16.0"

[[Dates]]
deps = ["Printf"]
uuid = "ade2ca70-3891-5945-98fb-dc099432e06a"

[[DelimitedFiles]]
deps = ["Mmap"]
uuid = "8bb1440f-4735-579b-a4ab-409b98df4dab"

[[Distributed]]
deps = ["LinearAlgebra", "Random", "Serialization", "Sockets"]
uuid = "8ba89e20-285c-5b6f-9357-94700520ee1b"

[[ExprTools]]
git-tree-sha1 = "7fce513fcda766962ff67c5596cb16c463dfd371"
uuid = "e2ba6199-217a-4e67-a87a-7c52f15ade04"
version = "0.1.2"

[[EzXML]]
deps = ["BinaryProvider", "Libdl", "Printf"]
git-tree-sha1 = "ed53ce1ddb862193b2bd3851dfa108513aab2d5c"
uuid = "8f5d6c58-4d21-5cfd-889c-e3ad7ee6a615"
version = "1.0.0"

[[InteractiveUtils]]
deps = ["LinearAlgebra", "Markdown"]
uuid = "b77e0a4c-d291-57a0-90e8-8db25a27a240"

[[Intervals]]
deps = ["Dates", "Printf", "RecipesBase", "Serialization", "TimeZones"]
git-tree-sha1 = "9da845579d1dce4ce5118008c3fe6df17260bb46"
uuid = "d8418881-c3e1-53bb-8760-2df7ec849ed5"
version = "1.4.2"

[[LibGit2]]
uuid = "76f85450-5226-5b5a-8eaa-529ad045b433"

[[Libdl]]
uuid = "8f399da3-3557-5675-b5ff-fb832c97cbdb"

[[LinearAlgebra]]
deps = ["Libdl"]
uuid = "37e2e46d-f89d-539d-b4ee-838fcccc9c8e"

[[Logging]]
uuid = "56ddb016-857b-54e1-b83d-db4d58db5568"

[[Markdown]]
deps = ["Base64"]
uuid = "d6f4376e-aef5-505a-96c1-9c027394607a"

[[Mmap]]
uuid = "a63ad114-7e13-5084-954f-fe012c677804"

[[Mocking]]
deps = ["ExprTools"]
git-tree-sha1 = "916b850daad0d46b8c71f65f719c49957e9513ed"
uuid = "78c3b35d-d492-501b-9361-3d52fe80e533"
version = "0.7.1"

[[Pkg]]
deps = ["Dates", "LibGit2", "Markdown", "Printf", "REPL", "Random", "SHA", "UUIDs"]
uuid = "44cfe95a-1eb2-52ea-b672-e2afdf69b78f"

[[Polynomials]]
deps = ["Intervals", "LinearAlgebra", "RecipesBase"]
git-tree-sha1 = "a88e0eddef9202b651f4b60b37b59ca67bb49516"
uuid = "f27b6e38-b328-58d1-80ce-0feddd5e7a45"
version = "0.7.0"

[[Printf]]
deps = ["Unicode"]
uuid = "de0858da-6303-5e67-8744-51eddeeeb8d7"

[[REPL]]
deps = ["InteractiveUtils", "Markdown", "Sockets"]
uuid = "3fa0cd96-eef1-5676-8a61-b3b8758bbffb"

[[Random]]
deps = ["Serialization"]
uuid = "9a3f8284-a2c9-5f02-9a11-845980a1fd5c"

[[RecipesBase]]
git-tree-sha1 = "6ee6c35fe69e79e17c455a386c1ccdc66d9f7da4"
uuid = "3cdcf5f2-1ef4-517c-9805-6587b60abb01"
version = "1.1.0"

[[SHA]]
uuid = "ea8e919c-243c-51af-8825-aaa63cd721ce"

[[Serialization]]
uuid = "9e88b42a-f829-5b0c-bbe9-9e923198166b"

[[SharedArrays]]
deps = ["Distributed", "Mmap", "Random", "Serialization"]
uuid = "1a1011a3-84de-559e-8e89-a11a2f7dc383"

[[Sockets]]
uuid = "6462fe0b-24de-5631-8697-dd941f90decc"

[[SparseArrays]]
deps = ["LinearAlgebra", "Random"]
uuid = "2f01184e-e22b-5df5-ae63-d93ebab69eaf"

[[Statistics]]
deps = ["LinearAlgebra", "SparseArrays"]
uuid = "10745b16-79ce-11e8-11f9-7d13ad32a3b2"

[[Test]]
deps = ["Distributed", "InteractiveUtils", "Logging", "Random"]
uuid = "8dfed614-e22c-5e08-85e1-65c5234f0b40"

[[TimeZones]]
deps = ["Dates", "EzXML", "Mocking", "Pkg", "Printf", "RecipesBase", "Serialization", "Unicode"]
git-tree-sha1 = "338ddbb2b9b50a9a423ba6c3fad1824553535988"
uuid = "f269a46b-ccf7-5d73-abea-4c690281aa53"
version = "1.3.2"

[[UUIDs]]
deps = ["Random"]
uuid = "cf7118a7-6976-5b1a-9a39-7adc72f591a4"

[[Unicode]]
uuid = "4ec0a83e-493e-50e2-b9ac-8f72acf5a8f5"
25 changes: 25 additions & 0 deletions Project.toml
Original file line number Diff line number Diff line change
@@ -0,0 +1,25 @@
name = "RationalFunctions"
uuid = "a89fc88f-fc1e-5208-8949-7a3f8ddd21cd"
authors = ["Arda Aytekin <[email protected]>"]
version = "0.1.1"

[deps]
Compat = "34da2185-b29b-5c13-b0c7-acf172513d20"
LinearAlgebra = "37e2e46d-f89d-539d-b4ee-838fcccc9c8e"
Polynomials = "f27b6e38-b328-58d1-80ce-0feddd5e7a45"
RecipesBase = "3cdcf5f2-1ef4-517c-9805-6587b60abb01"

[compat]
Compat = "≥ 0.8.0"
GR = "≥ 0.19.0"
Plots = "≥ 0.8.2"
Polynomials = "≥ 0.7.0"
julia = "≥ 1.0.5"

[extras]
GR = "28b8d3ca-fb5f-59d9-8090-bfdbd6d07a71"
Plots = "91a5bcdd-55d7-5caf-9e0b-520d859cae80"
Test = "8dfed614-e22c-5e08-85e1-65c5234f0b40"

[targets]
test = ["GR", "Plots", "Test"]
4 changes: 0 additions & 4 deletions REQUIRE

This file was deleted.

53 changes: 20 additions & 33 deletions appveyor.yml
Original file line number Diff line number Diff line change
@@ -1,55 +1,42 @@
environment:
matrix:
- platform: x86
julia: 0.4
link: "julialang/bin/winnt/x86/0.4/julia-0.4-latest-win32.exe"
- platform: x86
julia: 0.5
link: "julialang/bin/winnt/x86/0.5/julia-0.5-latest-win32.exe"
- platform: x86
julia: 0.6
link: "julialang/bin/winnt/x86/0.6/julia-0.6-latest-win32.exe"
- platform: x86
julia: nightly
link: "julianightlies/bin/winnt/x86/julia-latest-win32.exe"
- platform: x64
julia: 0.4
link: "julialang/bin/winnt/x64/0.4/julia-0.4-latest-win64.exe"
- platform: x64
julia: 0.5
link: "julialang/bin/winnt/x64/0.5/julia-0.5-latest-win64.exe"
- platform: x64
julia: 0.6
link: "julialang/bin/winnt/x64/0.6/julia-0.6-latest-win64.exe"
- platform: x64
julia: nightly
link: "julianightlies/bin/winnt/x64/julia-latest-win64.exe"
- julia_version: 1.0
- julia_version: 1.1
- julia_version: 1.2
- julia_version: 1.3
- julia_version: 1.4
- julia_version: nightly

platform:
- x86 # 32-bit
- x64 # 64-bit

matrix:
fast_finish: true
allow_failures:
- julia: nightly

branches:
only:
- master
- /release-.*/

notifications:
- provider: Email
on_build_success: false
on_build_failure: false
on_build_status_changed: false

install:
- ps: "[System.Net.ServicePointManager]::SecurityProtocol = [System.Net.SecurityProtocolType]::Tls12"
- ps: (new-object net.webclient).DownloadFile(
$("http://s3.amazonaws.com/"+$env:link),
"C:\projects\julia-binary.exe")
- C:\projects\julia-binary.exe /S /D=C:\projects\julia
- ps: iex ((new-object net.webclient).DownloadString("https://raw.githubusercontent.com/JuliaCI/Appveyor.jl/version-1/bin/install.ps1"))

build_script:
- IF EXIST .git\shallow (git fetch --unshallow)
- C:\projects\julia\bin\julia -e "versioninfo();
Pkg.clone(pwd(), \"RationalFunctions\"); Pkg.build(\"RationalFunctions\")"
- echo "%JL_BUILD_SCRIPT%"
- C:\julia\bin\julia -e "%JL_BUILD_SCRIPT%"

test_script:
- C:\projects\julia\bin\julia -e "Pkg.test(\"RationalFunctions\")"
- echo "%JL_TEST_SCRIPT%"
- C:\julia\bin\julia -e "%JL_TEST_SCRIPT%"
- C:\projects\julia\bin\julia -e "Pkg.dir(\"RationalFunctions\") |> println" > folder.txt
- set /p TEST_FOLDER=<folder.txt
- move %TEST_FOLDER%\test\test-plot.png test-plot-win-%PLATFORM%-%JULIA%.png
Expand Down
8 changes: 5 additions & 3 deletions src/RationalFunctions.jl
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@ module RationalFunctions

using Compat
using Polynomials
using LinearAlgebra
using RecipesBase

# Import conversion and promotion functions for overloading
Expand All @@ -26,13 +27,14 @@ import Base: one, zero
import Base: isapprox, hash, isequal, transpose, conj

# Import mathematical operations for overloading
import Base: +, .+, -, .-, *, .*, dot, inv, /, ./, ==
import Base: +, -, *, inv, /, ==, ^
import LinearAlgebra: dot

# Import functions from Polynomials
import Polynomials: coeffs, degree, roots, variable, Poly
import Polynomials: coeffs, degree, derivative, roots, variable, Polynomial

# Import num/den-type of functions
import Base: num, den, zeros, reduce
import Base: numerator, denominator, zeros, reduce

# Export only the useful functions
export RationalFunction,
Expand Down
39 changes: 20 additions & 19 deletions src/conversions.jl
Original file line number Diff line number Diff line change
@@ -1,28 +1,29 @@
# Relation with itself
promote_rule{T,S,U1,V1,U2,V2}(::Type{RationalFunction{Val{T},Val{S},U1,V1}},
::Type{RationalFunction{Val{T},Val{S},U2,V2}}) =
promote_rule(::Type{RationalFunction{Val{T},Val{S},U1,V1}},
::Type{RationalFunction{Val{T},Val{S},U2,V2}}) where {T,S,U1,V1,U2,V2} =
RationalFunction{Val{T},Val{S},promote_type(U1,U2),promote_type(V1,V2)}
convert{T,S,U1,V1,U2,V2}(::Type{RationalFunction{Val{T},Val{S},U1,V1}},
r::RationalFunction{Val{T},Val{S},U2,V2}) =
RationalFunction(convert(Poly{U1}, r.num), convert(Poly{V1}, r.den), Val{S})
convert{T,S,U,V}(::Type{RationalFunction{Val{T},Val{S},U,V}},
r::RationalFunction{Val{T},Val{S},U,V}) = r
convert(::Type{RationalFunction{Val{T},Val{S},U1,V1}},
r::RationalFunction{Val{T},Val{S},U2,V2}) where {T,S,U1,V1,U2,V2} =
RationalFunction(convert(Polynomial{U1}, r.num), convert(Polynomial{V1}, r.den), Val{S})
convert(::Type{RationalFunction{Val{T},Val{S},U,V}},
r::RationalFunction{Val{T},Val{S},U,V}) where {T,S,U,V} = r
# Conversion between :conj and :nonc RF's (related to #2)
convert{T,S1,S2,U1,V1,U2,V2}(::Type{RationalFunction{Val{T},Val{S1},U1,V1}},
r::RationalFunction{Val{T},Val{S2},U2,V2}) =
RationalFunction(convert(Poly{U1}, conj(r.num)), convert(Poly{V1}, conj(r.den)),
convert(::Type{RationalFunction{Val{T},Val{S1},U1,V1}},
r::RationalFunction{Val{T},Val{S2},U2,V2}) where {T,S1,S2,U1,V1,U2,V2} =
RationalFunction(convert(Polynomial{U1}, conj(r.num)), convert(Polynomial{V1}, conj(r.den)),
Val{S1})

# Relation with numbers
promote_rule{T,S,U,V,Y<:Number}(::Type{RationalFunction{Val{T},Val{S},U,V}}, ::Type{Y}) =
RationalFunction{Val{T},Val{S},promote_type(U,Y),promote_type(V,Y)}
convert{T,S,U,V}(::Type{RationalFunction{Val{T},Val{S},U,V}}, n::Number) =
RationalFunction(Poly(U[n], T), Poly([one(V)], T), Val{S})
promote_rule(::Type{RationalFunction{Val{T},Val{S},U,V}}, ::Type{Y}) where
{T,S,U,V,Y<:Number} = RationalFunction{Val{T},Val{S},promote_type(U,Y),promote_type(V,Y)}
convert(::Type{RationalFunction{Val{T},Val{S},U,V}}, n::Number) where {T,S,U,V} =
RationalFunction(Polynomial(U[n], T), Polynomial([one(V)], T), Val{S})

# Relation with polynomials
promote_rule{T,S,U,V,Y<:Number}(::Type{RationalFunction{Val{T},Val{S},U,V}},
::Type{Poly{Y}}) = RationalFunction{Val{T},Val{S},promote_type(U,Y),promote_type(V,Y)}
function convert{T,S,U,V}(::Type{RationalFunction{Val{T},Val{S},U,V}}, p::Poly)
newpoly = convert(Poly{U}, p)
RationalFunction(newpoly, Poly([one(V)], T), Val{S})
promote_rule(::Type{RationalFunction{Val{T},Val{S},U,V}},
::Type{Polynomial{Y}}) where {T,S,U,V,Y<:Number} =
RationalFunction{Val{T},Val{S},promote_type(U,Y),promote_type(V,Y)}
function convert(::Type{RationalFunction{Val{T},Val{S},U,V}}, p::Polynomial) where {T,S,U,V}
newpoly = convert(Polynomial{U}, p)
RationalFunction(newpoly, Polynomial([one(V)], T), Val{S})
end
Loading