I am trying to execute radial basis interpolation
in Julia
using Surrogates
package.
I have developed the following code:
using Surrogates
function t(train, test)
xy = zip(train[:,1],train[:,2]) |> collect
lb = vcat(minimum(train[:,1]), minimum(train[:,2]))
ub = vcat(maximum(train[:,1]),maximum(train[:,2]))
rbf = Surrogates.RadialBasis(xy, train[:,3], lb, ub)
testing = [rbf(i) for i in test]
return rbf, testing
end
train = [0.0 0.0 4;
0.0 0.0 2;
0.0 0.0 2;
0.0 0.0 2;
0.0 0.0 1;
0.0 0.0 3;
0.0 0.0 6;
0.0 0.0 7]
test = [(1.0, 1.0),
(1.0, 1.0),
(2.0, 2.0),
(2.0, 2.0),
(2.0, 2.0),
(2.0, 2.0),
(2.0, 2.0),
(2.0, 2.0)]
t(train, test)
However, upon executing this above code I am getting the following error:
LinearAlgebra.SingularException(7)
Stacktrace:
[1] checknonsingular at C:\buildbot\worker\package_win64\build\usr\share\julia\stdlib\v1.5\LinearAlgebra\src\factorization.jl:19 [inlined]
[2] checknonsingular at C:\buildbot\worker\package_win64\build\usr\share\julia\stdlib\v1.5\LinearAlgebra\src\factorization.jl:21 [inlined]
[3] 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
[4] #bunchkaufman#142 at C:\buildbot\worker\package_win64\build\usr\share\julia\stdlib\v1.5\LinearAlgebra\src\bunchkaufman.jl:186 [inlined]
[5] #_factorize#94 at C:\buildbot\worker\package_win64\build\usr\share\julia\stdlib\v1.5\LinearAlgebra\src\symmetric.jl:638 [inlined]
[6] _factorize at C:\buildbot\worker\package_win64\build\usr\share\julia\stdlib\v1.5\LinearAlgebra\src\symmetric.jl:636 [inlined]
[7] factorize at C:\buildbot\worker\package_win64\build\usr\share\julia\stdlib\v1.5\LinearAlgebra\src\symmetric.jl:634 [inlined]
[8] \(::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
[9] _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
[10] RadialBasis(::Array{Tuple{Float64,Float64},1}, ::Array{Float64,1}, ::Array{Float64,1}, ::Array{Float64,1}; rad::Surrogates.RadialFunction{Int64,Surrogates.var"#1#2"}, scale_factor::Float64, sparse::Bool) at C:\Users\user\.julia\packages\Surrogates\wJbFN\src\Radials.jl:51
[11] RadialBasis(::Array{Tuple{Float64,Float64},1}, ::Array{Float64,1}, ::Array{Float64,1}, ::Array{Float64,1}) at C:\Users\user\.julia\packages\Surrogates\wJbFN\src\Radials.jl:49
Please suggest solution to resolve this issue!!
Thanks!