I am trying to run the `Radial basis` from `Surrogates` to perform interpolation with `multiquadricRadial`.
I have created the following script:

``````using Surrogates
using Plots; plotly()

lb = [0.0, 0.0]
ub = [10.0, 10.0]

function f(x)
x1=x
x2=x
sin(x) + cos(x)
end
#Sampling
function sam()
x = range(0, 10.0, length = 9) |> collect
y = range(0, 10.0, length = 9) |> collect
tuple = zip(x,y) |> collect
return tuple
end
xy = sam()
z = f.(xy)

function test_val()
x = range(0, 10.0, length = 101) |> collect
y = range(0, 10.0, length = 101) |> collect
tuple = zip(x,y) |> collect
return tuple
end
arr = test_val()
result_surrogates_radial = [surrogate_rbf(i) for i in arr]

x, y = 1:10, 1:10

p1 = surface(x, y, (x, y) -> surrogate_rbf([x y]))
xs = [a for a in xy]
ys = [a for a in xy]
zs = f.(xy)
scatter!(xs, ys, zs, marker_z=zs, label="Actual Points", title="Surrogates RBF")
``````

This script works when the `rad=linearRadial` but upon changing it to `MultiquadricRadial` it throws the follwoing error:

``````LinearAlgebra.SingularException(9)

Stacktrace:
 checknonsingular at C:\buildbot\worker\package_win64\build\usr\share\julia\stdlib\v1.5\LinearAlgebra\src\factorization.jl:19 [inlined]
 checknonsingular at C:\buildbot\worker\package_win64\build\usr\share\julia\stdlib\v1.5\LinearAlgebra\src\factorization.jl:21 [inlined]
 bunchkaufman!(::LinearAlgebra.Symmetric{Float64,Array{Float64,2}}, ::Bool; check::Bool) at C:\buildbot\worker\package_win64\build\usr\share\julia\stdlib\v1.5\LinearAlgebra\src\bunchkaufman.jl:99
 #bunchkaufman#142 at C:\buildbot\worker\package_win64\build\usr\share\julia\stdlib\v1.5\LinearAlgebra\src\bunchkaufman.jl:186 [inlined]
 #_factorize#94 at C:\buildbot\worker\package_win64\build\usr\share\julia\stdlib\v1.5\LinearAlgebra\src\symmetric.jl:638 [inlined]
 _factorize at C:\buildbot\worker\package_win64\build\usr\share\julia\stdlib\v1.5\LinearAlgebra\src\symmetric.jl:636 [inlined]
 factorize at C:\buildbot\worker\package_win64\build\usr\share\julia\stdlib\v1.5\LinearAlgebra\src\symmetric.jl:634 [inlined]
 \(::LinearAlgebra.Symmetric{Float64,Array{Float64,2}}, ::Array{Float64,1}) at C:\buildbot\worker\package_win64\build\usr\share\julia\stdlib\v1.5\LinearAlgebra\src\symmetric.jl:648
 _calc_coeffs(::Array{Tuple{Float64,Float64},1}, ::Array{Float64,1}, ::Array{Float64,1}, ::Array{Float64,1}, ::Function, ::Int64, ::Float64, ::Bool) at C:\Users\user\.julia\packages\Surrogates\wJbFN\src\Radials.jl:61
 top-level scope at In:24
``````

Please suggest what might be causing this issue?

Thanks!!

Open an issue

1 Like

@ChrisRackauckas thanks for the response, I have opened the issue!!

Aren’t your regressors perfectly correlated? You might want `Iterators.product` instead of zip, or possibly `tuple.(x,y')`

2 Likes