Skip to content

Commit

Permalink
Compatibility with NLboxsolve.jl
Browse files Browse the repository at this point in the history
  • Loading branch information
RJDennis committed Dec 24, 2021
1 parent cd4b26d commit def887a
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 4 deletions.
2 changes: 1 addition & 1 deletion Project.toml
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
name = "PiecewiseLinearApprox"
uuid = "fcfa6960-8e2e-11e9-2cde-29dd09221fb3"
authors = ["Richard Dennis <richard.dennis@glasgow.ac.uk>"]
version = "0.1.6"
version = "0.1.7"

[compat]
julia = "^1.1"
Expand Down
6 changes: 3 additions & 3 deletions src/piecewise_linear.jl
Original file line number Diff line number Diff line change
Expand Up @@ -46,14 +46,14 @@ const linear_nodes = piecewise_linear_nodes

function bracket_nodes(x::Array{T,1},point::R) where {T <: AbstractFloat,R<:Number}

if point <= x[1]
if real(point) <= x[1] # Real is used because complex numbers are occasionally used in NLboxsolve.jl
return (1,2)
elseif point >= x[end]
elseif real(point) >= x[end]
return (length(x) - 1, length(x))
else
y = 0
for i in x
if i < point
if i < real(point)
y += 1
else
break
Expand Down

0 comments on commit def887a

Please sign in to comment.