Skip to content

Commit 61053d4

Browse files
committed
formatted
1 parent b88ae3d commit 61053d4

File tree

6 files changed

+172
-88
lines changed

6 files changed

+172
-88
lines changed

Project.toml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -10,9 +10,9 @@ LinearAlgebra = "37e2e46d-f89d-539d-b4ee-838fcccc9c8e"
1010
RecipesBase = "3cdcf5f2-1ef4-517c-9805-6587b60abb01"
1111

1212
[compat]
13-
julia = "1"
1413
Intervals = "≥ 0.5, < 1.0"
1514
RecipesBase = "0.7"
15+
julia = "1"
1616

1717
[extras]
1818
LinearAlgebra = "37e2e46d-f89d-539d-b4ee-838fcccc9c8e"

docs/make.jl

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,9 +1,10 @@
11
using Documenter
22
using Polynomials
33

4-
DocMeta.setdocmeta!(Polynomials, :DocTestSetup, :(using Polynomials); recursive=true)
4+
DocMeta.setdocmeta!(Polynomials, :DocTestSetup, :(using Polynomials); recursive = true)
55

6-
makedocs(modules = [Polynomials],
6+
makedocs(
7+
modules = [Polynomials],
78
format = Documenter.HTML(prettyurls = get(ENV, "CI", nothing) == "true"),
89
sitename = "Polynomials.jl",
910
authors = "Jameson Nash, Keno Fischer, and other contributors",

src/abstract.jl

Lines changed: 21 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -11,26 +11,32 @@ An abstract container for various polynomials.
1111
- `coeffs` - The coefficients of the polynomial
1212
- `var` - The indeterminate of the polynomial
1313
"""
14-
abstract type AbstractPolynomial{T <: Number} end
14+
abstract type AbstractPolynomial{T<:Number} end
1515

1616

1717
macro register(name)
1818
poly = esc(name)
1919
quote
20-
Base.convert(::Type{P}, p::P) where {P <: $poly} = p
21-
Base.convert(P::Type{<:$poly}, p::$poly) where {T} = P(p.coeffs, p.var)
22-
Base.promote_rule(::Type{$poly{T}}, ::Type{$poly{S}}) where {T,S} = $poly{promote_type(T, S)}
23-
Base.promote_rule(::Type{$poly{T}}, ::Type{S}) where {T,S <: Number} = $poly{promote_type(T, S)}
24-
25-
function (p::$poly)(x::AbstractVector)
26-
Base.depwarn("Calling p(x::AbstractVector is deprecated. Use p.(x) instead.", Symbol("(p::AbstractPolynomial)"))
27-
return p.(x)
28-
end
29-
30-
$poly(coeffs::AbstractVector{T}, var::SymbolLike = :x) where {T} = $poly{T}(coeffs, Symbol(var))
31-
$poly(n::Number, var = :x) = $poly([n], var)
32-
$poly{T}(n::S, var = :x) where {T,S <: Number} = $poly(T(n), var)
33-
$poly{T}(x::AbstractVector{S}, var = :x) where {T,S <: Number} = $poly(T.(x), var)
20+
Base.convert(::Type{P}, p::P) where {P<:$poly} = p
21+
Base.convert(P::Type{<:$poly}, p::$poly) where {T} = P(p.coeffs, p.var)
22+
Base.promote_rule(::Type{$poly{T}}, ::Type{$poly{S}}) where {T,S} =
23+
$poly{promote_type(T, S)}
24+
Base.promote_rule(::Type{$poly{T}}, ::Type{S}) where {T,S<:Number} =
25+
$poly{promote_type(T, S)}
26+
27+
function (p::$poly)(x::AbstractVector)
28+
Base.depwarn(
29+
"Calling p(x::AbstractVector is deprecated. Use p.(x) instead.",
30+
Symbol("(p::AbstractPolynomial)"),
31+
)
32+
return p.(x)
33+
end
34+
35+
$poly(coeffs::AbstractVector{T}, var::SymbolLike = :x) where {T} =
36+
$poly{T}(coeffs, Symbol(var))
37+
$poly(n::Number, var = :x) = $poly([n], var)
38+
$poly{T}(n::S, var = :x) where {T,S<:Number} = $poly(T(n), var)
39+
$poly{T}(x::AbstractVector{S}, var = :x) where {T,S<:Number} = $poly(T.(x), var)
3440

3541
end
3642
end

0 commit comments

Comments
 (0)