当我需要一个向量时,如何使用矩阵?

时间:2016-07-04 09:27:14

标签: c#

我必须对f(x,y)做一个iterpolation,所以我有一个双[,]。 对于双三次样条插值,我使用alglib。

public static int Main(string[] args)
{
    //
    // We use bilinear spline to interpolate f(x,y)=x^2+2*y^2 sampled 
    // at (x,y) from [0.0, 0.5, 1.0] X [0.0, 1.0].
    //
    double[] x = new double[]{0.0,0.5,1.0};
    double[] y = new double[]{0.0,1.0};
    double[] f = new double[]{0.00,0.25,1.00,2.00,2.25,3.00};
    double vx = 0.25;
    double vy = 0.50;
    double v;
    double dx;
    double dy;
    double dxy;
    alglib.spline2dinterpolant s;

    // build spline
    alglib.spline2dbuildbicubicv(x, 3, y, 2, f, 1, out s);

    // calculate S(0.25,0.50)
    v = alglib.spline2dcalc(s, vx, vy);

正如您在alglib.spline2dbuildbicubicv的参数中看到的,f是double []。我需要用may f double [,]来应用它。

我该如何解决这个问题?

0 个答案:

没有答案