pacta_sunt_servanda
pacta_sunt_servanda

Reputation: 734

kriging approximation with ILNumerics F#

I need to estimate a multivariate function, known from discrete scattered data. I am using ILNumerics interpolation toolbox for that.

I have the following code to test the library from F#:

let inline (!) (x :RetArray<'T>) = Array<'T>.op_Implicit(x)
let inline (!!) (x:Array<'T> ) = InArray<'T>.op_Implicit(x)    
let inline  (!!!) (x:float[]) :InArray<float>  =  x 
                                                  |> InArray.op_Implicit 
let inline (!~) (x:float[]) : Array<float> = x 
                                             |> Array.op_Implicit

let X3 :OutArray<float>= null    
let V (x:'T[]) :Array<'T> = (ILMath.vector<'T> x) |>  Array.op_Implicit 
let X1':Array<float> =   (linspace<float>((!!!)[|-3.0|],(!!!) [|3.0|],(!!!)[|20.0|]))
                            |>  (Seq.toArray >> V )
let Y:Array<float> = sin(X1')|> (Seq.toArray >> V)
let result = kriging( (!!)Y, (!!) X1', (!!) X1', null,  X3) |> (Seq.toArray >> V)

I get the following error:

System.ArgumentException: V must be a non-empty matrix of size [k x n], where n = X.S[1]

I suspect that the internal code tries to evaluate X.S[1] and it fails, in F#, since it would need X.S.[1]; I may be completely wrong, but I would like to know whether the library may also be used from F# or it is pointless even to try.

I have also tried using the KrigingInterpolator class and I get a similar error.

On a side note: do you know any reliable library which performs multivariate interpolation for scattered data, with F#?

Upvotes: 1

Views: 114

Answers (0)

Related Questions