Skip to content

Commit

Permalink
Extend evaluate on AbstractArray, instead of Array (#167)
Browse files Browse the repository at this point in the history
* Adds evaluate of TaylorN in AbstractArrays (e.g. IntervalBox)

* Fix an ambiguity introduced

* Remove annotation as suggested
  • Loading branch information
lbenet authored May 30, 2018
1 parent c0d4859 commit c18f779
Show file tree
Hide file tree
Showing 2 changed files with 3 additions and 2 deletions.
3 changes: 1 addition & 2 deletions src/evaluate.jl
Original file line number Diff line number Diff line change
Expand Up @@ -264,8 +264,7 @@ function evaluate(a::TaylorN{T}, vals::NTuple{N,S}) where
return sum( sort!(suma, by=abs2) )
end

evaluate(a::TaylorN{T}, vals::Array{S,1}) where
{T<:Number, S<:NumberNotSeriesN} = evaluate(a, (vals...,))
evaluate(a::TaylorN, vals) = evaluate(a, (vals...,))

evaluate(a::TaylorN, v, vals...) = evaluate(a, (v, vals...,))

Expand Down
2 changes: 2 additions & 0 deletions test/intervals.jl
Original file line number Diff line number Diff line change
Expand Up @@ -37,5 +37,7 @@ end
for ind in eachindex((p5(x,-b)).coeffs)
@test all(((p5(x,-b)).coeffs[ind]).coeffs .⊆ (((x-b)^5).coeffs[ind]).coeffs)
end
@test evaluate(p4(x,-b), IntervalBox(a,b)) == p4(a, b)
@test (p5(x,-b))(IntervalBox(a,b)) == p5(a, b)

end

0 comments on commit c18f779

Please sign in to comment.