summaryrefslogtreecommitdiff
path: root/modules/interpolation/tests
diff options
context:
space:
mode:
authorShashank2017-05-29 12:40:26 +0530
committerShashank2017-05-29 12:40:26 +0530
commit0345245e860375a32c9a437c4a9d9cae807134e9 (patch)
treead51ecbfa7bcd3cc5f09834f1bb8c08feaa526a4 /modules/interpolation/tests
downloadscilab_for_xcos_on_cloud-0345245e860375a32c9a437c4a9d9cae807134e9.tar.gz
scilab_for_xcos_on_cloud-0345245e860375a32c9a437c4a9d9cae807134e9.tar.bz2
scilab_for_xcos_on_cloud-0345245e860375a32c9a437c4a9d9cae807134e9.zip
CMSCOPE changed
Diffstat (limited to 'modules/interpolation/tests')
-rwxr-xr-xmodules/interpolation/tests/nonreg_tests/bug_461.dia.ref41
-rwxr-xr-xmodules/interpolation/tests/nonreg_tests/bug_461.tst50
-rwxr-xr-xmodules/interpolation/tests/nonreg_tests/bug_9002.dia.ref139
-rwxr-xr-xmodules/interpolation/tests/nonreg_tests/bug_9002.tst163
-rwxr-xr-xmodules/interpolation/tests/unit_tests/bsplin3val.dia.ref49
-rwxr-xr-xmodules/interpolation/tests/unit_tests/bsplin3val.tst62
-rwxr-xr-xmodules/interpolation/tests/unit_tests/cshep2d.dia.ref21
-rwxr-xr-xmodules/interpolation/tests/unit_tests/cshep2d.tst22
-rwxr-xr-xmodules/interpolation/tests/unit_tests/eval_cshep2d.dia.ref18
-rwxr-xr-xmodules/interpolation/tests/unit_tests/eval_cshep2d.tst20
-rwxr-xr-xmodules/interpolation/tests/unit_tests/interp.dia.ref26
-rwxr-xr-xmodules/interpolation/tests/unit_tests/interp.tst32
-rwxr-xr-xmodules/interpolation/tests/unit_tests/linear_interpn.dia.ref37
-rwxr-xr-xmodules/interpolation/tests/unit_tests/linear_interpn.tst47
-rwxr-xr-xmodules/interpolation/tests/unit_tests/lsq_splin.dia.ref21
-rwxr-xr-xmodules/interpolation/tests/unit_tests/lsq_splin.tst25
-rwxr-xr-xmodules/interpolation/tests/unit_tests/splin.dia.ref37
-rwxr-xr-xmodules/interpolation/tests/unit_tests/splin.tst46
-rwxr-xr-xmodules/interpolation/tests/unit_tests/splin3d.dia.ref24
-rwxr-xr-xmodules/interpolation/tests/unit_tests/splin3d.tst27
20 files changed, 907 insertions, 0 deletions
diff --git a/modules/interpolation/tests/nonreg_tests/bug_461.dia.ref b/modules/interpolation/tests/nonreg_tests/bug_461.dia.ref
new file mode 100755
index 000000000..162a21305
--- /dev/null
+++ b/modules/interpolation/tests/nonreg_tests/bug_461.dia.ref
@@ -0,0 +1,41 @@
+// <-- Non-regression test for bug 461 -->
+//
+// <-- Bugzilla URL -->
+// http://bugzilla.scilab.org/show_bug.cgi?id=461
+//
+// <-- Short Description -->
+// Bug Report Id: 11985200361815216
+// Result of following operations:
+// size(s0)
+// ans =
+// ! 1. 43. !
+//
+// size(s1) // and for s2 and s3
+// ans =
+// ! 43. 1. !
+// s0 is vector-row and s1, s2 s3- vector-colum
+//
+//
+// On Scilab 2.7 with " interp " function
+// The Error Messages are:
+// !--error 5
+// inconsistent column/row dimensions
+// Commands: x=[0. 1.01 2.01 3. 4.02];
+// f=[0. 1. 3.9 8.75 16.5];
+// plot(x,f);
+// d=splin(x,f );
+// ...
+correct=%F;
+x=[0. 1.01 2.01 3. 4.02];
+f=[0. 1. 3.9 8.75 16.5];
+plot(x,f);
+d=splin(x,f );
+xx=0:0.1:4.2;
+[s0,s1,s2,s3]=interp(xx,x,f,d);
+s0=s0';
+s1=s1';
+s2=s2';
+s3=s3';
+result=execstr("plot2d(xx,[s0 s1 s2 s3])","errcatch","n");
+xdel();
+if result<>0 then bugmes();quit;end
diff --git a/modules/interpolation/tests/nonreg_tests/bug_461.tst b/modules/interpolation/tests/nonreg_tests/bug_461.tst
new file mode 100755
index 000000000..17d09f05b
--- /dev/null
+++ b/modules/interpolation/tests/nonreg_tests/bug_461.tst
@@ -0,0 +1,50 @@
+// =============================================================================
+// Scilab ( http://www.scilab.org/ ) - This file is part of Scilab
+// Copyright (C) ????-2008 - INRIA
+//
+// This file is distributed under the same license as the Scilab package.
+// =============================================================================
+
+// <-- Non-regression test for bug 461 -->
+//
+// <-- Bugzilla URL -->
+// http://bugzilla.scilab.org/show_bug.cgi?id=461
+//
+// <-- Short Description -->
+// Bug Report Id: 11985200361815216
+// Result of following operations:
+// size(s0)
+// ans =
+// ! 1. 43. !
+//
+// size(s1) // and for s2 and s3
+// ans =
+// ! 43. 1. !
+// s0 is vector-row and s1, s2 s3- vector-colum
+//
+//
+// On Scilab 2.7 with " interp " function
+// The Error Messages are:
+// !--error 5
+// inconsistent column/row dimensions
+// Commands: x=[0. 1.01 2.01 3. 4.02];
+// f=[0. 1. 3.9 8.75 16.5];
+// plot(x,f);
+// d=splin(x,f );
+// ...
+
+correct=%F;
+x=[0. 1.01 2.01 3. 4.02];
+f=[0. 1. 3.9 8.75 16.5];
+plot(x,f);
+d=splin(x,f );
+xx=0:0.1:4.2;
+[s0,s1,s2,s3]=interp(xx,x,f,d);
+s0=s0';
+s1=s1';
+s2=s2';
+s3=s3';
+result=execstr("plot2d(xx,[s0 s1 s2 s3])","errcatch","n");
+xdel();
+
+if result<>0 then pause,end
diff --git a/modules/interpolation/tests/nonreg_tests/bug_9002.dia.ref b/modules/interpolation/tests/nonreg_tests/bug_9002.dia.ref
new file mode 100755
index 000000000..a95a68cb7
--- /dev/null
+++ b/modules/interpolation/tests/nonreg_tests/bug_9002.dia.ref
@@ -0,0 +1,139 @@
+// =============================================================================
+// Scilab ( http://www.scilab.org/ ) - This file is part of Scilab
+// Copyright (C) 2012 - DIGITEO - Allan CORNET
+//
+// This file is distributed under the same license as the Scilab package.
+// =============================================================================
+// <-- Non-regression test for bug 9002 -->
+//
+// <-- Bugzilla URL -->
+// http://bugzilla.scilab.org/show_bug.cgi?id=9002
+//
+// <-- Short Description -->
+// linear_interpn, splin2d/interp2d, ... functions ignored imaginary part of input arguments
+// test with bsplin3val
+//
+deff("v=f(x,y,z)","v=cos(x).*sin(y).*cos(z)");
+deff("v=fx(x,y,z)","v=-sin(x).*sin(y).*cos(z)");
+deff("v=fxy(x,y,z)","v=-sin(x).*cos(y).*cos(z)");
+deff("v=fxyz(x,y,z)","v=sin(x).*cos(y).*sin(z)");
+deff("v=fxxyz(x,y,z)","v=cos(x).*cos(y).*sin(z)");
+n = 20;
+x = linspace(0,2*%pi,n);
+y = x;
+z = x;
+[X,Y,Z] = ndgrid(x,y,z);
+V = f(X,Y,Z);
+tl = splin3d(x,y,z,V,[5 5 5]);
+xp = grand(1,1,"unf",0,2*%pi);
+yp = grand(1,1,"unf",0,2*%pi);
+zp = grand(1,1,"unf",0,2*%pi);
+f_i = bsplin3val(xp, yp, zp, tl, [0 0 0]);
+yp = yp + %i;
+msgerr = msprintf(gettext("%s: Wrong type for argument #%d: Real matrix expected.\n"), "bsplin3val", 2);
+assert_checkerror ("f_i = bsplin3val(xp, yp, zp, tl, [0 0 0]);", msgerr);
+// test with cshep2d
+//
+n = 150;
+xy = grand(n,2,"unf",0,2*%pi);
+z = cos(xy(:,1)).*cos(xy(:,2));
+xyz = [xy z];
+tl_coef = cshep2d(xyz);
+xyz = [xy z] + %i;
+msgerr = msprintf(gettext("%s: Wrong type for argument #%d: Real matrix expected.\n"), "cshep2d", 1);
+assert_checkerror ("tl_coef = cshep2d(xyz);", msgerr);
+// test with eval_cshep2d
+//
+clear f;
+deff("z=f(x,y)","z = 1+ 50*(x.*(1-x).*y.*(1-y)).^2")
+x = linspace(0,1,10);
+[X,Y] = ndgrid(x,x);
+X = X(:); Y = Y(:); Z = f(X,Y);
+S = cshep2d([X Y Z]);
+m = 40;
+xx = linspace(-1.5,0.5,m);
+[xp, yp] = ndgrid(xx,xx);
+zp = eval_cshep2d(xp, yp, S);
+yp = yp + %i;
+msgerr = msprintf(gettext("%s: Wrong type for argument #%d: Real matrix expected.\n"), "eval_cshep2d", 2);
+assert_checkerror ("eval_cshep2d(xp, yp, S)", msgerr);
+// test with interp
+//
+x = linspace(0,1,11)';
+y = cosh(x-0.5);
+d = splin(x,y);
+xx = linspace(-0.5,1.5,401)';
+yy0 = interp(xx,x,y,d,"C0");
+y = y + %i;
+msgerr = msprintf(gettext("%s: Wrong type for argument #%d: Real matrix expected.\n"), "interp", 3);
+assert_checkerror ("yy0 = interp(xx,x,y,d,''C0'')", msgerr);
+// test with interp2d
+//
+n = 7;
+x = linspace(0,2*%pi,n);
+y = x;
+z = cos(x')*cos(y);
+C = splin2d(x, y, z, "periodic");
+m = 80;
+xx = linspace(-0.5*%pi,2.5*%pi,m);
+yy = xx;
+[XX,YY] = ndgrid(xx,yy);
+zz1 = interp2d(XX,YY, x, y, C, "C0");
+YY = YY + %i;
+msgerr = msprintf(gettext("%s: Wrong type for argument #%d: Real matrix expected.\n"), "interp2d", 2);
+assert_checkerror ("zz1 = interp2d(XX,YY, x, y, C, ''C0'')", msgerr);
+// test with interp3d
+//
+m = 10000;
+xp = grand(m,1,"def");
+yp = grand(m,1,"def");
+zp = grand(m,1,"def");
+vp_interp = interp3d(xp,yp,zp, tl);
+zp = zp + %i;
+msgerr = msprintf(gettext("%s: Wrong type for argument #%d: Real matrix expected.\n"), "interp3d", 3);
+assert_checkerror ("vp_interp = interp3d(xp,yp,zp, tl)", msgerr);
+// test with linear_interpn
+//
+x = linspace(0,2*%pi,11);
+y = sin(x);
+xx = linspace(-2*%pi,4*%pi,400)';
+yy = linear_interpn(xx, x, y, "periodic");
+xx = xx + %i;
+msgerr = msprintf(gettext("%s: Wrong type for argument #%d: Real matrix expected.\n"), "linear_interpn", 1);
+assert_checkerror ("yy = linear_interpn(xx, x, y, ''periodic'')", msgerr);
+// test with splin2d
+//
+n = 7;
+x = linspace(0, 2 * %pi, n);
+y = x;
+z = cos(x') * cos(y);
+C = splin2d(x, y, z, "periodic");
+z = z + %i;
+msgerr = msprintf(gettext("%s: Wrong type for argument #%d: Real matrix expected.\n"), "splin2d", 3);
+assert_checkerror ("C = splin2d(x, y, z, ''periodic'')", msgerr);
+// test with splin2d
+//
+func = "v=cos(2*%pi*x).*sin(2*%pi*y).*cos(2*%pi*z)";
+clear f;
+deff("v = f(x,y,z)",func);
+n = 10; // n x n x n interpolation points
+x = linspace(0,1,n); y=x; z=x; // interpolation grid
+[X,Y,Z] = ndgrid(x,y,z);
+V = f(X,Y,Z);
+tl = splin3d(x,y,z,V,[5 5 5]);
+x = x + %i;
+msgerr = msprintf(gettext("%s: Wrong type for argument #%d: Real matrix expected.\n"), "splin3d", 1);
+assert_checkerror ("tl = splin3d(x,y,z,V,[5 5 5])", msgerr);
+// test with splin2d
+//
+deff("y=runge(x)","y=1 ./(1 + x.^2)")
+a = -5;
+b = 5;
+n = 11;
+m = 400;
+x = linspace(a, b, n)';
+y = runge(x);
+d = splin(x, y);
+y = y + %i;
+msgerr = msprintf(gettext("%s: Wrong type for argument #%d: Real matrix expected.\n"), "splin", 2);
+assert_checkerror ("d = splin(x, y);", msgerr);
diff --git a/modules/interpolation/tests/nonreg_tests/bug_9002.tst b/modules/interpolation/tests/nonreg_tests/bug_9002.tst
new file mode 100755
index 000000000..c8d9fba79
--- /dev/null
+++ b/modules/interpolation/tests/nonreg_tests/bug_9002.tst
@@ -0,0 +1,163 @@
+// =============================================================================
+// Scilab ( http://www.scilab.org/ ) - This file is part of Scilab
+// Copyright (C) 2012 - DIGITEO - Allan CORNET
+//
+// This file is distributed under the same license as the Scilab package.
+// =============================================================================
+
+// <-- Non-regression test for bug 9002 -->
+//
+// <-- Bugzilla URL -->
+// http://bugzilla.scilab.org/show_bug.cgi?id=9002
+//
+// <-- Short Description -->
+// linear_interpn, splin2d/interp2d, ... functions ignored imaginary part of input arguments
+
+
+// test with bsplin3val
+//
+deff("v=f(x,y,z)","v=cos(x).*sin(y).*cos(z)");
+deff("v=fx(x,y,z)","v=-sin(x).*sin(y).*cos(z)");
+deff("v=fxy(x,y,z)","v=-sin(x).*cos(y).*cos(z)");
+deff("v=fxyz(x,y,z)","v=sin(x).*cos(y).*sin(z)");
+deff("v=fxxyz(x,y,z)","v=cos(x).*cos(y).*sin(z)");
+n = 20;
+x = linspace(0,2*%pi,n);
+y = x;
+z = x;
+[X,Y,Z] = ndgrid(x,y,z);
+V = f(X,Y,Z);
+tl = splin3d(x,y,z,V,[5 5 5]);
+xp = grand(1,1,"unf",0,2*%pi);
+yp = grand(1,1,"unf",0,2*%pi);
+zp = grand(1,1,"unf",0,2*%pi);
+
+f_i = bsplin3val(xp, yp, zp, tl, [0 0 0]);
+
+yp = yp + %i;
+msgerr = msprintf(gettext("%s: Wrong type for argument #%d: Real matrix expected.\n"), "bsplin3val", 2);
+assert_checkerror ("f_i = bsplin3val(xp, yp, zp, tl, [0 0 0]);", msgerr);
+
+// test with cshep2d
+//
+n = 150;
+xy = grand(n,2,"unf",0,2*%pi);
+z = cos(xy(:,1)).*cos(xy(:,2));
+xyz = [xy z];
+tl_coef = cshep2d(xyz);
+
+xyz = [xy z] + %i;
+msgerr = msprintf(gettext("%s: Wrong type for argument #%d: Real matrix expected.\n"), "cshep2d", 1);
+assert_checkerror ("tl_coef = cshep2d(xyz);", msgerr);
+
+// test with eval_cshep2d
+//
+clear f;
+deff("z=f(x,y)","z = 1+ 50*(x.*(1-x).*y.*(1-y)).^2")
+x = linspace(0,1,10);
+[X,Y] = ndgrid(x,x);
+X = X(:); Y = Y(:); Z = f(X,Y);
+S = cshep2d([X Y Z]);
+m = 40;
+xx = linspace(-1.5,0.5,m);
+[xp, yp] = ndgrid(xx,xx);
+zp = eval_cshep2d(xp, yp, S);
+
+yp = yp + %i;
+msgerr = msprintf(gettext("%s: Wrong type for argument #%d: Real matrix expected.\n"), "eval_cshep2d", 2);
+assert_checkerror ("eval_cshep2d(xp, yp, S)", msgerr);
+
+// test with interp
+//
+x = linspace(0,1,11)';
+y = cosh(x-0.5);
+d = splin(x,y);
+xx = linspace(-0.5,1.5,401)';
+yy0 = interp(xx,x,y,d,"C0");
+
+y = y + %i;
+msgerr = msprintf(gettext("%s: Wrong type for argument #%d: Real matrix expected.\n"), "interp", 3);
+assert_checkerror ("yy0 = interp(xx,x,y,d,''C0'')", msgerr);
+
+
+// test with interp2d
+//
+n = 7;
+x = linspace(0,2*%pi,n);
+y = x;
+z = cos(x')*cos(y);
+C = splin2d(x, y, z, "periodic");
+m = 80;
+xx = linspace(-0.5*%pi,2.5*%pi,m);
+yy = xx;
+[XX,YY] = ndgrid(xx,yy);
+zz1 = interp2d(XX,YY, x, y, C, "C0");
+
+YY = YY + %i;
+msgerr = msprintf(gettext("%s: Wrong type for argument #%d: Real matrix expected.\n"), "interp2d", 2);
+assert_checkerror ("zz1 = interp2d(XX,YY, x, y, C, ''C0'')", msgerr);
+
+// test with interp3d
+//
+m = 10000;
+xp = grand(m,1,"def");
+yp = grand(m,1,"def");
+zp = grand(m,1,"def");
+vp_interp = interp3d(xp,yp,zp, tl);
+
+zp = zp + %i;
+msgerr = msprintf(gettext("%s: Wrong type for argument #%d: Real matrix expected.\n"), "interp3d", 3);
+assert_checkerror ("vp_interp = interp3d(xp,yp,zp, tl)", msgerr);
+
+// test with linear_interpn
+//
+x = linspace(0,2*%pi,11);
+y = sin(x);
+xx = linspace(-2*%pi,4*%pi,400)';
+yy = linear_interpn(xx, x, y, "periodic");
+
+xx = xx + %i;
+msgerr = msprintf(gettext("%s: Wrong type for argument #%d: Real matrix expected.\n"), "linear_interpn", 1);
+assert_checkerror ("yy = linear_interpn(xx, x, y, ''periodic'')", msgerr);
+
+// test with splin2d
+//
+n = 7;
+x = linspace(0, 2 * %pi, n);
+y = x;
+z = cos(x') * cos(y);
+C = splin2d(x, y, z, "periodic");
+
+z = z + %i;
+msgerr = msprintf(gettext("%s: Wrong type for argument #%d: Real matrix expected.\n"), "splin2d", 3);
+assert_checkerror ("C = splin2d(x, y, z, ''periodic'')", msgerr);
+
+// test with splin2d
+//
+func = "v=cos(2*%pi*x).*sin(2*%pi*y).*cos(2*%pi*z)";
+clear f;
+deff("v = f(x,y,z)",func);
+n = 10; // n x n x n interpolation points
+x = linspace(0,1,n); y=x; z=x; // interpolation grid
+[X,Y,Z] = ndgrid(x,y,z);
+V = f(X,Y,Z);
+tl = splin3d(x,y,z,V,[5 5 5]);
+
+x = x + %i;
+msgerr = msprintf(gettext("%s: Wrong type for argument #%d: Real matrix expected.\n"), "splin3d", 1);
+assert_checkerror ("tl = splin3d(x,y,z,V,[5 5 5])", msgerr);
+
+// test with splin2d
+//
+deff("y=runge(x)","y=1 ./(1 + x.^2)")
+a = -5;
+b = 5;
+n = 11;
+m = 400;
+x = linspace(a, b, n)';
+y = runge(x);
+d = splin(x, y);
+
+y = y + %i;
+msgerr = msprintf(gettext("%s: Wrong type for argument #%d: Real matrix expected.\n"), "splin", 2);
+assert_checkerror ("d = splin(x, y);", msgerr);
diff --git a/modules/interpolation/tests/unit_tests/bsplin3val.dia.ref b/modules/interpolation/tests/unit_tests/bsplin3val.dia.ref
new file mode 100755
index 000000000..315e1b9e7
--- /dev/null
+++ b/modules/interpolation/tests/unit_tests/bsplin3val.dia.ref
@@ -0,0 +1,49 @@
+// =============================================================================
+// Scilab ( http://www.scilab.org/ ) - This file is part of Scilab
+// Copyright (C) 2008 - DIGITEO - Allan CORNET
+//
+// This file is distributed under the same license as the Scilab package.
+// =============================================================================
+function v=f(x,y,z)
+ v=cos(x).*sin(y).*cos(z);
+endfunction
+function v=fx(x,y,z)
+ v=-sin(x).*sin(y).*cos(z)
+endfunction
+function v=fxy(x,y,z)
+ v=-sin(x).*cos(y).*cos(z)
+endfunction
+function v=fxyz(x,y,z)
+ v=sin(x).*cos(y).*sin(z)
+endfunction
+function v=fxxyz(x,y,z)
+ v=cos(x).*cos(y).*sin(z)
+endfunction
+// n x n x n interpolation points
+n = 20;
+x = linspace(0,2*%pi,n);
+// interpolation grid
+y=x; z=x;
+[X,Y,Z] = ndgrid(x,y,z);
+V = f(X,Y,Z);
+tl = splin3d(x,y,z,V,[5 5 5]);
+// compute f and some derivates on a point
+// and compare with the spline interpolant
+xp = grand(1,1,"unf",0,2*%pi);
+yp = grand(1,1,"unf",0,2*%pi);
+zp = grand(1,1,"unf",0,2*%pi);
+f_e = f(xp,yp,zp);
+f_i = bsplin3val(xp,yp,zp,tl,[0 0 0]);
+assert_checkfalse(abs(f_i) > 1);
+fx_e = fx(xp,yp,zp);
+fx_i = bsplin3val(xp,yp,zp,tl,[1 0 0]);
+assert_checkfalse(abs(fx_i) > 1);
+fxy_e = fxy(xp,yp,zp);
+fxy_i = bsplin3val(xp,yp,zp,tl,[1 1 0]);
+assert_checkfalse(abs(fxy_i) > 1);
+fxyz_e = fxyz(xp,yp,zp);
+fxyz_i = bsplin3val(xp,yp,zp,tl,[1 1 1]);
+assert_checkfalse(abs(fxyz_i) > 1);
+fxxyz_e = fxxyz(xp,yp,zp);
+fxxyz_i = bsplin3val(xp,yp,zp,tl,[2 1 1]);
+assert_checkfalse(abs(fxxyz_i) > 1);
diff --git a/modules/interpolation/tests/unit_tests/bsplin3val.tst b/modules/interpolation/tests/unit_tests/bsplin3val.tst
new file mode 100755
index 000000000..ba4d8a3c2
--- /dev/null
+++ b/modules/interpolation/tests/unit_tests/bsplin3val.tst
@@ -0,0 +1,62 @@
+// =============================================================================
+// Scilab ( http://www.scilab.org/ ) - This file is part of Scilab
+// Copyright (C) 2008 - DIGITEO - Allan CORNET
+//
+// This file is distributed under the same license as the Scilab package.
+// =============================================================================
+
+function v=f(x,y,z)
+ v=cos(x).*sin(y).*cos(z);
+endfunction
+
+function v=fx(x,y,z)
+ v=-sin(x).*sin(y).*cos(z)
+endfunction
+
+function v=fxy(x,y,z)
+ v=-sin(x).*cos(y).*cos(z)
+endfunction
+
+function v=fxyz(x,y,z)
+ v=sin(x).*cos(y).*sin(z)
+endfunction
+
+function v=fxxyz(x,y,z)
+ v=cos(x).*cos(y).*sin(z)
+endfunction
+
+// n x n x n interpolation points
+n = 20;
+x = linspace(0,2*%pi,n);
+
+// interpolation grid
+y=x; z=x;
+[X,Y,Z] = ndgrid(x,y,z);
+V = f(X,Y,Z);
+tl = splin3d(x,y,z,V,[5 5 5]);
+
+// compute f and some derivates on a point
+// and compare with the spline interpolant
+xp = grand(1,1,"unf",0,2*%pi);
+yp = grand(1,1,"unf",0,2*%pi);
+zp = grand(1,1,"unf",0,2*%pi);
+
+f_e = f(xp,yp,zp);
+f_i = bsplin3val(xp,yp,zp,tl,[0 0 0]);
+assert_checkfalse(abs(f_i) > 1);
+
+fx_e = fx(xp,yp,zp);
+fx_i = bsplin3val(xp,yp,zp,tl,[1 0 0]);
+assert_checkfalse(abs(fx_i) > 1);
+
+fxy_e = fxy(xp,yp,zp);
+fxy_i = bsplin3val(xp,yp,zp,tl,[1 1 0]);
+assert_checkfalse(abs(fxy_i) > 1);
+
+fxyz_e = fxyz(xp,yp,zp);
+fxyz_i = bsplin3val(xp,yp,zp,tl,[1 1 1]);
+assert_checkfalse(abs(fxyz_i) > 1);
+
+fxxyz_e = fxxyz(xp,yp,zp);
+fxxyz_i = bsplin3val(xp,yp,zp,tl,[2 1 1]);
+assert_checkfalse(abs(fxxyz_i) > 1);
diff --git a/modules/interpolation/tests/unit_tests/cshep2d.dia.ref b/modules/interpolation/tests/unit_tests/cshep2d.dia.ref
new file mode 100755
index 000000000..f02043c55
--- /dev/null
+++ b/modules/interpolation/tests/unit_tests/cshep2d.dia.ref
@@ -0,0 +1,21 @@
+// =============================================================================
+// Scilab ( http://www.scilab.org/ ) - This file is part of Scilab
+// Copyright (C) 2008 - DIGITEO - Allan CORNET
+//
+// This file is distributed under the same license as the Scilab package.
+// =============================================================================
+n = 150;
+xy = grand(n,2,"unf",0,2*%pi);
+z = cos(xy(:,1)).*cos(xy(:,2));
+xyz = [xy z];
+tl_coef = cshep2d(xyz);
+assert_checkequal(type(tl_coef), 16);
+assert_checkequal(size(tl_coef), 8);
+assert_checkequal(size(tl_coef(1)), [1 8]);
+assert_checkequal(size(tl_coef(2)), [150 3]);
+assert_checkequal(size(tl_coef(3)), [7 7]);
+assert_checkequal(size(tl_coef(4)), [1 150]);
+assert_checkequal(size(tl_coef(5)), [1 4]);
+assert_checkequal(size(tl_coef(6)), [1 1]);
+assert_checkequal(size(tl_coef(7)), [1 150]);
+assert_checkequal(size(tl_coef(8)), [9 150]);
diff --git a/modules/interpolation/tests/unit_tests/cshep2d.tst b/modules/interpolation/tests/unit_tests/cshep2d.tst
new file mode 100755
index 000000000..084597944
--- /dev/null
+++ b/modules/interpolation/tests/unit_tests/cshep2d.tst
@@ -0,0 +1,22 @@
+// =============================================================================
+// Scilab ( http://www.scilab.org/ ) - This file is part of Scilab
+// Copyright (C) 2008 - DIGITEO - Allan CORNET
+//
+// This file is distributed under the same license as the Scilab package.
+// =============================================================================
+
+n = 150;
+xy = grand(n,2,"unf",0,2*%pi);
+z = cos(xy(:,1)).*cos(xy(:,2));
+xyz = [xy z];
+tl_coef = cshep2d(xyz);
+assert_checkequal(type(tl_coef), 16);
+assert_checkequal(size(tl_coef), 8);
+assert_checkequal(size(tl_coef(1)), [1 8]);
+assert_checkequal(size(tl_coef(2)), [150 3]);
+assert_checkequal(size(tl_coef(3)), [7 7]);
+assert_checkequal(size(tl_coef(4)), [1 150]);
+assert_checkequal(size(tl_coef(5)), [1 4]);
+assert_checkequal(size(tl_coef(6)), [1 1]);
+assert_checkequal(size(tl_coef(7)), [1 150]);
+assert_checkequal(size(tl_coef(8)), [9 150]);
diff --git a/modules/interpolation/tests/unit_tests/eval_cshep2d.dia.ref b/modules/interpolation/tests/unit_tests/eval_cshep2d.dia.ref
new file mode 100755
index 000000000..e1cabe207
--- /dev/null
+++ b/modules/interpolation/tests/unit_tests/eval_cshep2d.dia.ref
@@ -0,0 +1,18 @@
+// =============================================================================
+// Scilab ( http://www.scilab.org/ ) - This file is part of Scilab
+// Copyright (C) 2008 - DIGITEO - Allan CORNET
+//
+// This file is distributed under the same license as the Scilab package.
+// =============================================================================
+function z = f(x,y)
+ z = 1+ 50*(x.*(1-x).*y.*(1-y)).^2;
+endfunction
+x = linspace(0,1,10);
+[X,Y] = ndgrid(x,x);
+X = X(:); Y = Y(:); Z = f(X,Y);
+S = cshep2d([X Y Z]);
+m = 40;
+xx = linspace(-1.5,0.5,m);
+[xp,yp] = ndgrid(xx,xx);
+zp = eval_cshep2d(xp,yp,S);
+assert_checkequal(size(zp), [40 40]);
diff --git a/modules/interpolation/tests/unit_tests/eval_cshep2d.tst b/modules/interpolation/tests/unit_tests/eval_cshep2d.tst
new file mode 100755
index 000000000..e768b29b1
--- /dev/null
+++ b/modules/interpolation/tests/unit_tests/eval_cshep2d.tst
@@ -0,0 +1,20 @@
+// =============================================================================
+// Scilab ( http://www.scilab.org/ ) - This file is part of Scilab
+// Copyright (C) 2008 - DIGITEO - Allan CORNET
+//
+// This file is distributed under the same license as the Scilab package.
+// =============================================================================
+
+function z = f(x,y)
+ z = 1+ 50*(x.*(1-x).*y.*(1-y)).^2;
+endfunction
+
+x = linspace(0,1,10);
+[X,Y] = ndgrid(x,x);
+X = X(:); Y = Y(:); Z = f(X,Y);
+S = cshep2d([X Y Z]);
+m = 40;
+xx = linspace(-1.5,0.5,m);
+[xp,yp] = ndgrid(xx,xx);
+zp = eval_cshep2d(xp,yp,S);
+assert_checkequal(size(zp), [40 40]);
diff --git a/modules/interpolation/tests/unit_tests/interp.dia.ref b/modules/interpolation/tests/unit_tests/interp.dia.ref
new file mode 100755
index 000000000..170ea16b9
--- /dev/null
+++ b/modules/interpolation/tests/unit_tests/interp.dia.ref
@@ -0,0 +1,26 @@
+// =============================================================================
+// Scilab ( http://www.scilab.org/ ) - This file is part of Scilab
+// Copyright (C) 2008 - DIGITEO - Allan CORNET
+//
+// This file is distributed under the same license as the Scilab package.
+// =============================================================================
+x = linspace(0,1,11)';
+y = cosh(x-0.5);
+d = splin(x,y);
+xx = linspace(-0.5,1.5,401)';
+yy0 = interp(xx,x,y,d,"C0");
+assert_checkequal(size(yy0), [401 1]);
+assert_checkfalse(yy0 > 2);
+assert_checkfalse(yy0 < 0);
+yy1 = interp(xx,x,y,d,"linear");
+assert_checkequal(size(yy1), [401 1]);
+assert_checkfalse(yy1 > 2);
+assert_checkfalse(yy1 < 0);
+yy2 = interp(xx,x,y,d,"natural");
+assert_checkequal(size(yy2), [401 1]);
+assert_checkfalse(yy2 > 2);
+assert_checkfalse(yy2 < 0);
+yy3 = interp(xx,x,y,d,"periodic");
+assert_checkequal(size(yy3), [401 1]);
+assert_checkfalse(yy3 > 2);
+assert_checkfalse(yy3 < 0);
diff --git a/modules/interpolation/tests/unit_tests/interp.tst b/modules/interpolation/tests/unit_tests/interp.tst
new file mode 100755
index 000000000..c30329495
--- /dev/null
+++ b/modules/interpolation/tests/unit_tests/interp.tst
@@ -0,0 +1,32 @@
+// =============================================================================
+// Scilab ( http://www.scilab.org/ ) - This file is part of Scilab
+// Copyright (C) 2008 - DIGITEO - Allan CORNET
+//
+// This file is distributed under the same license as the Scilab package.
+// =============================================================================
+
+x = linspace(0,1,11)';
+y = cosh(x-0.5);
+d = splin(x,y);
+xx = linspace(-0.5,1.5,401)';
+yy0 = interp(xx,x,y,d,"C0");
+assert_checkequal(size(yy0), [401 1]);
+assert_checkfalse(yy0 > 2);
+assert_checkfalse(yy0 < 0);
+
+
+yy1 = interp(xx,x,y,d,"linear");
+assert_checkequal(size(yy1), [401 1]);
+assert_checkfalse(yy1 > 2);
+assert_checkfalse(yy1 < 0);
+
+
+yy2 = interp(xx,x,y,d,"natural");
+assert_checkequal(size(yy2), [401 1]);
+assert_checkfalse(yy2 > 2);
+assert_checkfalse(yy2 < 0);
+
+yy3 = interp(xx,x,y,d,"periodic");
+assert_checkequal(size(yy3), [401 1]);
+assert_checkfalse(yy3 > 2);
+assert_checkfalse(yy3 < 0);
diff --git a/modules/interpolation/tests/unit_tests/linear_interpn.dia.ref b/modules/interpolation/tests/unit_tests/linear_interpn.dia.ref
new file mode 100755
index 000000000..2d9b1029a
--- /dev/null
+++ b/modules/interpolation/tests/unit_tests/linear_interpn.dia.ref
@@ -0,0 +1,37 @@
+// =============================================================================
+// Scilab ( http://www.scilab.org/ ) - This file is part of Scilab
+// Copyright (C) 2008 - DIGITEO - Allan CORNET
+//
+// This file is distributed under the same license as the Scilab package.
+// =============================================================================
+x = linspace(0,2*%pi,11);
+y = sin(x);
+xx = linspace(-2*%pi,4*%pi,400)';
+yy = linear_interpn(xx, x, y, "periodic");
+assert_checkequal(size(yy), [400 1]);
+n = 8;
+x = linspace(0,2*%pi,n); y = x;
+z = 2*sin(x')*sin(y);
+xx = linspace(0,2*%pi, 40);
+[xp,yp] = ndgrid(xx,xx);
+zp = linear_interpn(xp,yp, x, y, z);
+assert_checkequal(size(zp), [40 40]);
+nx = 20; ny = 30;
+x = linspace(0,1,nx);
+y = linspace(0,2, ny);
+[X,Y] = ndgrid(x,y);
+z = 0.4*cos(2*%pi*X).*cos(%pi*Y);
+nxp = 60 ; nyp = 120;
+xp = linspace(-0.5,1.5, nxp);
+yp = linspace(-0.5,2.5, nyp);
+[XP,YP] = ndgrid(xp,yp);
+zp1 = linear_interpn(XP, YP, x, y, z, "natural");
+assert_checkequal(size(zp1), [60 120]);
+zp2 = linear_interpn(XP, YP, x, y, z, "periodic");
+assert_checkequal(size(zp1), [60 120]);
+zp3 = linear_interpn(XP, YP, x, y, z, "C0");
+assert_checkequal(size(zp1), [60 120]);
+zp4 = linear_interpn(XP, YP, x, y, z, "by_zero");
+assert_checkequal(size(zp1), [60 120]);
+zp5 = linear_interpn(XP, YP, x, y, z, "by_nan");
+assert_checkequal(size(zp1), [60 120]);
diff --git a/modules/interpolation/tests/unit_tests/linear_interpn.tst b/modules/interpolation/tests/unit_tests/linear_interpn.tst
new file mode 100755
index 000000000..004c7bf43
--- /dev/null
+++ b/modules/interpolation/tests/unit_tests/linear_interpn.tst
@@ -0,0 +1,47 @@
+// =============================================================================
+// Scilab ( http://www.scilab.org/ ) - This file is part of Scilab
+// Copyright (C) 2008 - DIGITEO - Allan CORNET
+//
+// This file is distributed under the same license as the Scilab package.
+// =============================================================================
+
+x = linspace(0,2*%pi,11);
+y = sin(x);
+xx = linspace(-2*%pi,4*%pi,400)';
+yy = linear_interpn(xx, x, y, "periodic");
+assert_checkequal(size(yy), [400 1]);
+
+n = 8;
+x = linspace(0,2*%pi,n); y = x;
+z = 2*sin(x')*sin(y);
+xx = linspace(0,2*%pi, 40);
+[xp,yp] = ndgrid(xx,xx);
+zp = linear_interpn(xp,yp, x, y, z);
+assert_checkequal(size(zp), [40 40]);
+
+nx = 20; ny = 30;
+x = linspace(0,1,nx);
+y = linspace(0,2, ny);
+[X,Y] = ndgrid(x,y);
+z = 0.4*cos(2*%pi*X).*cos(%pi*Y);
+nxp = 60 ; nyp = 120;
+xp = linspace(-0.5,1.5, nxp);
+yp = linspace(-0.5,2.5, nyp);
+[XP,YP] = ndgrid(xp,yp);
+zp1 = linear_interpn(XP, YP, x, y, z, "natural");
+assert_checkequal(size(zp1), [60 120]);
+
+zp2 = linear_interpn(XP, YP, x, y, z, "periodic");
+assert_checkequal(size(zp1), [60 120]);
+
+zp3 = linear_interpn(XP, YP, x, y, z, "C0");
+assert_checkequal(size(zp1), [60 120]);
+
+zp4 = linear_interpn(XP, YP, x, y, z, "by_zero");
+assert_checkequal(size(zp1), [60 120]);
+
+zp5 = linear_interpn(XP, YP, x, y, z, "by_nan");
+assert_checkequal(size(zp1), [60 120]);
+
+
+
diff --git a/modules/interpolation/tests/unit_tests/lsq_splin.dia.ref b/modules/interpolation/tests/unit_tests/lsq_splin.dia.ref
new file mode 100755
index 000000000..4dd4115a1
--- /dev/null
+++ b/modules/interpolation/tests/unit_tests/lsq_splin.dia.ref
@@ -0,0 +1,21 @@
+// =============================================================================
+// Scilab ( http://www.scilab.org/ ) - This file is part of Scilab
+// Copyright (C) 2008 - DIGITEO - Allan CORNET
+//
+// This file is distributed under the same license as the Scilab package.
+// =============================================================================
+a = 0; b = 2*%pi;
+// standard deviation of the gaussian noise
+sigma = 0.1;
+// number of experimental points
+m = 200;
+xd = linspace(a,b,m)';
+yd = sin(xd) + grand(xd,"nor",0,sigma);
+// number of breakpoints
+n = 6;
+x = linspace(a,b,n)';
+// compute the spline
+// use equal weights
+[y, d] = lsq_splin(xd, yd, x);
+assert_checkequal(size(y), [6 1]);
+assert_checkequal(size(d), [6 1]);
diff --git a/modules/interpolation/tests/unit_tests/lsq_splin.tst b/modules/interpolation/tests/unit_tests/lsq_splin.tst
new file mode 100755
index 000000000..0ce29a6f1
--- /dev/null
+++ b/modules/interpolation/tests/unit_tests/lsq_splin.tst
@@ -0,0 +1,25 @@
+// =============================================================================
+// Scilab ( http://www.scilab.org/ ) - This file is part of Scilab
+// Copyright (C) 2008 - DIGITEO - Allan CORNET
+//
+// This file is distributed under the same license as the Scilab package.
+// =============================================================================
+
+a = 0; b = 2*%pi;
+// standard deviation of the gaussian noise
+sigma = 0.1;
+// number of experimental points
+m = 200;
+xd = linspace(a,b,m)';
+yd = sin(xd) + grand(xd,"nor",0,sigma);
+
+// number of breakpoints
+n = 6;
+x = linspace(a,b,n)';
+
+// compute the spline
+
+// use equal weights
+[y, d] = lsq_splin(xd, yd, x);
+assert_checkequal(size(y), [6 1]);
+assert_checkequal(size(d), [6 1]);
diff --git a/modules/interpolation/tests/unit_tests/splin.dia.ref b/modules/interpolation/tests/unit_tests/splin.dia.ref
new file mode 100755
index 000000000..ffd986137
--- /dev/null
+++ b/modules/interpolation/tests/unit_tests/splin.dia.ref
@@ -0,0 +1,37 @@
+// =============================================================================
+// Scilab ( http://www.scilab.org/ ) - This file is part of Scilab
+// Copyright (C) 2008 - DIGITEO - Allan CORNET
+//
+// This file is distributed under the same license as the Scilab package.
+// =============================================================================
+function y=runge(x)
+ y=1 ./(1 + x.^2)
+endfunction
+a = -5; b = 5; n = 11; m = 400;
+x = linspace(a, b, n)';
+y = runge(x);
+d = splin(x, y);
+xx = linspace(a, b, m)';
+yyi = interp(xx, x, y, d);
+yye = runge(xx);
+assert_checkequal(size(d), [11 1]);
+assert_checkequal(d(6), 0);
+assert_checkfalse(d(7:11) > 0);
+// interval of interpolation
+a = 0;
+b = 1;
+// nb of interpolation points
+n = 10;
+// discretization for evaluation
+m = 800;
+// abscissae of interpolation points
+x = linspace(a,b,n)';
+// ordinates of interpolation points
+y = rand(x);
+xx = linspace(a,b,m)';
+yk = interp(xx, x, y, splin(x,y,"not_a_knot"));
+assert_checkequal(size(yk), [800 1]);
+yf = interp(xx, x, y, splin(x,y,"fast"));
+assert_checkequal(size(yf), [800 1]);
+ym = interp(xx, x, y, splin(x,y,"monotone"));
+assert_checkequal(size(yf), [800 1]);
diff --git a/modules/interpolation/tests/unit_tests/splin.tst b/modules/interpolation/tests/unit_tests/splin.tst
new file mode 100755
index 000000000..be729f20f
--- /dev/null
+++ b/modules/interpolation/tests/unit_tests/splin.tst
@@ -0,0 +1,46 @@
+// =============================================================================
+// Scilab ( http://www.scilab.org/ ) - This file is part of Scilab
+// Copyright (C) 2008 - DIGITEO - Allan CORNET
+//
+// This file is distributed under the same license as the Scilab package.
+// =============================================================================
+
+
+function y=runge(x)
+ y=1 ./(1 + x.^2)
+endfunction
+
+a = -5; b = 5; n = 11; m = 400;
+x = linspace(a, b, n)';
+y = runge(x);
+d = splin(x, y);
+xx = linspace(a, b, m)';
+yyi = interp(xx, x, y, d);
+yye = runge(xx);
+
+assert_checkequal(size(d), [11 1]);
+assert_checkequal(d(6), 0);
+assert_checkfalse(d(7:11) > 0);
+
+// interval of interpolation
+a = 0;
+b = 1;
+// nb of interpolation points
+n = 10;
+// discretization for evaluation
+m = 800;
+// abscissae of interpolation points
+x = linspace(a,b,n)';
+// ordinates of interpolation points
+y = rand(x);
+
+xx = linspace(a,b,m)';
+
+yk = interp(xx, x, y, splin(x,y,"not_a_knot"));
+assert_checkequal(size(yk), [800 1]);
+
+yf = interp(xx, x, y, splin(x,y,"fast"));
+assert_checkequal(size(yf), [800 1]);
+
+ym = interp(xx, x, y, splin(x,y,"monotone"));
+assert_checkequal(size(yf), [800 1]);
diff --git a/modules/interpolation/tests/unit_tests/splin3d.dia.ref b/modules/interpolation/tests/unit_tests/splin3d.dia.ref
new file mode 100755
index 000000000..fcf6b42de
--- /dev/null
+++ b/modules/interpolation/tests/unit_tests/splin3d.dia.ref
@@ -0,0 +1,24 @@
+// =============================================================================
+// Scilab ( http://www.scilab.org/ ) - This file is part of Scilab
+// Copyright (C) 2008 - DIGITEO - Allan CORNET
+//
+// This file is distributed under the same license as the Scilab package.
+// =============================================================================
+function v=f(x,y,z)
+ v=cos(2*%pi*x).*sin(2*%pi*y).*cos(2*%pi*z)
+endfunction
+// n x n x n interpolation points
+n = 10;
+// interpolation grid
+x = linspace(0,1,n); y=x; z=x;
+[X,Y,Z] = ndgrid(x,y,z);
+V = f(X,Y,Z);
+tl = splin3d(x,y,z,V,[5 5 5]);
+assert_checkequal(type(tl), 16);
+assert_checkequal(size(tl), 7);
+assert_checkequal(type(tl(1)), 10);
+assert_checkequal(size(tl(2)), [15 1]);
+assert_checkequal(size(tl(3)), [15 1]);
+assert_checkequal(size(tl(4)), [15 1]);
+assert_checkequal(size(tl(6)), [1000 1]);
+assert_checkequal(size(tl(7)), [6 1]);
diff --git a/modules/interpolation/tests/unit_tests/splin3d.tst b/modules/interpolation/tests/unit_tests/splin3d.tst
new file mode 100755
index 000000000..d44e1dbea
--- /dev/null
+++ b/modules/interpolation/tests/unit_tests/splin3d.tst
@@ -0,0 +1,27 @@
+// =============================================================================
+// Scilab ( http://www.scilab.org/ ) - This file is part of Scilab
+// Copyright (C) 2008 - DIGITEO - Allan CORNET
+//
+// This file is distributed under the same license as the Scilab package.
+// =============================================================================
+
+
+function v=f(x,y,z)
+ v=cos(2*%pi*x).*sin(2*%pi*y).*cos(2*%pi*z)
+endfunction
+
+// n x n x n interpolation points
+n = 10;
+// interpolation grid
+x = linspace(0,1,n); y=x; z=x;
+[X,Y,Z] = ndgrid(x,y,z);
+V = f(X,Y,Z);
+tl = splin3d(x,y,z,V,[5 5 5]);
+assert_checkequal(type(tl), 16);
+assert_checkequal(size(tl), 7);
+assert_checkequal(type(tl(1)), 10);
+assert_checkequal(size(tl(2)), [15 1]);
+assert_checkequal(size(tl(3)), [15 1]);
+assert_checkequal(size(tl(4)), [15 1]);
+assert_checkequal(size(tl(6)), [1000 1]);
+assert_checkequal(size(tl(7)), [6 1]);