summaryrefslogtreecommitdiff
path: root/modules/arnoldi/tests
diff options
context:
space:
mode:
authorShashank2017-05-29 12:40:26 +0530
committerShashank2017-05-29 12:40:26 +0530
commit0345245e860375a32c9a437c4a9d9cae807134e9 (patch)
treead51ecbfa7bcd3cc5f09834f1bb8c08feaa526a4 /modules/arnoldi/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/arnoldi/tests')
-rwxr-xr-xmodules/arnoldi/tests/nonreg_tests/bug_11653.dia.ref108
-rwxr-xr-xmodules/arnoldi/tests/nonreg_tests/bug_11653.tst136
-rwxr-xr-xmodules/arnoldi/tests/nonreg_tests/bug_12120.dia.ref18
-rwxr-xr-xmodules/arnoldi/tests/nonreg_tests/bug_12120.tst22
-rwxr-xr-xmodules/arnoldi/tests/nonreg_tests/bug_12137.dia.ref34
-rwxr-xr-xmodules/arnoldi/tests/nonreg_tests/bug_12137.tst39
-rwxr-xr-xmodules/arnoldi/tests/nonreg_tests/bug_12138.dia.ref81
-rwxr-xr-xmodules/arnoldi/tests/nonreg_tests/bug_12138.tst90
-rwxr-xr-xmodules/arnoldi/tests/nonreg_tests/bug_12139.dia.ref17
-rwxr-xr-xmodules/arnoldi/tests/nonreg_tests/bug_12139.tst20
-rwxr-xr-xmodules/arnoldi/tests/nonreg_tests/bug_12238.dia.ref19
-rwxr-xr-xmodules/arnoldi/tests/nonreg_tests/bug_12238.tst23
-rwxr-xr-xmodules/arnoldi/tests/nonreg_tests/bug_12772.dia.ref23
-rwxr-xr-xmodules/arnoldi/tests/nonreg_tests/bug_12772.tst27
-rwxr-xr-xmodules/arnoldi/tests/nonreg_tests/bug_12992.dia.ref29
-rwxr-xr-xmodules/arnoldi/tests/nonreg_tests/bug_12992.tst29
-rwxr-xr-xmodules/arnoldi/tests/nonreg_tests/bug_13058.dia.ref26
-rwxr-xr-xmodules/arnoldi/tests/nonreg_tests/bug_13058.tst31
-rwxr-xr-xmodules/arnoldi/tests/nonreg_tests/bug_13381.dia.ref23
-rwxr-xr-xmodules/arnoldi/tests/nonreg_tests/bug_13381.tst26
-rwxr-xr-xmodules/arnoldi/tests/nonreg_tests/bug_dsaupd.dia.ref54
-rwxr-xr-xmodules/arnoldi/tests/nonreg_tests/bug_dsaupd.tst70
-rwxr-xr-xmodules/arnoldi/tests/unit_tests/dnaupd.dia.ref71
-rwxr-xr-xmodules/arnoldi/tests/unit_tests/dnaupd.tst92
-rwxr-xr-xmodules/arnoldi/tests/unit_tests/dneupd.dia.ref72
-rwxr-xr-xmodules/arnoldi/tests/unit_tests/dneupd.tst94
-rwxr-xr-xmodules/arnoldi/tests/unit_tests/dsaupd.dia.ref61
-rwxr-xr-xmodules/arnoldi/tests/unit_tests/dsaupd.tst82
-rwxr-xr-xmodules/arnoldi/tests/unit_tests/dseupd.dia.ref57
-rwxr-xr-xmodules/arnoldi/tests/unit_tests/dseupd.tst76
-rwxr-xr-xmodules/arnoldi/tests/unit_tests/eigs.dia.ref835
-rwxr-xr-xmodules/arnoldi/tests/unit_tests/eigs.tst1131
-rwxr-xr-xmodules/arnoldi/tests/unit_tests/znaupd-win.dia.ref59
-rwxr-xr-xmodules/arnoldi/tests/unit_tests/znaupd-win.tst74
-rwxr-xr-xmodules/arnoldi/tests/unit_tests/znaupd.dia.ref60
-rwxr-xr-xmodules/arnoldi/tests/unit_tests/znaupd.tst76
-rwxr-xr-xmodules/arnoldi/tests/unit_tests/zneupd-win.dia.ref59
-rwxr-xr-xmodules/arnoldi/tests/unit_tests/zneupd-win.tst74
-rwxr-xr-xmodules/arnoldi/tests/unit_tests/zneupd.dia.ref60
-rwxr-xr-xmodules/arnoldi/tests/unit_tests/zneupd.tst76
40 files changed, 4054 insertions, 0 deletions
diff --git a/modules/arnoldi/tests/nonreg_tests/bug_11653.dia.ref b/modules/arnoldi/tests/nonreg_tests/bug_11653.dia.ref
new file mode 100755
index 000000000..97b52d4d0
--- /dev/null
+++ b/modules/arnoldi/tests/nonreg_tests/bug_11653.dia.ref
@@ -0,0 +1,108 @@
+// =============================================================================
+// Scilab ( http://www.scilab.org/ ) - This file is part of Scilab
+// Copyright (C) 2012 - Scilab Enterprises - Adeline CARNIS
+//
+// This file is distributed under the same license as the Scilab package.
+// =============================================================================
+// <-- CLI SHELL MODE -->
+// <-- Non-regression test for bug 11653 -->
+//
+// <-- Bugzilla URL -->
+// http://bugzilla.scilab.org/show_bug.cgi?id=11653
+//
+// <-- Short Description -->
+// Optional booleans in eigs were doubles and are now booleans.
+// =============================================================================
+// REAL SYMMETRIC PROBLEM
+clear opts;
+n = 10;
+k = 6;
+A = diag(5*ones(n,1));
+A(1:$-1,2:$) = A(1:$-1,2:$) + diag(6*ones(n-1,1));
+A(2:$,1:$-1) = A(2:$,1:$-1) + diag(6*ones(n-1,1));
+A(1:$-3,4:$) = A(1:$-3,4:$) + diag(2*ones(n-3,1));
+A(4:$,1:$-3) = A(4:$,1:$-3) + diag(2*ones(n-3,1));
+A1 = sparse(A);
+opts.cholB = %t;
+d1 = eigs(A1, speye(n,n), k, 'LM', opts);
+d0 = spec(A);
+assert_checkalmostequal(gsort(d1,'g','i'), [d0(1);d0($-4:$)], [], %eps);
+d1 = eigs(A, eye(n,n), k, 'LM', opts);
+assert_checkalmostequal(gsort(real(d1),'g','i'), [d0(1);d0($-4:$)], [], %eps);
+// REAL NON SYMMETRIC PROBLEM
+B = diag(5*ones(n,1));
+B(1:$-1,2:$) = B(1:$-1,2:$) + diag(-6*ones(n-1,1));
+B(2:$,1:$-1) = B(2:$,1:$-1) + diag(6*ones(n-1,1));
+B(1:$-3,4:$) = B(1:$-3,4:$) + diag(-2*ones(n-3,1));
+B(4:$,1:$-3) = B(4:$,1:$-3) + diag(2*ones(n-3,1));
+B1 = sparse(B);
+d0 = spec(B);
+d1 = eigs(B1, speye(n,n), k, 'LM', opts);
+assert_checkalmostequal(abs(d1), gsort(abs(d0($-5:$)),'g','i'), [], %eps);
+d1 = eigs(B, eye(n,n), k, 'LM', opts);
+assert_checkalmostequal(abs(d1), gsort(abs(d0($-5:$)),'g','i'), [], %eps);
+// COMPLEX PROBLEM
+C = diag(5*ones(n,1)+%i*ones(n,1));
+C(1:$-1,2:$) = C(1:$-1,2:$) + diag(6*ones(n-1,1));
+C(2:$,1:$-1) = C(2:$,1:$-1) + diag(6*ones(n-1,1));
+C(1:$-3,4:$) = C(1:$-3,4:$) + diag(2*ones(n-3,1));
+C(4:$,1:$-3) = C(4:$,1:$-3) + diag(2*ones(n-3,1));
+C1 = sparse(C);
+d0= spec(C);
+d1 = eigs(C1, speye(n,n), k, 'LM', opts);
+d = gsort(abs(d0));
+assert_checkalmostequal(gsort(abs(d1)), d(1:k), [], %eps);
+d1 = eigs(C, eye(n,n), k, 'LM', opts);
+assert_checkalmostequal(gsort(abs(d1)), d(1:k), [], %eps);
+// FUNCTION :
+// REAL SYMMETRIC PROBLEM
+clear opts
+function y = fn(x)
+ y = A1 * x;
+endfunction
+opts.isreal = %t;
+opts.issym = %t;
+d1 = eigs(fn, n, [], k, 'LM', opts );
+d0 = spec(A);
+assert_checkalmostequal(gsort(d1,'g','i'), [d0(1);d0($-4:$)], [], %eps);
+clear fn
+function y = fn(x)
+ y = A * x;
+endfunction
+d1 = eigs(fn, n, [], k, 'LM', opts );
+assert_checkalmostequal(gsort(real(d1),'g','i'), [d0(1);d0($-4:$)], [], %eps);
+// REAL NON SYMMETRIC PROBLEM
+clear fn
+function y = fn(x)
+ y = B1 * x;
+endfunction
+opts.isreal = %t;
+opts.issym = %f;
+d1 = eigs(fn, n, [], k, 'LM', opts );
+d0 = spec(B);
+assert_checkalmostequal(abs(d1), gsort(abs(d0($-5:$)),'g','i'), [], %eps);
+clear fn
+//B collides with B inside of feigs, so we rename it ( global variables are evil!)
+globalB = B;
+function y = fn(x)
+ y = globalB * x;
+endfunction
+d1 = eigs(fn, n, [], k, 'LM', opts );
+assert_checkalmostequal(abs(d1), gsort(abs(d0($-5:$)),'g','i'), [], %eps);
+// COMPLEX PROBLEM
+clear fn
+function y = fn(x)
+ y = C1 * x;
+endfunction
+opts.isreal = %f;
+opts.issym = %f;
+d1 = eigs(fn, n, [], k, 'LM', opts );
+d0 = spec(C);
+d = gsort(abs(d0));
+assert_checkalmostequal(gsort(abs(d1)), d(1:k), [], %eps);
+clear fn
+function y = fn(x)
+ y = C * x;
+endfunction
+d1 = eigs(fn, n, [], k, 'LM', opts );
+assert_checkalmostequal(gsort(abs(d1)), d(1:k), [], %eps);
diff --git a/modules/arnoldi/tests/nonreg_tests/bug_11653.tst b/modules/arnoldi/tests/nonreg_tests/bug_11653.tst
new file mode 100755
index 000000000..b9a88eaff
--- /dev/null
+++ b/modules/arnoldi/tests/nonreg_tests/bug_11653.tst
@@ -0,0 +1,136 @@
+// =============================================================================
+// Scilab ( http://www.scilab.org/ ) - This file is part of Scilab
+// Copyright (C) 2012 - Scilab Enterprises - Adeline CARNIS
+//
+// This file is distributed under the same license as the Scilab package.
+// =============================================================================
+
+// <-- CLI SHELL MODE -->
+
+// <-- Non-regression test for bug 11653 -->
+//
+// <-- Bugzilla URL -->
+// http://bugzilla.scilab.org/show_bug.cgi?id=11653
+//
+// <-- Short Description -->
+// Optional booleans in eigs were doubles and are now booleans.
+// =============================================================================
+
+// REAL SYMMETRIC PROBLEM
+clear opts;
+n = 10;
+k = 6;
+A = diag(5*ones(n,1));
+A(1:$-1,2:$) = A(1:$-1,2:$) + diag(6*ones(n-1,1));
+A(2:$,1:$-1) = A(2:$,1:$-1) + diag(6*ones(n-1,1));
+A(1:$-3,4:$) = A(1:$-3,4:$) + diag(2*ones(n-3,1));
+A(4:$,1:$-3) = A(4:$,1:$-3) + diag(2*ones(n-3,1));
+A1 = sparse(A);
+
+opts.cholB = %t;
+d1 = eigs(A1, speye(n,n), k, 'LM', opts);
+d0 = spec(A);
+assert_checkalmostequal(gsort(d1,'g','i'), [d0(1);d0($-4:$)], [], %eps);
+
+d1 = eigs(A, eye(n,n), k, 'LM', opts);
+assert_checkalmostequal(gsort(real(d1),'g','i'), [d0(1);d0($-4:$)], [], %eps);
+
+// REAL NON SYMMETRIC PROBLEM
+B = diag(5*ones(n,1));
+B(1:$-1,2:$) = B(1:$-1,2:$) + diag(-6*ones(n-1,1));
+B(2:$,1:$-1) = B(2:$,1:$-1) + diag(6*ones(n-1,1));
+B(1:$-3,4:$) = B(1:$-3,4:$) + diag(-2*ones(n-3,1));
+B(4:$,1:$-3) = B(4:$,1:$-3) + diag(2*ones(n-3,1));
+B1 = sparse(B);
+d0 = spec(B);
+
+d1 = eigs(B1, speye(n,n), k, 'LM', opts);
+assert_checkalmostequal(abs(d1), gsort(abs(d0($-5:$)),'g','i'), [], %eps);
+
+d1 = eigs(B, eye(n,n), k, 'LM', opts);
+assert_checkalmostequal(abs(d1), gsort(abs(d0($-5:$)),'g','i'), [], %eps);
+
+
+// COMPLEX PROBLEM
+C = diag(5*ones(n,1)+%i*ones(n,1));
+C(1:$-1,2:$) = C(1:$-1,2:$) + diag(6*ones(n-1,1));
+C(2:$,1:$-1) = C(2:$,1:$-1) + diag(6*ones(n-1,1));
+C(1:$-3,4:$) = C(1:$-3,4:$) + diag(2*ones(n-3,1));
+C(4:$,1:$-3) = C(4:$,1:$-3) + diag(2*ones(n-3,1));
+C1 = sparse(C);
+d0= spec(C);
+
+d1 = eigs(C1, speye(n,n), k, 'LM', opts);
+d = gsort(abs(d0));
+assert_checkalmostequal(gsort(abs(d1)), d(1:k), [], %eps);
+
+d1 = eigs(C, eye(n,n), k, 'LM', opts);
+assert_checkalmostequal(gsort(abs(d1)), d(1:k), [], %eps);
+
+
+// FUNCTION :
+// REAL SYMMETRIC PROBLEM
+clear opts
+function y = fn(x)
+ y = A1 * x;
+endfunction
+
+opts.isreal = %t;
+opts.issym = %t;
+
+d1 = eigs(fn, n, [], k, 'LM', opts );
+d0 = spec(A);
+assert_checkalmostequal(gsort(d1,'g','i'), [d0(1);d0($-4:$)], [], %eps);
+
+clear fn
+function y = fn(x)
+ y = A * x;
+endfunction
+
+d1 = eigs(fn, n, [], k, 'LM', opts );
+assert_checkalmostequal(gsort(real(d1),'g','i'), [d0(1);d0($-4:$)], [], %eps);
+
+// REAL NON SYMMETRIC PROBLEM
+clear fn
+function y = fn(x)
+ y = B1 * x;
+endfunction
+
+opts.isreal = %t;
+opts.issym = %f;
+
+d1 = eigs(fn, n, [], k, 'LM', opts );
+d0 = spec(B);
+assert_checkalmostequal(abs(d1), gsort(abs(d0($-5:$)),'g','i'), [], %eps);
+
+clear fn
+//B collides with B inside of feigs, so we rename it ( global variables are evil!)
+globalB = B;
+function y = fn(x)
+ y = globalB * x;
+endfunction
+
+d1 = eigs(fn, n, [], k, 'LM', opts );
+assert_checkalmostequal(abs(d1), gsort(abs(d0($-5:$)),'g','i'), [], %eps);
+
+// COMPLEX PROBLEM
+clear fn
+function y = fn(x)
+ y = C1 * x;
+endfunction
+
+opts.isreal = %f;
+opts.issym = %f;
+
+d1 = eigs(fn, n, [], k, 'LM', opts );
+d0 = spec(C);
+d = gsort(abs(d0));
+assert_checkalmostequal(gsort(abs(d1)), d(1:k), [], %eps);
+
+clear fn
+function y = fn(x)
+ y = C * x;
+endfunction
+
+d1 = eigs(fn, n, [], k, 'LM', opts );
+assert_checkalmostequal(gsort(abs(d1)), d(1:k), [], %eps);
diff --git a/modules/arnoldi/tests/nonreg_tests/bug_12120.dia.ref b/modules/arnoldi/tests/nonreg_tests/bug_12120.dia.ref
new file mode 100755
index 000000000..2c0980ed7
--- /dev/null
+++ b/modules/arnoldi/tests/nonreg_tests/bug_12120.dia.ref
@@ -0,0 +1,18 @@
+// =============================================================================
+// Scilab ( http://www.scilab.org/ ) - This file is part of Scilab
+// Copyright (C) 2012 - Scilab Enterprises - Sylvestre Ledru
+//
+// This file is distributed under the same license as the Scilab package.
+// =============================================================================
+// <-- CLI SHELL MODE -->
+// <-- Non-regression test for bug 12120 -->
+//
+// <-- Bugzilla URL -->
+// http://bugzilla.scilab.org/show_bug.cgi?id=12120
+//
+// <-- Short Description -->
+// eigs is broken for complex sparse matrices
+// =============================================================================
+A = %i * speye(10,10);
+a=eigs(A, [], 3, 'SM');
+assert_checkequal(size(a),[3, 1]);
diff --git a/modules/arnoldi/tests/nonreg_tests/bug_12120.tst b/modules/arnoldi/tests/nonreg_tests/bug_12120.tst
new file mode 100755
index 000000000..b24163d20
--- /dev/null
+++ b/modules/arnoldi/tests/nonreg_tests/bug_12120.tst
@@ -0,0 +1,22 @@
+// =============================================================================
+// Scilab ( http://www.scilab.org/ ) - This file is part of Scilab
+// Copyright (C) 2012 - Scilab Enterprises - Sylvestre Ledru
+//
+// This file is distributed under the same license as the Scilab package.
+// =============================================================================
+
+// <-- CLI SHELL MODE -->
+
+// <-- Non-regression test for bug 12120 -->
+//
+// <-- Bugzilla URL -->
+// http://bugzilla.scilab.org/show_bug.cgi?id=12120
+//
+// <-- Short Description -->
+// eigs is broken for complex sparse matrices
+// =============================================================================
+
+A = %i * speye(10,10);
+a=eigs(A, [], 3, 'SM');
+assert_checkequal(size(a),[3, 1]);
+
diff --git a/modules/arnoldi/tests/nonreg_tests/bug_12137.dia.ref b/modules/arnoldi/tests/nonreg_tests/bug_12137.dia.ref
new file mode 100755
index 000000000..5a849b106
--- /dev/null
+++ b/modules/arnoldi/tests/nonreg_tests/bug_12137.dia.ref
@@ -0,0 +1,34 @@
+// =============================================================================
+// Scilab ( http://www.scilab.org/ ) - This file is part of Scilab
+// Copyright (C) 2012 - Scilab Enterprises - Sylvestre Ledru
+//
+// This file is distributed under the same license as the Scilab package.
+// =============================================================================
+// <-- CLI SHELL MODE -->
+// <-- Non-regression test for bug 12137 -->
+//
+// <-- Bugzilla URL -->
+// http://bugzilla.scilab.org/show_bug.cgi?id=12137
+//
+// <-- Short Description -->
+// eigs(A,B) returns incorrect result for sparse matrices
+// =============================================================================
+A=sparse(toeplitz([1 0 0 3 0 5 0 3 0 0 1]));
+B=[
+3., 0., 0., 2., 0., 0., 2., 0., 2., 0., 0. ;
+0., 5., 4., 0., 0., 0., 0., 0., 0., 0., 0. ;
+0., 4., 5., 0., 0., 0., 0., 0., 0., 0., 0. ;
+2., 0., 0., 3., 0., 0., 2., 0., 2., 0., 0. ;
+0., 0., 0., 0. , 5., 0., 0., 0., 0., 0., 4. ;
+0., 0., 0., 0., 0., 4., 0., 3., 0., 3., 0. ;
+2., 0., 0., 2., 0., 0., 3., 0., 2., 0., 0. ;
+0., 0., 0., 0., 0., 3., 0., 4., 0., 3., 0. ;
+2., 0., 0., 2., 0., 0., 2., 0., 3., 0., 0. ;
+0., 0., 0., 0., 0., 3., 0., 3., 0., 4., 0. ;
+0., 0., 0., 0., 4., 0., 0., 0., 0., 0., 5.];
+B=sparse(B);
+C=eigs(A,B,10);
+[a b] = spec(full(A), full(B));
+C1=gsort(a./b, "g", "i");
+C1(1)=[]; // remove the small value
+assert_checkalmostequal(C1, C);
diff --git a/modules/arnoldi/tests/nonreg_tests/bug_12137.tst b/modules/arnoldi/tests/nonreg_tests/bug_12137.tst
new file mode 100755
index 000000000..4d593e1a5
--- /dev/null
+++ b/modules/arnoldi/tests/nonreg_tests/bug_12137.tst
@@ -0,0 +1,39 @@
+// =============================================================================
+// Scilab ( http://www.scilab.org/ ) - This file is part of Scilab
+// Copyright (C) 2012 - Scilab Enterprises - Sylvestre Ledru
+//
+// This file is distributed under the same license as the Scilab package.
+// =============================================================================
+
+// <-- CLI SHELL MODE -->
+
+// <-- Non-regression test for bug 12137 -->
+//
+// <-- Bugzilla URL -->
+// http://bugzilla.scilab.org/show_bug.cgi?id=12137
+//
+// <-- Short Description -->
+// eigs(A,B) returns incorrect result for sparse matrices
+// =============================================================================
+
+A=sparse(toeplitz([1 0 0 3 0 5 0 3 0 0 1]));
+
+B=[
+3., 0., 0., 2., 0., 0., 2., 0., 2., 0., 0. ;
+0., 5., 4., 0., 0., 0., 0., 0., 0., 0., 0. ;
+0., 4., 5., 0., 0., 0., 0., 0., 0., 0., 0. ;
+2., 0., 0., 3., 0., 0., 2., 0., 2., 0., 0. ;
+0., 0., 0., 0. , 5., 0., 0., 0., 0., 0., 4. ;
+0., 0., 0., 0., 0., 4., 0., 3., 0., 3., 0. ;
+2., 0., 0., 2., 0., 0., 3., 0., 2., 0., 0. ;
+0., 0., 0., 0., 0., 3., 0., 4., 0., 3., 0. ;
+2., 0., 0., 2., 0., 0., 2., 0., 3., 0., 0. ;
+0., 0., 0., 0., 0., 3., 0., 3., 0., 4., 0. ;
+0., 0., 0., 0., 4., 0., 0., 0., 0., 0., 5.];
+B=sparse(B);
+C=eigs(A,B,10);
+
+[a b] = spec(full(A), full(B));
+C1=gsort(a./b, "g", "i");
+C1(1)=[]; // remove the small value
+assert_checkalmostequal(C1, C);
diff --git a/modules/arnoldi/tests/nonreg_tests/bug_12138.dia.ref b/modules/arnoldi/tests/nonreg_tests/bug_12138.dia.ref
new file mode 100755
index 000000000..a40050a17
--- /dev/null
+++ b/modules/arnoldi/tests/nonreg_tests/bug_12138.dia.ref
@@ -0,0 +1,81 @@
+// =============================================================================
+// Scilab ( http://www.scilab.org/ ) - This file is part of Scilab
+// Copyright (C) 2012 - Scilab Enterprises - Sylvestre Ledru
+//
+// This file is distributed under the same license as the Scilab package.
+// =============================================================================
+// <-- CLI SHELL MODE -->
+// <-- Non-regression test for bug 12138 -->
+//
+// <-- Bugzilla URL -->
+// http://bugzilla.scilab.org/show_bug.cgi?id=12138
+//
+// <-- Short Description -->
+// eigs(A,B) returns incorrect eigenvectors for dense matrices
+// =============================================================================
+//non symmetric case
+A = rand(10,10);
+[d v] = eigs(A);
+assert_checkalmostequal(norm(A*v-v*d),0,[], 1D-8);
+[d v] = eigs(A,[],8,'SM');
+assert_checkalmostequal(norm(A*v-v*d),0,[], 1D-8);
+[d v] = eigs(A,[],8,1);
+assert_checkalmostequal(norm(A*v-v*d),0,[], 1D-8);
+[d v] = eigs(A,[],8,%i);
+assert_checkalmostequal(norm(A*v-v*d),0,[], 1D-8);
+//symmetric case
+A=rand(10,10);
+A = A*A';
+[d v] = eigs(A);
+assert_checkalmostequal(norm(A*v-v*d),0,[], 1D-8);
+//general eigenvalue problem
+B = rand(10,10);
+B = B*B';
+A = rand(10,10);
+[d v] = eigs(A,B);
+assert_checkalmostequal(norm(A*v-B*v*d),0,[],1D-8);
+[d v] = eigs(A,B,8,'SM');
+assert_checkalmostequal(norm(A*v-B*v*d),0,[],1D-8);
+[d v] = eigs(A,B,8, 1);
+assert_checkalmostequal(norm(A*v-B*v*d),0,[],1D-8);
+[d v] = eigs(A,B, 8, %i);
+assert_checkalmostequal(norm(A*v-B*v*d),0,[],1D-8);
+opts.cholB = %t;
+R = chol(B);
+[d v] = eigs(A, R, 8, 'LM', opts);
+assert_checkalmostequal(norm(A*v-B*v*d),0,[],1D-8);
+[d v] = eigs(A, R, 8,'SM', opts);
+assert_checkalmostequal(norm(A*v-B*v*d),0,[],1D-8);
+[d v] = eigs(A, R, 8, 1, opts);
+assert_checkalmostequal(norm(A*v-B*v*d),0,[],1D-8);
+[d v] = eigs(A, R, 8, %i, opts);
+assert_checkalmostequal(norm(A*v-B*v*d),0,[],1D-8);
+A=A*A';
+[d v] = eigs(A,B);
+assert_checkalmostequal(norm(A*v-B*v*d),0,[],1D-8);
+[d v] = eigs(A,B,8,'SM');
+assert_checkalmostequal(norm(A*v-B*v*d),0,[],1D-8);
+[d v] = eigs(A,B,8,1);
+assert_checkalmostequal(norm(A*v-B*v*d),0,[],1D-8);
+[d v] = eigs(A,B,8,%i);
+assert_checkalmostequal(norm(A*v-B*v*d),0,[],1D-8);
+//complex case
+A1 = rand(10,10);
+A2 = rand(10,10);
+B1 = rand(10,10);
+B2 = rand(10,10);
+C1 = A1+%i*A2;
+[d v] = eigs(C1);
+assert_checkalmostequal(norm(C1*v-v*d),0,[],1D-8);
+[d v] = eigs(C1,[], 8,'SM');
+assert_checkalmostequal(norm(C1*v-v*d),0,[],1D-8);
+[d v] = eigs(C1, [],8, 1+%i);
+assert_checkalmostequal(norm(C1*v-v*d),0,[],1D-8);
+C2 = B1+%i*B2;
+C2=C2*C2';
+[d v] = eigs(C1, C2);
+assert_checkalmostequal(norm(C1*v-C2*v*d),0,[],1D-8);
+[d v] = eigs(C1, C2, 8, 'SM');
+assert_checkalmostequal(norm(C1*v-C2*v*d),0,[],1D-8);
+[d v] = eigs(C1, C2, 8, %i);
+assert_checkalmostequal(norm(C1*v-C2*v*d),0,[],1D-8);
diff --git a/modules/arnoldi/tests/nonreg_tests/bug_12138.tst b/modules/arnoldi/tests/nonreg_tests/bug_12138.tst
new file mode 100755
index 000000000..c83c2519d
--- /dev/null
+++ b/modules/arnoldi/tests/nonreg_tests/bug_12138.tst
@@ -0,0 +1,90 @@
+// =============================================================================
+// Scilab ( http://www.scilab.org/ ) - This file is part of Scilab
+// Copyright (C) 2012 - Scilab Enterprises - Sylvestre Ledru
+//
+// This file is distributed under the same license as the Scilab package.
+// =============================================================================
+
+// <-- CLI SHELL MODE -->
+
+// <-- Non-regression test for bug 12138 -->
+//
+// <-- Bugzilla URL -->
+// http://bugzilla.scilab.org/show_bug.cgi?id=12138
+//
+// <-- Short Description -->
+// eigs(A,B) returns incorrect eigenvectors for dense matrices
+// =============================================================================
+
+//non symmetric case
+A = rand(10,10);
+[d v] = eigs(A);
+assert_checkalmostequal(norm(A*v-v*d),0,[], 1D-8);
+[d v] = eigs(A,[],8,'SM');
+assert_checkalmostequal(norm(A*v-v*d),0,[], 1D-8);
+[d v] = eigs(A,[],8,1);
+assert_checkalmostequal(norm(A*v-v*d),0,[], 1D-8);
+[d v] = eigs(A,[],8,%i);
+assert_checkalmostequal(norm(A*v-v*d),0,[], 1D-8);
+
+//symmetric case
+A=rand(10,10);
+A = A*A';
+[d v] = eigs(A);
+assert_checkalmostequal(norm(A*v-v*d),0,[], 1D-8);
+
+//general eigenvalue problem
+B = rand(10,10);
+B = B*B';
+A = rand(10,10);
+[d v] = eigs(A,B);
+assert_checkalmostequal(norm(A*v-B*v*d),0,[],1D-8);
+[d v] = eigs(A,B,8,'SM');
+assert_checkalmostequal(norm(A*v-B*v*d),0,[],1D-8);
+[d v] = eigs(A,B,8, 1);
+assert_checkalmostequal(norm(A*v-B*v*d),0,[],1D-8);
+[d v] = eigs(A,B, 8, %i);
+assert_checkalmostequal(norm(A*v-B*v*d),0,[],1D-8);
+
+opts.cholB = %t;
+R = chol(B);
+[d v] = eigs(A, R, 8, 'LM', opts);
+assert_checkalmostequal(norm(A*v-B*v*d),0,[],1D-8);
+[d v] = eigs(A, R, 8,'SM', opts);
+assert_checkalmostequal(norm(A*v-B*v*d),0,[],1D-8);
+[d v] = eigs(A, R, 8, 1, opts);
+assert_checkalmostequal(norm(A*v-B*v*d),0,[],1D-8);
+[d v] = eigs(A, R, 8, %i, opts);
+assert_checkalmostequal(norm(A*v-B*v*d),0,[],1D-8);
+
+A=A*A';
+[d v] = eigs(A,B);
+assert_checkalmostequal(norm(A*v-B*v*d),0,[],1D-8);
+[d v] = eigs(A,B,8,'SM');
+assert_checkalmostequal(norm(A*v-B*v*d),0,[],1D-8);
+[d v] = eigs(A,B,8,1);
+assert_checkalmostequal(norm(A*v-B*v*d),0,[],1D-8);
+[d v] = eigs(A,B,8,%i);
+assert_checkalmostequal(norm(A*v-B*v*d),0,[],1D-8);
+
+
+//complex case
+A1 = rand(10,10);
+A2 = rand(10,10);
+B1 = rand(10,10);
+B2 = rand(10,10);
+C1 = A1+%i*A2;
+[d v] = eigs(C1);
+assert_checkalmostequal(norm(C1*v-v*d),0,[],1D-8);
+[d v] = eigs(C1,[], 8,'SM');
+assert_checkalmostequal(norm(C1*v-v*d),0,[],1D-8);
+[d v] = eigs(C1, [],8, 1+%i);
+assert_checkalmostequal(norm(C1*v-v*d),0,[],1D-8);
+C2 = B1+%i*B2;
+C2=C2*C2';
+[d v] = eigs(C1, C2);
+assert_checkalmostequal(norm(C1*v-C2*v*d),0,[],1D-8);
+[d v] = eigs(C1, C2, 8, 'SM');
+assert_checkalmostequal(norm(C1*v-C2*v*d),0,[],1D-8);
+[d v] = eigs(C1, C2, 8, %i);
+assert_checkalmostequal(norm(C1*v-C2*v*d),0,[],1D-8);
diff --git a/modules/arnoldi/tests/nonreg_tests/bug_12139.dia.ref b/modules/arnoldi/tests/nonreg_tests/bug_12139.dia.ref
new file mode 100755
index 000000000..6973e9e34
--- /dev/null
+++ b/modules/arnoldi/tests/nonreg_tests/bug_12139.dia.ref
@@ -0,0 +1,17 @@
+// =============================================================================
+// Scilab ( http://www.scilab.org/ ) - This file is part of Scilab
+// Copyright (C) 2013 - Scilab Enterprises - Sylvestre Ledru
+//
+// This file is distributed under the same license as the Scilab package.
+// =============================================================================
+// <-- CLI SHELL MODE -->
+// <-- Non-regression test for bug 12139 -->
+//
+// <-- Bugzilla URL -->
+// http://bugzilla.scilab.org/show_bug.cgi?id=12139
+//
+// <-- Short Description -->
+// eigs run out of memory for sparse matrices.
+// =============================================================================
+A = speye(100000,100000);
+assert_checkalmostequal(eigs(A), [1;1;1;1;1;1]);
diff --git a/modules/arnoldi/tests/nonreg_tests/bug_12139.tst b/modules/arnoldi/tests/nonreg_tests/bug_12139.tst
new file mode 100755
index 000000000..99752c14c
--- /dev/null
+++ b/modules/arnoldi/tests/nonreg_tests/bug_12139.tst
@@ -0,0 +1,20 @@
+// =============================================================================
+// Scilab ( http://www.scilab.org/ ) - This file is part of Scilab
+// Copyright (C) 2013 - Scilab Enterprises - Sylvestre Ledru
+//
+// This file is distributed under the same license as the Scilab package.
+// =============================================================================
+
+// <-- CLI SHELL MODE -->
+
+// <-- Non-regression test for bug 12139 -->
+//
+// <-- Bugzilla URL -->
+// http://bugzilla.scilab.org/show_bug.cgi?id=12139
+//
+// <-- Short Description -->
+// eigs run out of memory for sparse matrices.
+// =============================================================================
+
+A = speye(100000,100000);
+assert_checkalmostequal(eigs(A), [1;1;1;1;1;1]);
diff --git a/modules/arnoldi/tests/nonreg_tests/bug_12238.dia.ref b/modules/arnoldi/tests/nonreg_tests/bug_12238.dia.ref
new file mode 100755
index 000000000..cdd3de45c
--- /dev/null
+++ b/modules/arnoldi/tests/nonreg_tests/bug_12238.dia.ref
@@ -0,0 +1,19 @@
+// =============================================================================
+// Scilab ( http://www.scilab.org/ ) - This file is part of Scilab
+// Copyright (C) 2013 - Scilab Enterprises - Sylvestre Ledru
+//
+// This file is distributed under the same license as the Scilab package.
+// =============================================================================
+// <-- CLI SHELL MODE -->
+// <-- Non-regression test for bug 12238 -->
+//
+// <-- Bugzilla URL -->
+// http://bugzilla.scilab.org/show_bug.cgi?id=12238
+//
+// <-- Short Description -->
+// [d v] = eigs(A) is broken for sparse matrices
+// =============================================================================
+A = sparse(rand(10,10));
+[d v] = eigs(A);
+val=norm(A*v-v*d);
+assert_checkalmostequal(val,0,0,30*%eps);
diff --git a/modules/arnoldi/tests/nonreg_tests/bug_12238.tst b/modules/arnoldi/tests/nonreg_tests/bug_12238.tst
new file mode 100755
index 000000000..1c2a5c28c
--- /dev/null
+++ b/modules/arnoldi/tests/nonreg_tests/bug_12238.tst
@@ -0,0 +1,23 @@
+// =============================================================================
+// Scilab ( http://www.scilab.org/ ) - This file is part of Scilab
+// Copyright (C) 2013 - Scilab Enterprises - Sylvestre Ledru
+//
+// This file is distributed under the same license as the Scilab package.
+// =============================================================================
+
+// <-- CLI SHELL MODE -->
+
+// <-- Non-regression test for bug 12238 -->
+//
+// <-- Bugzilla URL -->
+// http://bugzilla.scilab.org/show_bug.cgi?id=12238
+//
+// <-- Short Description -->
+// [d v] = eigs(A) is broken for sparse matrices
+// =============================================================================
+
+A = sparse(rand(10,10));
+[d v] = eigs(A);
+val=norm(A*v-v*d);
+
+assert_checkalmostequal(val,0,0,30*%eps);
diff --git a/modules/arnoldi/tests/nonreg_tests/bug_12772.dia.ref b/modules/arnoldi/tests/nonreg_tests/bug_12772.dia.ref
new file mode 100755
index 000000000..a06a1d22e
--- /dev/null
+++ b/modules/arnoldi/tests/nonreg_tests/bug_12772.dia.ref
@@ -0,0 +1,23 @@
+// =============================================================================
+// Scilab ( http://www.scilab.org/ ) - This file is part of Scilab
+// Copyright (C) 2013 - Scilab Enterprises - Adeline CARNIS
+//
+// This file is distributed under the same license as the Scilab package.
+// =============================================================================
+// <-- CLI SHELL MODE -->
+// <-- Non-regression test for bug 12772 -->
+//
+// <-- Bugzilla URL -->
+// http://bugzilla.scilab.org/show_bug.cgi?id=12772
+//
+// <-- Short Description -->
+// eigs() failed when trying to solve a sparse matrix eigen value problem.
+// =============================================================================
+C1 = -51*eye(10,10);
+C1(1:$-1, 2:$) = C1(1:$-1,2:$) + diag(100*ones(9,1));
+C1(2:$,1:$-1) = C1(2:$,1:$-1) + diag(100*ones(9,1));
+C1(10,9) = 116;
+C1(10,10) = -147;
+C1 = sparse(C1);
+[d, v] = eigs(C1,sparse(eye(10,10)), 1, 480);
+assert_checkalmostequal(C1*v, v*d, sqrt(%eps), 1.e-10);
diff --git a/modules/arnoldi/tests/nonreg_tests/bug_12772.tst b/modules/arnoldi/tests/nonreg_tests/bug_12772.tst
new file mode 100755
index 000000000..45068c45b
--- /dev/null
+++ b/modules/arnoldi/tests/nonreg_tests/bug_12772.tst
@@ -0,0 +1,27 @@
+// =============================================================================
+// Scilab ( http://www.scilab.org/ ) - This file is part of Scilab
+// Copyright (C) 2013 - Scilab Enterprises - Adeline CARNIS
+//
+// This file is distributed under the same license as the Scilab package.
+// =============================================================================
+
+// <-- CLI SHELL MODE -->
+
+// <-- Non-regression test for bug 12772 -->
+//
+// <-- Bugzilla URL -->
+// http://bugzilla.scilab.org/show_bug.cgi?id=12772
+//
+// <-- Short Description -->
+// eigs() failed when trying to solve a sparse matrix eigen value problem.
+// =============================================================================
+
+C1 = -51*eye(10,10);
+C1(1:$-1, 2:$) = C1(1:$-1,2:$) + diag(100*ones(9,1));
+C1(2:$,1:$-1) = C1(2:$,1:$-1) + diag(100*ones(9,1));
+C1(10,9) = 116;
+C1(10,10) = -147;
+C1 = sparse(C1);
+
+[d, v] = eigs(C1,sparse(eye(10,10)), 1, 480);
+assert_checkalmostequal(C1*v, v*d, sqrt(%eps), 1.e-10);
diff --git a/modules/arnoldi/tests/nonreg_tests/bug_12992.dia.ref b/modules/arnoldi/tests/nonreg_tests/bug_12992.dia.ref
new file mode 100755
index 000000000..d1b4a2946
--- /dev/null
+++ b/modules/arnoldi/tests/nonreg_tests/bug_12992.dia.ref
@@ -0,0 +1,29 @@
+// =============================================================================
+// Scilab ( http://www.scilab.org/ ) - This file is part of Scilab
+// Copyright (C) 2013 - Scilab Enterprises - Adeline CARNIS
+//
+// This file is distributed under the same license as the Scilab package.
+// =============================================================================
+// <-- CLI SHELL MODE -->
+// <-- Non-regression test for bug 12992 -->
+//
+// <-- Bugzilla URL -->
+// http://bugzilla.scilab.org/show_bug.cgi?id=12992
+//
+// <-- Short Description -->
+// The sigma value was always equals to "LM".
+// =============================================================================
+A = [11,2,3,1,4; 2,9,3,5,2; 3,3,15,4,3; 1,5,4,12,4; 4,2,3,4,17];
+B = eye(5,5);
+k = 1;
+sigma = 'SM';
+cld = eigs(A, B, k, sigma);
+d0 = spec(A);
+assert_checkalmostequal(cld, d0(1), [], %eps);
+[d, v] = eigs(A, B, k, sigma);
+[d0, v0] = spec(A);
+assert_checkalmostequal(d, v0(1), [], %eps);
+assert_checkalmostequal(abs(v), abs(d0(:,1)), [], %eps)
+ ans =
+
+ T
diff --git a/modules/arnoldi/tests/nonreg_tests/bug_12992.tst b/modules/arnoldi/tests/nonreg_tests/bug_12992.tst
new file mode 100755
index 000000000..86a00cdb8
--- /dev/null
+++ b/modules/arnoldi/tests/nonreg_tests/bug_12992.tst
@@ -0,0 +1,29 @@
+// =============================================================================
+// Scilab ( http://www.scilab.org/ ) - This file is part of Scilab
+// Copyright (C) 2013 - Scilab Enterprises - Adeline CARNIS
+//
+// This file is distributed under the same license as the Scilab package.
+// =============================================================================
+
+// <-- CLI SHELL MODE -->
+
+// <-- Non-regression test for bug 12992 -->
+//
+// <-- Bugzilla URL -->
+// http://bugzilla.scilab.org/show_bug.cgi?id=12992
+//
+// <-- Short Description -->
+// The sigma value was always equals to "LM".
+// =============================================================================
+
+A = [11,2,3,1,4; 2,9,3,5,2; 3,3,15,4,3; 1,5,4,12,4; 4,2,3,4,17];
+B = eye(5,5);
+k = 1;
+sigma = 'SM';
+cld = eigs(A, B, k, sigma);
+d0 = spec(A);
+assert_checkalmostequal(cld, d0(1), [], %eps);
+[d, v] = eigs(A, B, k, sigma);
+[d0, v0] = spec(A);
+assert_checkalmostequal(d, v0(1), [], %eps);
+assert_checkalmostequal(abs(v), abs(d0(:,1)), [], %eps)
diff --git a/modules/arnoldi/tests/nonreg_tests/bug_13058.dia.ref b/modules/arnoldi/tests/nonreg_tests/bug_13058.dia.ref
new file mode 100755
index 000000000..c4f47b19d
--- /dev/null
+++ b/modules/arnoldi/tests/nonreg_tests/bug_13058.dia.ref
@@ -0,0 +1,26 @@
+// =============================================================================
+// Scilab ( http://www.scilab.org/ ) - This file is part of Scilab
+// Copyright (C) 2014 - Scilab Enterprises - Adeline CARNIS
+//
+// This file is distributed under the same license as the Scilab package.
+// =============================================================================
+// <-- CLI SHELL MODE -->
+// <-- Non-regression test for bug 13058 -->
+//
+// <-- Bugzilla URL -->
+// http://bugzilla.scilab.org/show_bug.cgi?id=13058
+//
+// <-- Short Description -->
+// The release 3.1.4 of arpack ng library fixes this bug.
+// =============================================================================
+A = [2.486880466472303 2.008746355685131 1.655976676384840 1.571428571428571 1.469387755102041 1.635568513119533 1.927113702623907
+2.008746355685131 2.364431486880466 1.967930029154519 1.696793002915452 1.551020408163265 1.530612244897959 1.635568513119533
+1.655976676384840 1.967930029154519 2.405247813411079 1.947521865889213 1.758017492711370 1.551020408163265 1.469387755102041
+1.571428571428571 1.696793002915452 1.947521865889213 2.323615160349854 1.947521865889213 1.696793002915452 1.571428571428571
+1.469387755102041 1.551020408163265 1.758017492711370 1.947521865889213 2.405247813411079 1.967930029154519 1.655976676384840
+1.635568513119533 1.530612244897959 1.551020408163265 1.696793002915452 1.967930029154519 2.364431486880466 2.008746355685131
+1.927113702623907 1.635568513119533 1.469387755102041 1.571428571428571 1.655976676384840 2.008746355685131 2.486880466472303];
+d0 = spec(A);
+B = eye(7, 7);
+d1 = eigs(A, B, 4, "BE");
+assert_checkalmostequal(d1, [d0(1:2); d0($-1:$)], 1.e-12);
diff --git a/modules/arnoldi/tests/nonreg_tests/bug_13058.tst b/modules/arnoldi/tests/nonreg_tests/bug_13058.tst
new file mode 100755
index 000000000..84e04ed11
--- /dev/null
+++ b/modules/arnoldi/tests/nonreg_tests/bug_13058.tst
@@ -0,0 +1,31 @@
+// =============================================================================
+// Scilab ( http://www.scilab.org/ ) - This file is part of Scilab
+// Copyright (C) 2014 - Scilab Enterprises - Adeline CARNIS
+//
+// This file is distributed under the same license as the Scilab package.
+// =============================================================================
+
+// <-- CLI SHELL MODE -->
+
+// <-- Non-regression test for bug 13058 -->
+//
+// <-- Bugzilla URL -->
+// http://bugzilla.scilab.org/show_bug.cgi?id=13058
+//
+// <-- Short Description -->
+// The release 3.1.4 of arpack ng library fixes this bug.
+// =============================================================================
+
+A = [2.486880466472303 2.008746355685131 1.655976676384840 1.571428571428571 1.469387755102041 1.635568513119533 1.927113702623907
+2.008746355685131 2.364431486880466 1.967930029154519 1.696793002915452 1.551020408163265 1.530612244897959 1.635568513119533
+1.655976676384840 1.967930029154519 2.405247813411079 1.947521865889213 1.758017492711370 1.551020408163265 1.469387755102041
+1.571428571428571 1.696793002915452 1.947521865889213 2.323615160349854 1.947521865889213 1.696793002915452 1.571428571428571
+1.469387755102041 1.551020408163265 1.758017492711370 1.947521865889213 2.405247813411079 1.967930029154519 1.655976676384840
+1.635568513119533 1.530612244897959 1.551020408163265 1.696793002915452 1.967930029154519 2.364431486880466 2.008746355685131
+1.927113702623907 1.635568513119533 1.469387755102041 1.571428571428571 1.655976676384840 2.008746355685131 2.486880466472303];
+
+d0 = spec(A);
+
+B = eye(7, 7);
+d1 = eigs(A, B, 4, "BE");
+assert_checkalmostequal(d1, [d0(1:2); d0($-1:$)], 1.e-12);
diff --git a/modules/arnoldi/tests/nonreg_tests/bug_13381.dia.ref b/modules/arnoldi/tests/nonreg_tests/bug_13381.dia.ref
new file mode 100755
index 000000000..6552dfb3e
--- /dev/null
+++ b/modules/arnoldi/tests/nonreg_tests/bug_13381.dia.ref
@@ -0,0 +1,23 @@
+// =============================================================================
+// Scilab ( http://www.scilab.org/ ) - This file is part of Scilab
+// Copyright (C) 2014 - Scilab Enterprises - Pierre-Aime Agnel
+//
+// This file is distributed under the same license as the Scilab package.
+// =============================================================================
+//
+// <-- Non-regression test for bug -->
+//
+// <-- Bugzilla URL -->
+// http://bugzilla.scilab.org/13381
+//
+// <-- Short Description -->
+// eigs failed due to a typo on varargin
+//
+// <-- CLI SHELL MODE -->
+function y = f(x)
+ A = diag(-10:10);
+ y = A*x;
+endfunction
+[d, v] = eigs(f, 21, eye(21, 21), 7);
+d2 = eigs(f, 21, eye(21, 21), 7);
+assert_checkfalse(isempty(v));
diff --git a/modules/arnoldi/tests/nonreg_tests/bug_13381.tst b/modules/arnoldi/tests/nonreg_tests/bug_13381.tst
new file mode 100755
index 000000000..6ff2f22f3
--- /dev/null
+++ b/modules/arnoldi/tests/nonreg_tests/bug_13381.tst
@@ -0,0 +1,26 @@
+// =============================================================================
+// Scilab ( http://www.scilab.org/ ) - This file is part of Scilab
+// Copyright (C) 2014 - Scilab Enterprises - Pierre-Aime Agnel
+//
+// This file is distributed under the same license as the Scilab package.
+// =============================================================================
+//
+// <-- Non-regression test for bug -->
+//
+// <-- Bugzilla URL -->
+// http://bugzilla.scilab.org/13381
+//
+// <-- Short Description -->
+// eigs failed due to a typo on varargin
+//
+// <-- CLI SHELL MODE -->
+
+function y = f(x)
+ A = diag(-10:10);
+ y = A*x;
+endfunction
+
+[d, v] = eigs(f, 21, eye(21, 21), 7);
+d2 = eigs(f, 21, eye(21, 21), 7);
+
+assert_checkfalse(isempty(v));
diff --git a/modules/arnoldi/tests/nonreg_tests/bug_dsaupd.dia.ref b/modules/arnoldi/tests/nonreg_tests/bug_dsaupd.dia.ref
new file mode 100755
index 000000000..2d22910a4
--- /dev/null
+++ b/modules/arnoldi/tests/nonreg_tests/bug_dsaupd.dia.ref
@@ -0,0 +1,54 @@
+// =============================================================================
+// Scilab ( http://www.scilab.org/ ) - This file is part of Scilab
+// Copyright (C) 2008 - INRIA - Vincent COUVERT <vincent.couvert@inria.fr>
+//
+// This file is distributed under the same license as the Scilab package.
+// =============================================================================
+// <-- CLI SHELL MODE -->
+// Tests for function dsaupd (added after a bug in the gateway: PutLhsVar missing)
+stacksize(300000);
+N = 1000;
+A = sprand(N, N, 0.01);
+IDO = 0;
+BMAT = 'I'; //standard eigenvalue problem
+WHICH = "LM";
+NEV = 4; //NEVth eigen values are solved
+TOL = 1D-10;
+RESID = zeros(N,1); //
+NCV = 10;
+V = zeros(N, NCV);
+ISHIFT = 1;
+LEVEC = 0;
+MXITER = 100; //INPUT
+NB = 1;
+NCONV = 0;
+IUPD = 0;
+MODE = 1;
+NP = 100;
+NUMOP = 0;
+NUMOPB = 0;
+NUMREO = 0;
+IPARAM = [ISHIFT, LEVEC, MXITER, NB, NCONV, IUPD, MODE, NP, NUMOP, NUMOPB, NUMREO];
+IPNTR = zeros(1,14);
+WORKD = zeros(3, N);
+WORKL = zeros(1, NCV**2 + 8 * NCV);
+INFO = 0;
+i = 0;
+tic();
+[IDO,RESID,V,IPARAM,IPNTR,WORKD,WORKL,INFO] = dsaupd(IDO,BMAT,N,WHICH,NEV,TOL,RESID,NCV,V,IPARAM,IPNTR,WORKD,WORKL,INFO);
+while (IDO <> 99) & (IDO <> 3)
+ [IDO,RESID,V,IPARAM,IPNTR,WORKD,WORKL,INFO] = dsaupd(IDO,BMAT,N,WHICH,NEV,TOL,RESID,NCV,V,IPARAM,IPNTR,WORKD,WORKL,INFO);
+ if (IDO == 1) then
+ WORKD(IPNTR(2):(IPNTR(2)+N - 1)) = A * WORKD(IPNTR(1):(IPNTR(1)+N - 1));
+ elseif (IDO == 3) then
+ end;
+ i = i + 1;
+end;
+t1 = toc();
+printf("loop %d",i);
+loop 77b = rand(N,1);
+tic();
+for j = 1:i
+ b = A * b;
+end
+toc();
diff --git a/modules/arnoldi/tests/nonreg_tests/bug_dsaupd.tst b/modules/arnoldi/tests/nonreg_tests/bug_dsaupd.tst
new file mode 100755
index 000000000..7403fad05
--- /dev/null
+++ b/modules/arnoldi/tests/nonreg_tests/bug_dsaupd.tst
@@ -0,0 +1,70 @@
+// =============================================================================
+// Scilab ( http://www.scilab.org/ ) - This file is part of Scilab
+// Copyright (C) 2008 - INRIA - Vincent COUVERT <vincent.couvert@inria.fr>
+//
+// This file is distributed under the same license as the Scilab package.
+// =============================================================================
+
+// <-- CLI SHELL MODE -->
+
+// Tests for function dsaupd (added after a bug in the gateway: PutLhsVar missing)
+
+stacksize(300000);
+
+N = 1000;
+
+A = sprand(N, N, 0.01);
+
+IDO = 0;
+BMAT = 'I'; //standard eigenvalue problem
+WHICH = "LM";
+NEV = 4; //NEVth eigen values are solved
+TOL = 1D-10;
+RESID = zeros(N,1); //
+NCV = 10;
+
+V = zeros(N, NCV);
+
+ISHIFT = 1;
+LEVEC = 0;
+MXITER = 100; //INPUT
+NB = 1;
+NCONV = 0;
+IUPD = 0;
+MODE = 1;
+NP = 100;
+NUMOP = 0;
+NUMOPB = 0;
+NUMREO = 0;
+
+IPARAM = [ISHIFT, LEVEC, MXITER, NB, NCONV, IUPD, MODE, NP, NUMOP, NUMOPB, NUMREO];
+
+IPNTR = zeros(1,14);
+WORKD = zeros(3, N);
+WORKL = zeros(1, NCV**2 + 8 * NCV);
+
+INFO = 0;
+
+i = 0;
+tic();
+
+[IDO,RESID,V,IPARAM,IPNTR,WORKD,WORKL,INFO] = dsaupd(IDO,BMAT,N,WHICH,NEV,TOL,RESID,NCV,V,IPARAM,IPNTR,WORKD,WORKL,INFO);
+
+while (IDO <> 99) & (IDO <> 3)
+ [IDO,RESID,V,IPARAM,IPNTR,WORKD,WORKL,INFO] = dsaupd(IDO,BMAT,N,WHICH,NEV,TOL,RESID,NCV,V,IPARAM,IPNTR,WORKD,WORKL,INFO);
+ if (IDO == 1) then
+ WORKD(IPNTR(2):(IPNTR(2)+N - 1)) = A * WORKD(IPNTR(1):(IPNTR(1)+N - 1));
+ elseif (IDO == 3) then
+ end;
+
+ i = i + 1;
+end;
+t1 = toc();
+printf("loop %d",i);
+
+b = rand(N,1);
+tic();
+for j = 1:i
+ b = A * b;
+end
+toc();
diff --git a/modules/arnoldi/tests/unit_tests/dnaupd.dia.ref b/modules/arnoldi/tests/unit_tests/dnaupd.dia.ref
new file mode 100755
index 000000000..1ee3d1ddc
--- /dev/null
+++ b/modules/arnoldi/tests/unit_tests/dnaupd.dia.ref
@@ -0,0 +1,71 @@
+// =============================================================================
+// Scilab ( http://www.scilab.org/ ) - This file is part of Scilab
+// Copyright (C) 2012 - SE - Sylvestre Ledru
+//
+// This file is distributed under the same license as the Scilab package.
+// =============================================================================
+// <-- CLI SHELL MODE -->
+nx = 10;
+nev = 3;
+ncv = 6;
+bmat = 'I';
+which = 'LM';
+// Local Arrays
+iparam = zeros(11, 1);
+ipntr = zeros(14, 1);
+_select = zeros(ncv, 1);
+dr = zeros(nev + 1, 1);
+di = zeros(nev + 1, 1);
+z = zeros(nx, nev + 1);
+resid = zeros(nx, 1);
+v = zeros(nx, ncv);
+workd = zeros(3 * nx, 1);
+workev = zeros(3 * ncv, 1);
+workl = zeros(3 * ncv * ncv + 6 * ncv, 1);
+// Build the test matrix
+A = diag(10 * ones(nx, 1));
+A(1:$-1,2:$) = A(1:$-1,2:$) + diag(6 * ones(nx-1,1));
+A(2:$,1:$-1) = A(2:$,1:$-1) + diag(-6 * ones(nx-1,1));
+tol = 0;
+ido = 0;
+ishfts = 1;
+maxitr = 300;
+mode1 = 1;
+iparam(1) = ishfts;
+iparam(3) = maxitr;
+iparam(7) = mode1;
+sigmar = 0; // the real part of the shift
+sigmai = 0; // the imaginary part of the shift
+info_dnaupd = 0;
+// M A I N L O O P (Reverse communication)
+while(ido <> 99)
+ // Repeatedly call the routine DNAUPD and take actions indicated by parameter IDO until
+ // either convergence is indicated or maxitr has been exceeded.
+ [ido, resid, v, iparam, ipntr, workd, workl, info_dnaupd] = dnaupd(ido, bmat, nx, which, nev, tol, resid, ncv, v, iparam, ipntr, workd, workl, info_dnaupd);
+ if(info_dnaupd < 0)
+ printf('\nError with dnaupd, info = %d\n',info_dnaupd);
+ printf('Check the documentation of dnaupd\n\n');
+ end
+ if(ido == -1 | ido == 1)
+ // Perform matrix vector multiplication
+ workd(ipntr(2):ipntr(2) + nx -1) = A * workd(ipntr(1):ipntr(1) + nx - 1);
+ end
+end
+// Post-Process using DNEUPD.
+rvec = 1;
+howmany = 'A';
+info_dneupd = 0;
+[dr, di, z, resid, v, iparam, ipntr, workd, workl, info_dneupd] = dneupd(rvec, howmany, _select, dr, di, z, sigmar, sigmai, workev, ...
+bmat, nx, which, nev, tol, resid, ncv, v, ...
+iparam, ipntr, workd, workl, info_dneupd);
+d = complex(dr, di);
+d(nev+1) = [];
+d = diag(d);
+c1 = 1:2:nev + 1;
+c2 = 2:2:nev + 1;
+if(modulo(nev + 1, 2) == 1)
+ c1($) = [];
+end
+z(:,[c1, c2]) = [z(:,c1) + z(:,c2) * %i z(:,c1) - z(:,c2) * %i];
+z(:,$) = [];
+assert_checkalmostequal(A * z, z * d, sqrt(%eps), 1.e-10);
diff --git a/modules/arnoldi/tests/unit_tests/dnaupd.tst b/modules/arnoldi/tests/unit_tests/dnaupd.tst
new file mode 100755
index 000000000..b964e28e8
--- /dev/null
+++ b/modules/arnoldi/tests/unit_tests/dnaupd.tst
@@ -0,0 +1,92 @@
+// =============================================================================
+// Scilab ( http://www.scilab.org/ ) - This file is part of Scilab
+// Copyright (C) 2012 - SE - Sylvestre Ledru
+//
+// This file is distributed under the same license as the Scilab package.
+// =============================================================================
+
+// <-- CLI SHELL MODE -->
+
+nx = 10;
+
+nev = 3;
+ncv = 6;
+bmat = 'I';
+which = 'LM';
+
+// Local Arrays
+
+iparam = zeros(11, 1);
+ipntr = zeros(14, 1);
+_select = zeros(ncv, 1);
+dr = zeros(nev + 1, 1);
+di = zeros(nev + 1, 1);
+z = zeros(nx, nev + 1);
+resid = zeros(nx, 1);
+v = zeros(nx, ncv);
+workd = zeros(3 * nx, 1);
+workev = zeros(3 * ncv, 1);
+workl = zeros(3 * ncv * ncv + 6 * ncv, 1);
+
+// Build the test matrix
+
+A = diag(10 * ones(nx, 1));
+A(1:$-1,2:$) = A(1:$-1,2:$) + diag(6 * ones(nx-1,1));
+A(2:$,1:$-1) = A(2:$,1:$-1) + diag(-6 * ones(nx-1,1));
+
+tol = 0;
+ido = 0;
+
+ishfts = 1;
+maxitr = 300;
+mode1 = 1;
+
+iparam(1) = ishfts;
+iparam(3) = maxitr;
+iparam(7) = mode1;
+
+sigmar = 0; // the real part of the shift
+sigmai = 0; // the imaginary part of the shift
+info_dnaupd = 0;
+
+// M A I N L O O P (Reverse communication)
+
+while(ido <> 99)
+ // Repeatedly call the routine DNAUPD and take actions indicated by parameter IDO until
+ // either convergence is indicated or maxitr has been exceeded.
+
+ [ido, resid, v, iparam, ipntr, workd, workl, info_dnaupd] = dnaupd(ido, bmat, nx, which, nev, tol, resid, ncv, v, iparam, ipntr, workd, workl, info_dnaupd);
+
+ if(info_dnaupd < 0)
+ printf('\nError with dnaupd, info = %d\n',info_dnaupd);
+ printf('Check the documentation of dnaupd\n\n');
+ end
+
+ if(ido == -1 | ido == 1)
+ // Perform matrix vector multiplication
+ workd(ipntr(2):ipntr(2) + nx -1) = A * workd(ipntr(1):ipntr(1) + nx - 1);
+ end
+end
+
+// Post-Process using DNEUPD.
+rvec = 1;
+howmany = 'A';
+info_dneupd = 0;
+
+[dr, di, z, resid, v, iparam, ipntr, workd, workl, info_dneupd] = dneupd(rvec, howmany, _select, dr, di, z, sigmar, sigmai, workev, ...
+bmat, nx, which, nev, tol, resid, ncv, v, ...
+iparam, ipntr, workd, workl, info_dneupd);
+
+d = complex(dr, di);
+d(nev+1) = [];
+d = diag(d);
+
+c1 = 1:2:nev + 1;
+c2 = 2:2:nev + 1;
+if(modulo(nev + 1, 2) == 1)
+ c1($) = [];
+end
+z(:,[c1, c2]) = [z(:,c1) + z(:,c2) * %i z(:,c1) - z(:,c2) * %i];
+z(:,$) = [];
+
+assert_checkalmostequal(A * z, z * d, sqrt(%eps), 1.e-10);
diff --git a/modules/arnoldi/tests/unit_tests/dneupd.dia.ref b/modules/arnoldi/tests/unit_tests/dneupd.dia.ref
new file mode 100755
index 000000000..8a58b9289
--- /dev/null
+++ b/modules/arnoldi/tests/unit_tests/dneupd.dia.ref
@@ -0,0 +1,72 @@
+// =============================================================================
+// Scilab ( http://www.scilab.org/ ) - This file is part of Scilab
+// Copyright (C) 2012 - SE - Sylvestre Ledru
+//
+// This file is distributed under the same license as the Scilab package.
+// =============================================================================
+// <-- CLI SHELL MODE -->
+// The following sets dimensions for this problem.
+nx = 10;
+nev = 3;
+ncv = 6;
+bmat = 'I';
+which = 'LM';
+// Local Arrays
+iparam = zeros(11, 1);
+ipntr = zeros(14, 1);
+_select = zeros(ncv, 1);
+dr = zeros(nev + 1, 1);
+di = zeros(nev + 1, 1);
+z = zeros(nx, nev + 1);
+resid = zeros(nx, 1);
+v = zeros(nx, ncv);
+workd = zeros(3 * nx, 1);
+workev = zeros(3 * ncv, 1);
+workl = zeros(3 * ncv * ncv + 6 * ncv, 1);
+// Build the test matrix
+A = diag(10 * ones(nx, 1));
+A(1:$-1,2:$) = A(1:$-1,2:$) + diag(6 * ones(nx-1,1));
+A(2:$,1:$-1) = A(2:$,1:$-1) + diag(-6 * ones(nx-1,1));
+tol = 0;
+ido = 0;
+ishfts = 1;
+maxitr = 300;
+mode1 = 1;
+iparam(1) = ishfts;
+iparam(3) = maxitr;
+iparam(7) = mode1;
+sigmar = 0; // the real part of the shift
+sigmai = 0; // the imaginary part of the shift
+info_dnaupd = 0;
+// M A I N L O O P (Reverse communication)
+while(ido <> 99)
+ // Repeatedly call the routine DNAUPD and take actions indicated by parameter IDO until
+ // either convergence is indicated or maxitr has been exceeded.
+ [ido, resid, v, iparam, ipntr, workd, workl, info_dnaupd] = dnaupd(ido, bmat, nx, which, nev, tol, resid, ncv, v, iparam, ipntr, workd, workl, info_dnaupd);
+ if(info_dnaupd < 0)
+ printf('\nError with dnaupd, info = %d\n',info_dnaupd);
+ printf('Check the documentation of dnaupd\n\n');
+ end
+ if(ido == -1 | ido == 1)
+ // Perform matrix vector multiplication
+ workd(ipntr(2):ipntr(2) + nx -1) = A * workd(ipntr(1):ipntr(1) + nx - 1);
+ end
+end
+// Post-Process using DNEUPD.
+rvec = 1;
+howmany = 'A';
+info_dneupd = 0;
+[dr, di, z, resid, v, iparam, ipntr, workd, workl, info_dneupd] = dneupd(rvec, howmany, _select, dr, di, z, sigmar, sigmai, workev, ...
+ bmat, nx, which, nev, tol, resid, ncv, v, ...
+ iparam, ipntr, workd, workl, info_dneupd);
+d = complex(dr, di);
+d(nev+1) = [];
+d = diag(d);
+c1 = 1:2:nev + 1;
+c2 = 2:2:nev + 1;
+if(modulo(nev + 1, 2) == 1)
+ c1($) = [];
+end
+z(:,[c1, c2]) = [z(:,c1) + z(:,c2) * %i z(:,c1) - z(:,c2) * %i];
+z(:,$) = [];
+assert_checkalmostequal(A * z, z * d, sqrt(%eps), 1.e-10);
diff --git a/modules/arnoldi/tests/unit_tests/dneupd.tst b/modules/arnoldi/tests/unit_tests/dneupd.tst
new file mode 100755
index 000000000..18abaafae
--- /dev/null
+++ b/modules/arnoldi/tests/unit_tests/dneupd.tst
@@ -0,0 +1,94 @@
+// =============================================================================
+// Scilab ( http://www.scilab.org/ ) - This file is part of Scilab
+// Copyright (C) 2012 - SE - Sylvestre Ledru
+//
+// This file is distributed under the same license as the Scilab package.
+// =============================================================================
+
+// <-- CLI SHELL MODE -->
+
+// The following sets dimensions for this problem.
+
+nx = 10;
+
+nev = 3;
+ncv = 6;
+bmat = 'I';
+which = 'LM';
+
+// Local Arrays
+
+iparam = zeros(11, 1);
+ipntr = zeros(14, 1);
+_select = zeros(ncv, 1);
+dr = zeros(nev + 1, 1);
+di = zeros(nev + 1, 1);
+z = zeros(nx, nev + 1);
+resid = zeros(nx, 1);
+v = zeros(nx, ncv);
+workd = zeros(3 * nx, 1);
+workev = zeros(3 * ncv, 1);
+workl = zeros(3 * ncv * ncv + 6 * ncv, 1);
+
+// Build the test matrix
+
+A = diag(10 * ones(nx, 1));
+A(1:$-1,2:$) = A(1:$-1,2:$) + diag(6 * ones(nx-1,1));
+A(2:$,1:$-1) = A(2:$,1:$-1) + diag(-6 * ones(nx-1,1));
+
+tol = 0;
+ido = 0;
+
+ishfts = 1;
+maxitr = 300;
+mode1 = 1;
+
+iparam(1) = ishfts;
+iparam(3) = maxitr;
+iparam(7) = mode1;
+
+sigmar = 0; // the real part of the shift
+sigmai = 0; // the imaginary part of the shift
+info_dnaupd = 0;
+
+// M A I N L O O P (Reverse communication)
+
+while(ido <> 99)
+ // Repeatedly call the routine DNAUPD and take actions indicated by parameter IDO until
+ // either convergence is indicated or maxitr has been exceeded.
+
+ [ido, resid, v, iparam, ipntr, workd, workl, info_dnaupd] = dnaupd(ido, bmat, nx, which, nev, tol, resid, ncv, v, iparam, ipntr, workd, workl, info_dnaupd);
+
+ if(info_dnaupd < 0)
+ printf('\nError with dnaupd, info = %d\n',info_dnaupd);
+ printf('Check the documentation of dnaupd\n\n');
+ end
+
+ if(ido == -1 | ido == 1)
+ // Perform matrix vector multiplication
+ workd(ipntr(2):ipntr(2) + nx -1) = A * workd(ipntr(1):ipntr(1) + nx - 1);
+ end
+end
+
+// Post-Process using DNEUPD.
+rvec = 1;
+howmany = 'A';
+info_dneupd = 0;
+
+[dr, di, z, resid, v, iparam, ipntr, workd, workl, info_dneupd] = dneupd(rvec, howmany, _select, dr, di, z, sigmar, sigmai, workev, ...
+ bmat, nx, which, nev, tol, resid, ncv, v, ...
+ iparam, ipntr, workd, workl, info_dneupd);
+
+d = complex(dr, di);
+d(nev+1) = [];
+d = diag(d);
+
+c1 = 1:2:nev + 1;
+c2 = 2:2:nev + 1;
+if(modulo(nev + 1, 2) == 1)
+ c1($) = [];
+end
+z(:,[c1, c2]) = [z(:,c1) + z(:,c2) * %i z(:,c1) - z(:,c2) * %i];
+z(:,$) = [];
+
+assert_checkalmostequal(A * z, z * d, sqrt(%eps), 1.e-10);
diff --git a/modules/arnoldi/tests/unit_tests/dsaupd.dia.ref b/modules/arnoldi/tests/unit_tests/dsaupd.dia.ref
new file mode 100755
index 000000000..d9685eaae
--- /dev/null
+++ b/modules/arnoldi/tests/unit_tests/dsaupd.dia.ref
@@ -0,0 +1,61 @@
+// =============================================================================
+// Scilab ( http://www.scilab.org/ ) - This file is part of Scilab
+// Copyright (C) 2012 - SE - Sylvestre Ledru
+//
+// This file is distributed under the same license as the Scilab package.
+// =============================================================================
+// <-- CLI SHELL MODE -->
+nx = 10;
+nev = 3;
+ncv = 6;
+bmat = 'I';
+which = 'LM';
+// Local Arrays
+iparam = zeros(11, 1);
+ipntr = zeros(14, 1);
+_select = zeros(ncv, 1);
+d = zeros(nev, 1);
+z = zeros(nx, nev);
+resid = zeros(nx, 1);
+v = zeros(nx, ncv);
+workd = zeros(3 * nx, 1);
+workl = zeros(ncv * ncv + 8 * ncv, 1);
+// Build the symmetric test matrix
+A = diag(10 * ones(nx,1));
+A(1:$-1,2:$) = A(1:$-1,2:$) + diag(6 * ones(nx-1,1));
+A(2:$,1:$-1) = A(2:$,1:$-1) + diag(6 * ones(nx-1,1));
+tol = 0;
+ido = 0;
+ishfts = 1;
+maxitr = 300;
+mode1 = 1;
+iparam(1) = ishfts;
+iparam(3) = maxitr;
+iparam(7) = mode1;
+sigma = 0; // the real part of the shift
+info_dsaupd = 0;
+// M A I N L O O P (Reverse communication)
+while(ido <> 99)
+ // Repeatedly call the routine DSAUPD and take actions indicated by parameter IDO until
+ // either convergence is indicated or maxitr has been exceeded.
+ [ido, resid, v, iparam, ipntr, workd, workl, info_dsaupd] = dsaupd(ido, bmat, nx, which, nev, tol, resid, ncv, v, iparam, ipntr, workd, workl, info_dsaupd);
+ if(info_dsaupd < 0)
+ printf('\nError with dsaupd, info = %d\n',info_dsaupd);
+ printf('Check the documentation of dsaupd\n\n');
+ end
+ if(ido == -1 | ido == 1)
+ // Perform matrix vector multiplication
+ workd(ipntr(2):ipntr(2) + nx - 1) = A * workd(ipntr(1):ipntr(1) + nx - 1);
+ end
+end
+// Post-Process using DSEUPD.
+rvec = 1;
+howmany = 'A';
+info_dseupd = 0;
+[d, z, resid, v, iparam, ipntr, workd, workl, info_dseupd] = dseupd(rvec, howmany, _select, d, z, sigma, bmat, nx, which, nev, tol, resid, ncv, v, ...
+ iparam, ipntr, workd, workl, info_dseupd);
+if(info_dseupd < 0)
+ printf('\nError with dseupd, info = %d\n', info_dseupd);
+ printf('Check the documentation of dseupd.\n\n');
+end
+assert_checkalmostequal(A * z, z * diag(d), sqrt(%eps), 1.e-10);
diff --git a/modules/arnoldi/tests/unit_tests/dsaupd.tst b/modules/arnoldi/tests/unit_tests/dsaupd.tst
new file mode 100755
index 000000000..73653b091
--- /dev/null
+++ b/modules/arnoldi/tests/unit_tests/dsaupd.tst
@@ -0,0 +1,82 @@
+// =============================================================================
+// Scilab ( http://www.scilab.org/ ) - This file is part of Scilab
+// Copyright (C) 2012 - SE - Sylvestre Ledru
+//
+// This file is distributed under the same license as the Scilab package.
+// =============================================================================
+
+// <-- CLI SHELL MODE -->
+
+nx = 10;
+
+nev = 3;
+ncv = 6;
+bmat = 'I';
+which = 'LM';
+
+// Local Arrays
+
+iparam = zeros(11, 1);
+ipntr = zeros(14, 1);
+_select = zeros(ncv, 1);
+d = zeros(nev, 1);
+z = zeros(nx, nev);
+resid = zeros(nx, 1);
+v = zeros(nx, ncv);
+workd = zeros(3 * nx, 1);
+workl = zeros(ncv * ncv + 8 * ncv, 1);
+
+// Build the symmetric test matrix
+
+A = diag(10 * ones(nx,1));
+A(1:$-1,2:$) = A(1:$-1,2:$) + diag(6 * ones(nx-1,1));
+A(2:$,1:$-1) = A(2:$,1:$-1) + diag(6 * ones(nx-1,1));
+
+tol = 0;
+ido = 0;
+
+ishfts = 1;
+maxitr = 300;
+mode1 = 1;
+
+iparam(1) = ishfts;
+iparam(3) = maxitr;
+iparam(7) = mode1;
+
+sigma = 0; // the real part of the shift
+info_dsaupd = 0;
+
+// M A I N L O O P (Reverse communication)
+
+while(ido <> 99)
+ // Repeatedly call the routine DSAUPD and take actions indicated by parameter IDO until
+ // either convergence is indicated or maxitr has been exceeded.
+
+ [ido, resid, v, iparam, ipntr, workd, workl, info_dsaupd] = dsaupd(ido, bmat, nx, which, nev, tol, resid, ncv, v, iparam, ipntr, workd, workl, info_dsaupd);
+
+ if(info_dsaupd < 0)
+ printf('\nError with dsaupd, info = %d\n',info_dsaupd);
+ printf('Check the documentation of dsaupd\n\n');
+ end
+
+ if(ido == -1 | ido == 1)
+ // Perform matrix vector multiplication
+ workd(ipntr(2):ipntr(2) + nx - 1) = A * workd(ipntr(1):ipntr(1) + nx - 1);
+ end
+end
+
+// Post-Process using DSEUPD.
+rvec = 1;
+howmany = 'A';
+info_dseupd = 0;
+
+[d, z, resid, v, iparam, ipntr, workd, workl, info_dseupd] = dseupd(rvec, howmany, _select, d, z, sigma, bmat, nx, which, nev, tol, resid, ncv, v, ...
+ iparam, ipntr, workd, workl, info_dseupd);
+
+if(info_dseupd < 0)
+ printf('\nError with dseupd, info = %d\n', info_dseupd);
+ printf('Check the documentation of dseupd.\n\n');
+end
+
+
+assert_checkalmostequal(A * z, z * diag(d), sqrt(%eps), 1.e-10);
diff --git a/modules/arnoldi/tests/unit_tests/dseupd.dia.ref b/modules/arnoldi/tests/unit_tests/dseupd.dia.ref
new file mode 100755
index 000000000..66890df24
--- /dev/null
+++ b/modules/arnoldi/tests/unit_tests/dseupd.dia.ref
@@ -0,0 +1,57 @@
+// =============================================================================
+// Scilab ( http://www.scilab.org/ ) - This file is part of Scilab
+// Copyright (C) 2012 - SE - Sylvestre Ledru
+//
+// This file is distributed under the same license as the Scilab package.
+// =============================================================================
+// <-- CLI SHELL MODE -->
+nx = 10;
+nev = 3;
+ncv = 6;
+bmat = 'I';
+which = 'LM';
+// Local Arrays
+iparam = zeros(11, 1);
+ipntr = zeros(14, 1);
+_select = zeros(ncv, 1);
+d = zeros(nev, 1);
+z = zeros(nx, nev);
+resid = zeros(nx, 1);
+v = zeros(nx, ncv);
+workd = zeros(3 * nx, 1);
+workl = zeros(ncv * ncv + 8 * ncv, 1);
+// Build the symmetric test matrix
+A = diag(10 * ones(nx,1));
+A(1:$-1,2:$) = A(1:$-1,2:$) + diag(6 * ones(nx-1,1));
+A(2:$,1:$-1) = A(2:$,1:$-1) + diag(6 * ones(nx-1,1));
+tol = 0;
+ido = 0;
+ishfts = 1;
+maxitr = 300;
+mode1 = 1;
+iparam(1) = ishfts;
+iparam(3) = maxitr;
+iparam(7) = mode1;
+sigma = 0; // the real part of the shift
+info_dsaupd = 0;
+// M A I N L O O P (Reverse communication)
+while(ido <> 99)
+ // Repeatedly call the routine DSAUPD and take actions indicated by parameter IDO until
+ // either convergence is indicated or maxitr has been exceeded.
+ [ido, resid, v, iparam, ipntr, workd, workl, info_dsaupd] = dsaupd(ido, bmat, nx, which, nev, tol, resid, ncv, v, iparam, ipntr, workd, workl, info_dsaupd);
+ if(info_dsaupd < 0)
+ printf('\nError with dsaupd, info = %d\n',info_dsaupd);
+ printf('Check the documentation of dsaupd\n\n');
+ end
+ if(ido == -1 | ido == 1)
+ // Perform matrix vector multiplication
+ workd(ipntr(2):ipntr(2) + nx - 1) = A * workd(ipntr(1):ipntr(1) + nx - 1);
+ end
+end
+// Post-Process using DSEUPD.
+rvec = 1;
+howmany = 'A';
+info_dseupd = 0;
+[d, z, resid, v, iparam, ipntr, workd, workl, info_dseupd] = dseupd(rvec, howmany, _select, d, z, sigma, bmat, nx, which, nev, tol, resid, ncv, v, ...
+ iparam, ipntr, workd, workl, info_dseupd);
+assert_checkalmostequal(A * z, z * diag(d), sqrt(%eps), 1.e-10);
diff --git a/modules/arnoldi/tests/unit_tests/dseupd.tst b/modules/arnoldi/tests/unit_tests/dseupd.tst
new file mode 100755
index 000000000..92369e1d3
--- /dev/null
+++ b/modules/arnoldi/tests/unit_tests/dseupd.tst
@@ -0,0 +1,76 @@
+// =============================================================================
+// Scilab ( http://www.scilab.org/ ) - This file is part of Scilab
+// Copyright (C) 2012 - SE - Sylvestre Ledru
+//
+// This file is distributed under the same license as the Scilab package.
+// =============================================================================
+
+// <-- CLI SHELL MODE -->
+
+nx = 10;
+
+nev = 3;
+ncv = 6;
+bmat = 'I';
+which = 'LM';
+
+// Local Arrays
+
+iparam = zeros(11, 1);
+ipntr = zeros(14, 1);
+_select = zeros(ncv, 1);
+d = zeros(nev, 1);
+z = zeros(nx, nev);
+resid = zeros(nx, 1);
+v = zeros(nx, ncv);
+workd = zeros(3 * nx, 1);
+workl = zeros(ncv * ncv + 8 * ncv, 1);
+
+// Build the symmetric test matrix
+
+A = diag(10 * ones(nx,1));
+A(1:$-1,2:$) = A(1:$-1,2:$) + diag(6 * ones(nx-1,1));
+A(2:$,1:$-1) = A(2:$,1:$-1) + diag(6 * ones(nx-1,1));
+
+tol = 0;
+ido = 0;
+
+ishfts = 1;
+maxitr = 300;
+mode1 = 1;
+
+iparam(1) = ishfts;
+iparam(3) = maxitr;
+iparam(7) = mode1;
+
+sigma = 0; // the real part of the shift
+info_dsaupd = 0;
+
+// M A I N L O O P (Reverse communication)
+
+while(ido <> 99)
+ // Repeatedly call the routine DSAUPD and take actions indicated by parameter IDO until
+ // either convergence is indicated or maxitr has been exceeded.
+
+ [ido, resid, v, iparam, ipntr, workd, workl, info_dsaupd] = dsaupd(ido, bmat, nx, which, nev, tol, resid, ncv, v, iparam, ipntr, workd, workl, info_dsaupd);
+
+ if(info_dsaupd < 0)
+ printf('\nError with dsaupd, info = %d\n',info_dsaupd);
+ printf('Check the documentation of dsaupd\n\n');
+ end
+
+ if(ido == -1 | ido == 1)
+ // Perform matrix vector multiplication
+ workd(ipntr(2):ipntr(2) + nx - 1) = A * workd(ipntr(1):ipntr(1) + nx - 1);
+ end
+end
+
+// Post-Process using DSEUPD.
+rvec = 1;
+howmany = 'A';
+info_dseupd = 0;
+
+[d, z, resid, v, iparam, ipntr, workd, workl, info_dseupd] = dseupd(rvec, howmany, _select, d, z, sigma, bmat, nx, which, nev, tol, resid, ncv, v, ...
+ iparam, ipntr, workd, workl, info_dseupd);
+
+assert_checkalmostequal(A * z, z * diag(d), sqrt(%eps), 1.e-10);
diff --git a/modules/arnoldi/tests/unit_tests/eigs.dia.ref b/modules/arnoldi/tests/unit_tests/eigs.dia.ref
new file mode 100755
index 000000000..dccdcc9d5
--- /dev/null
+++ b/modules/arnoldi/tests/unit_tests/eigs.dia.ref
@@ -0,0 +1,835 @@
+// =============================================================================
+// Scilab ( http://www.scilab.org/ ) - This file is part of Scilab
+// Copyright (C) 2012 - Scilab Enterprises - Adeline CARNIS
+//
+// This file is distributed under the same license as the Scilab package.
+// =============================================================================
+// <-- CLI SHELL MODE -->
+// unit tests for eigs function
+// =============================================================================
+// Interface
+// =========
+assert_checkfalse(execstr("eigs()" ,"errcatch") == 0);
+refMsg = msprintf(_("%s : Wrong number of input arguments : %d to %d expected.\n"), "eigs", 1, 6);
+assert_checkerror("eigs()", refMsg);
+assert_checkfalse(execstr("eigs(1)","errcatch") == 0);
+refMsg = msprintf(_("%s: Wrong type for input argument #%d: A square matrix expected.\n"), "eigs", 1);
+assert_checkerror("eigs(1)", refMsg);
+assert_checkfalse(execstr("eigs([])", "errcatch") == 0);
+refMsg = msprintf(_("%s: Wrong type for input argument #%d: A full or sparse square matrix or a function expected"), "eigs", 1);
+assert_checkerror("eigs([])", refMsg);
+assert_checkfalse(execstr("eigs(%nan)", "errcatch") == 0);
+refMsg = msprintf(_("%s: Wrong type for input argument #%d: A square matrix expected.\n"), "eigs", 1);
+assert_checkerror("eigs(%nan)", refMsg);
+assert_checkfalse(execstr("eigs(%inf)", "errcatch") == 0);
+refMsg = msprintf(_("%s: Wrong type for input argument #%d: A square matrix expected.\n"), "eigs", 1);
+assert_checkerror("eigs(%inf)", refMsg);
+assert_checkfalse(execstr("eigs(%eps)", "errcatch") == 0);
+refMsg = msprintf(_("%s: Wrong type for input argument #%d: A square matrix expected.\n"), "eigs", 1);
+assert_checkerror("eigs(%eps)", refMsg);
+assert_checkfalse(execstr("eigs([%f %f])", "errcatch") == 0);
+refMsg = msprintf(_("%s: Wrong type for input argument #%d: A full or sparse square matrix or a function expected"), "eigs", 1);
+assert_checkerror("eigs([%f %f])", refMsg);
+assert_checkfalse(execstr("eigs(sparse([%f %f]))", "errcatch") == 0);
+refMsg = msprintf(_("%s: Wrong type for input argument #%d: A full or sparse square matrix or a function expected"), "eigs", 1);
+assert_checkerror("eigs(sparse([%f %f]))", refMsg);
+assert_checkfalse(execstr("eigs([1 2])", "errcatch") == 0);
+refMsg = msprintf(_("%s: Wrong type for input argument #%d: A square matrix expected.\n"), "eigs", 1);
+assert_checkerror("eigs([1 2])", refMsg);
+assert_checkfalse(execstr("eigs([1; 2])", "errcatch") == 0);
+refMsg = msprintf(_("%s: Wrong type for input argument #%d: A square matrix expected.\n"), "eigs", 1);
+assert_checkerror("eigs([1; 2])", refMsg);
+assert_checkfalse(execstr("eigs(sparse([1 2]))", "errcatch") == 0);
+refMsg = msprintf(_("%s: Wrong type for input argument #%d: A square matrix expected.\n"), "eigs", 1);
+assert_checkerror("eigs(sparse([1 2]))", refMsg);
+assert_checkfalse(execstr("eigs(sparse([1; 2]))", "errcatch") == 0);
+refMsg = msprintf(_("%s: Wrong type for input argument #%d: A square matrix expected.\n"), "eigs", 1);
+assert_checkerror("eigs(sparse([1; 2]))", refMsg);
+n = 20;
+A = diag(10*ones(n,1));
+A(1:$-1,2:$) = A(1:$-1,2:$) + diag(6*ones(n-1,1));
+A(2:$,1:$-1) = A(2:$,1:$-1) + diag(6*ones(n-1,1));
+assert_checkfalse(execstr("eigs(A, %f)", "errcatch") == 0);
+refMsg = msprintf(_("%s: Wrong type for input argument #%d: An empty matrix or full or sparse square matrix expected.\n"), "eigs", 2);
+assert_checkerror("eigs(A, %f)", refMsg);
+assert_checkfalse(execstr("eigs(A, %nan)", "errcatch") == 0);
+refMsg = msprintf(_("%s: Wrong dimension for input argument #%d: B must have the same size as A.\n"), "eigs", 2);
+assert_checkerror("eigs(A, %nan)", refMsg);
+assert_checkfalse(execstr("eigs(A, %inf)", "errcatch") == 0);
+refMsg = msprintf(_("%s: Wrong dimension for input argument #%d: B must have the same size as A.\n"), "eigs", 2);
+assert_checkerror("eigs(A, %inf)", refMsg);
+assert_checkfalse(execstr("eigs(A, %eps)", "errcatch") == 0);
+refMsg = msprintf(_("%s: Wrong dimension for input argument #%d: B must have the same size as A.\n"), "eigs", 2);
+assert_checkerror("eigs(A, %eps)", refMsg);
+assert_checkfalse(execstr("eigs(sparse(A), %f)", "errcatch") == 0);
+refMsg = msprintf(_("%s: Wrong type for input argument #%d: An empty matrix or full or sparse square matrix expected.\n"), "eigs", 2);
+assert_checkerror("eigs(sparse(A), %f)", refMsg);
+assert_checkfalse(execstr("eigs(sparse(A), %nan)", "errcatch") == 0);
+refMsg = msprintf(_("%s: Wrong dimension for input argument #%d: B must have the same size as A.\n"), "eigs", 2);
+assert_checkerror("eigs(sparse(A), %nan)", refMsg);
+assert_checkfalse(execstr("eigs(sparse(A), %inf)", "errcatch") == 0);
+refMsg = msprintf(_("%s: Wrong dimension for input argument #%d: B must have the same size as A.\n"), "eigs", 2);
+assert_checkerror("eigs(sparse(A), %inf)", refMsg);
+assert_checkfalse(execstr("eigs(sparse(A), %eps)", "errcatch") == 0);
+refMsg = msprintf(_("%s: Wrong dimension for input argument #%d: B must have the same size as A.\n"), "eigs", 2);
+assert_checkerror("eigs(sparse(A), %eps)", refMsg);
+assert_checkfalse(execstr("eigs(A,[1 2])", "errcatch") == 0);
+refMsg = msprintf(_("%s: Wrong dimension for input argument #%d: B must have the same size as A.\n"), "eigs", 2);
+assert_checkerror("eigs(A,[1 2])", refMsg);
+assert_checkfalse(execstr("eigs(A,[1;2])", "errcatch") == 0);
+refMsg = msprintf(_("%s: Wrong dimension for input argument #%d: B must have the same size as A.\n"), "eigs", 2);
+assert_checkerror("eigs(A,[1;2])", refMsg);
+assert_checkfalse(execstr("eigs(sparse(A), [1 2])", "errcatch") == 0);
+refMsg = msprintf(_("%s: Wrong dimension for input argument #%d: B must have the same size as A.\n"), "eigs", 2);
+assert_checkerror("eigs(sparse(A), [1 2])", refMsg);
+assert_checkfalse(execstr("eigs(sparse(A), [1;2])", "errcatch") == 0);
+refMsg = msprintf(_("%s: Wrong dimension for input argument #%d: B must have the same size as A.\n"), "eigs", 2);
+assert_checkerror("eigs(sparse(A), [1;2])", refMsg);
+assert_checkfalse(execstr("eigs(A, [], [])", "errcatch") == 0);
+refMsg = msprintf(_("%s: Wrong type for input argument #%d: A scalar expected.\n"), "eigs", 3);
+assert_checkerror("eigs(A, [], [])", refMsg);
+assert_checkfalse(execstr("eigs(A, [], %f)", "errcatch") == 0);
+refMsg = msprintf(_("%s: Wrong type for input argument #%d: A scalar expected.\n"), "eigs", 3);
+assert_checkerror("eigs(A, [], %f)", refMsg);
+assert_checkfalse(execstr("eigs(A, [], 2*%i)", "errcatch") == 0);
+refMsg = msprintf(_("%s: Wrong type for input argument #%d: A scalar expected.\n"), "eigs", 3);
+assert_checkerror("eigs(A, [], 2*%i)", refMsg);
+assert_checkfalse(execstr("eigs(A, [], -15)", "errcatch") == 0);
+refMsg = msprintf(_("%s: Wrong type for input argument #%d: k must be a positive integer.\n"), "eigs", 3);
+assert_checkerror("eigs(A, [], -15)", refMsg);
+assert_checkfalse(execstr("eigs(A, [], 5.6)", "errcatch") == 0);
+refMsg = msprintf(_("%s: Wrong type for input argument #%d: k must be a positive integer.\n"), "eigs", 3);
+assert_checkerror("eigs(A, [], 5.6)", refMsg);
+assert_checkfalse(execstr("eigs(A, [], [1 2])", "errcatch") == 0);
+refMsg = msprintf(_("%s: Wrong type for input argument #%d: A scalar expected.\n"), "eigs", 3);
+assert_checkerror("eigs(A, [], [1 2])", refMsg);
+assert_checkfalse(execstr("eigs(A, [], %nan)", "errcatch") == 0);
+refMsg = msprintf(_("%s: Wrong type for input argument #%d: k must be a positive integer.\n"), "eigs", 3);
+assert_checkerror("eigs(A, [], %nan)", refMsg);
+assert_checkfalse(execstr("eigs(A, [], %eps)", "errcatch") == 0);
+refMsg = msprintf(_("%s: Wrong type for input argument #%d: k must be a positive integer.\n"), "eigs", 3);
+assert_checkerror("eigs(A, [], %eps)", refMsg);
+assert_checkfalse(execstr("eigs(A, [], %inf)", "errcatch") == 0);
+refMsg = msprintf(_("%s: Wrong value for input argument #%d: k must be in the range 1 to N.\n"), "eigs", 3);
+assert_checkerror("eigs(A, [], %inf)", refMsg);
+assert_checkfalse(execstr("eigs(sparse(A), [], %f)", "errcatch") == 0);
+refMsg = msprintf(_("%s: Wrong type for input argument #%d: A scalar expected.\n"), "eigs", 3);
+assert_checkerror("eigs(sparse(A), [], %f)", refMsg);
+assert_checkfalse(execstr("eigs(sparse(A), [], 2*%i)", "errcatch") == 0);
+refMsg = msprintf(_("%s: Wrong type for input argument #%d: A scalar expected.\n"), "eigs", 3);
+assert_checkerror("eigs(sparse(A), [], 2*%i)", refMsg);
+assert_checkfalse(execstr("eigs(sparse(A), [], -15)", "errcatch") == 0);
+refMsg = msprintf(_("%s: Wrong type for input argument #%d: k must be a positive integer.\n"), "eigs", 3);
+assert_checkerror("eigs(sparse(A), [], -15)", refMsg);
+assert_checkfalse(execstr("eigs(sparse(A), [], 5.6)", "errcatch") == 0);
+refMsg = msprintf(_("%s: Wrong type for input argument #%d: k must be a positive integer.\n"), "eigs", 3);
+assert_checkerror("eigs(sparse(A), [], 5.6)", refMsg);
+assert_checkfalse(execstr("eigs(sparse(A), [], [1 2])", "errcatch") == 0);
+refMsg = msprintf(_("%s: Wrong type for input argument #%d: A scalar expected.\n"), "eigs", 3);
+assert_checkerror("eigs(sparse(A), [], [1 2])", refMsg);
+assert_checkfalse(execstr("eigs(A, [], 4, [])", "errcatch") == 0);
+refMsg = msprintf(_("%s: Wrong type for input argument #%d: A scalar expected.\n"), "eigs", 4);
+assert_checkerror("eigs(A, [], 4, [])", refMsg);
+assert_checkfalse(execstr("eigs(A, [], 4, %nan)", "errcatch") == 0);
+refMsg = msprintf(_("%s: Wrong type for input argument #%d: sigma must be a real.\n"), "eigs", 4);
+assert_checkerror("eigs(A, [], 4, %nan)", refMsg);
+assert_checkfalse(execstr("eigs(A, [], 4, %f)", "errcatch") == 0);
+refMsg = msprintf(_("%s: Wrong type for input argument #%d: A scalar expected.\n"), "eigs", 4);
+assert_checkerror("eigs(A, [], 4, %f)", refMsg);
+assert_checkfalse(execstr("eigs(sparse(A), [], 4, [])", "errcatch") == 0);
+refMsg = msprintf(_("%s: Wrong type for input argument #%d: A scalar expected.\n"), "eigs", 4);
+assert_checkerror("eigs(sparse(A), [], 4, [])", refMsg);
+assert_checkfalse(execstr("eigs(sparse(A), [], 4, %nan)", "errcatch") == 0);
+refMsg = msprintf(_("%s: Wrong type for input argument #%d: A scalar expected.\n"), "eigs", 4);
+assert_checkerror("eigs(sparse(A), [], 4, %nan)", refMsg);
+assert_checkfalse(execstr("eigs(sparse(A), [], 4, %f)", "errcatch") == 0);
+refMsg = msprintf(_("%s: Wrong type for input argument #%d: a real scalar or a string expected.\n"), "eigs", 4);
+assert_checkerror("eigs(sparse(A), [], 4, %f)", refMsg);
+which = "ahh";
+assert_checkfalse(execstr("eigs(A, [], 4, which)", "errcatch") == 0);
+refMsg = msprintf(_("%s: Wrong value for input argument #%d: Unrecognized sigma value.\n Sigma must be one of ''%s'', ''%s'', ''%s'', ''%s'' or ''%s''.\n"), "eigs", 4, "LM", "SM", "LA", "SA", "BE");
+assert_checkerror("eigs(A, [], 4, which)", refMsg);
+assert_checkfalse(execstr("eigs(sparse(A), [], 4, which)", "errcatch") == 0);
+refMsg = msprintf(_("%s: Wrong value for input argument #%d: Unrecognized sigma value.\n Sigma must be one of ''%s'', ''%s'', ''%s'', ''%s'' or ''%s''.\n"), "eigs", 4, "LM", "SM", "LA", "SA", "BE");
+assert_checkerror("eigs(sparse(A), [], 4, which)", refMsg);
+which = "LM";
+assert_checkfalse(execstr("eigs(A, [], 4, which ,%nan)", "errcatch") == 0);
+refMsg = msprintf(_("%s: Wrong type for input argument #%d: A structure expected"), "eigs", 5);
+assert_checkerror("eigs(A, [], 4, which ,%nan)", refMsg);
+assert_checkfalse(execstr("eigs(sparse(A), [], 4, which ,%nan)", "errcatch") == 0);
+refMsg = msprintf(_("%s: Wrong type for input argument #%d: A structure expected"), "eigs", 5);
+assert_checkerror("eigs(sparse(A), [], 4, which, %nan)", refMsg);
+opts.var = %nan;
+assert_checkfalse(execstr("eigs(A, [], 4, which ,opts)", "errcatch") == 0);
+refMsg = msprintf(_("%s: Wrong type for input argument: If A is a matrix, use opts with tol, maxiter, ncv, resid, cholB"), "eigs");
+assert_checkerror("eigs(A, [], 4, which, opts)", refMsg);
+assert_checkfalse(execstr("eigs(sparse(A), [], 4, which ,opts)", "errcatch") == 0);
+refMsg = msprintf(_("%s: Wrong type for input argument: If A is a matrix, use opts with tol, maxiter, ncv, resid, cholB"), "eigs");
+assert_checkerror("eigs(sparse(A), [], 4, which, opts)", refMsg);
+clear opts
+opts.maxiter = [];
+assert_checkfalse(execstr("eigs(A, [], 4, which ,opts)", "errcatch") == 0);
+refMsg = msprintf(_("%s: Wrong type for input argument #%d: %s must be a scalar.\n"), "eigs", 5, "opts.maxiter");
+assert_checkerror("eigs(A, [], 4, which, opts)", refMsg);
+assert_checkfalse(execstr("eigs(sparse(A), [], 4, which ,opts)", "errcatch") == 0);
+refMsg = msprintf(_("%s: Wrong type for input argument #%d: %s must be a scalar.\n"), "eigs", 5, "opts.maxiter");
+assert_checkerror("eigs(sparse(A), [], 4, which, opts)", refMsg);
+opts.maxiter = %nan;
+assert_checkfalse(execstr("eigs(A, [], 4, which ,opts)", "errcatch") == 0);
+refMsg = msprintf(_("%s: Wrong type for input argument #%d: %s must be an integer positive value.\n"), "eigs", 5, "opts.maxiter");
+assert_checkerror("eigs(A, [], 4, which, opts)", refMsg);
+assert_checkfalse(execstr("eigs(sparse(A), [], 4, which ,opts)", "errcatch") == 0);
+refMsg = msprintf(_("%s: Wrong type for input argument #%d: %s must be an integer positive value.\n"), "eigs", 5, "opts.maxiter");
+assert_checkerror("eigs(sparse(A), [], 4, which ,opts)", refMsg);
+opts.maxiter = %f;
+assert_checkfalse(execstr("eigs(A, [], 4, which ,opts)", "errcatch") == 0);
+refMsg = msprintf(_("%s: Wrong type for input argument #%d: %s must be a scalar.\n"), "eigs", 5, "opts.maxiter");
+assert_checkerror("eigs(A, [], 4, which, opts)", refMsg);
+assert_checkfalse(execstr("eigs(sparse(A), [], 4, which ,opts)", "errcatch") == 0);
+refMsg = msprintf(_("%s: Wrong type for input argument #%d: %s must be a scalar.\n"), "eigs", 5, "opts.maxiter");
+assert_checkerror("eigs(sparse(A), [], 4, which, opts)", refMsg);
+opts.maxiter = "ahh";
+assert_checkfalse(execstr("eigs(A, [], 4, which ,opts)", "errcatch") == 0);
+refMsg = msprintf(_("%s: Wrong type for input argument #%d: %s must be a scalar.\n"), "eigs", 5, "opts.maxiter");
+assert_checkerror("eigs(A, [], 4, which, opts)", refMsg);
+assert_checkfalse(execstr("eigs(sparse(A), [], 4, which ,opts)", "errcatch") == 0);
+refMsg = msprintf(_("%s: Wrong type for input argument #%d: %s must be a scalar.\n"), "eigs", 5, "opts.maxiter");
+assert_checkerror("eigs(sparse(A), [], 4, which, opts)", refMsg);
+opts.maxiter = 5.1;
+assert_checkfalse(execstr("eigs(A, [], 4, which ,opts)", "errcatch") == 0);
+refMsg = msprintf(_("%s: Wrong type for input argument #%d: %s must be an integer positive value.\n"), "eigs", 5, "opts.maxiter");
+assert_checkerror("eigs(A, [], 4, which, opts)", refMsg);
+assert_checkfalse(execstr("eigs(sparse(A), [], 4, which ,opts)", "errcatch") == 0);
+refMsg = msprintf(_("%s: Wrong type for input argument #%d: %s must be an integer positive value.\n"), "eigs", 5, "opts.maxiter");
+assert_checkerror("eigs(sparse(A), [], 4, which ,opts)", refMsg);
+opts.maxiter = -5.1;
+assert_checkfalse(execstr("eigs(A, [], 4, which ,opts)", "errcatch") == 0);
+refMsg = msprintf(_("%s: Wrong type for input argument #%d: %s must be an integer positive value.\n"), "eigs", 5, "opts.maxiter");
+assert_checkerror("eigs(A, [], 4, which, opts)", refMsg);
+assert_checkfalse(execstr("eigs(sparse(A), [], 4, which ,opts)", "errcatch") == 0);
+refMsg = msprintf(_("%s: Wrong type for input argument #%d: %s must be an integer positive value.\n"), "eigs", 5, "opts.maxiter");
+assert_checkerror("eigs(sparse(A), [], 4, which ,opts)", refMsg);
+clear opts
+opts.tol = [];
+assert_checkfalse(execstr("eigs(A, [], 4, which ,opts)", "errcatch") == 0);
+refMsg = msprintf(_("%s: Wrong type for input argument #%d: %s must be a real scalar.\n"), "eigs", 6, "opts.tol");
+assert_checkerror("eigs(A, [], 4, which, opts)", refMsg);
+assert_checkfalse(execstr("eigs(sparse(A), [], 4, which ,opts)", "errcatch") == 0);
+refMsg = msprintf(_("%s: Wrong type for input argument #%d: %s must be a real scalar.\n"), "eigs", 6, "opts.tol");
+assert_checkerror("eigs(sparse(A), [], 4, which, opts)", refMsg);
+opts.tol = %nan;
+assert_checkfalse(execstr("eigs(A, [], 4, which ,opts)", "errcatch") == 0);
+refMsg = msprintf(_("%s: Wrong type for input argument #%d: %s must be a real scalar.\n"), "eigs", 6, "opts.tol");
+assert_checkerror("eigs(A, [], 4, which, opts)", refMsg);
+assert_checkfalse(execstr("eigs(sparse(A), [], 4, which ,opts)", "errcatch") == 0);
+refMsg = msprintf(_("%s: Wrong type for input argument #%d: %s must be a real scalar.\n"), "eigs", 6, "opts.tol");
+assert_checkerror("eigs(sparse(A), [], 4, which, opts)", refMsg);
+opts.tol = %f;
+assert_checkfalse(execstr("eigs(A, [], 4, which ,opts)", "errcatch") == 0);
+refMsg = msprintf(_("%s: Wrong type for input argument #%d: %s must be a real scalar.\n"), "eigs", 6, "opts.tol");
+assert_checkerror("eigs(A, [], 4, which, opts)", refMsg);
+assert_checkfalse(execstr("eigs(sparse(A), [], 4, which ,opts)", "errcatch") == 0);
+refMsg = msprintf(_("%s: Wrong type for input argument #%d: %s must be a real scalar.\n"), "eigs", 6, "opts.tol");
+assert_checkerror("eigs(sparse(A), [], 4, which, opts)", refMsg);
+opts.tol = "ahh";
+assert_checkfalse(execstr("eigs(A, [], 4, which ,opts)", "errcatch") == 0);
+refMsg = msprintf(_("%s: Wrong type for input argument #%d: %s must be a real scalar.\n"), "eigs", 6, "opts.tol");
+assert_checkerror("eigs(A, [], 4, which, opts)", refMsg);
+assert_checkfalse(execstr("eigs(sparse(A), [], 4, which ,opts)", "errcatch") == 0);
+refMsg = msprintf(_("%s: Wrong type for input argument #%d: %s must be a real scalar.\n"), "eigs", 6, "opts.tol");
+assert_checkerror("eigs(sparse(A), [], 4, which, opts)", refMsg);
+clear opts
+opts.ncv = %nan;
+assert_checkfalse(execstr("eigs(A, [], 4, which ,opts)", "errcatch") == 0);
+refMsg = msprintf(_("%s: Wrong type for input argument #%d: %s must be an integer scalar.\n"), "eigs", 7, "opts.ncv");
+assert_checkerror("eigs(A, [], 4, which, opts)", refMsg);
+assert_checkfalse(execstr("eigs(sparse(A), [], 4, which ,opts)", "errcatch") == 0);
+refMsg = msprintf(_("%s: Wrong type for input argument #%d: %s must be an integer scalar.\n"), "eigs", 7, "opts.ncv");
+assert_checkerror("eigs(sparse(A), [], 4, which, opts)", refMsg);
+opts.ncv = %f;
+assert_checkfalse(execstr("eigs(A, [], 4, which ,opts)", "errcatch") == 0);
+refMsg = msprintf(_("%s: Wrong type for input argument #%d: %s must be an integer scalar.\n"), "eigs", 7, "opts.ncv");
+assert_checkerror("eigs(A, [], 4, which, opts)", refMsg);
+assert_checkfalse(execstr("eigs(sparse(A), [], 4, which ,opts)", "errcatch") == 0);
+refMsg = msprintf(_("%s: Wrong type for input argument #%d: %s must be an integer scalar.\n"), "eigs", 7, "opts.ncv");
+assert_checkerror("eigs(sparse(A), [], 4, which, opts)", refMsg);
+opts.ncv = "ahh";
+assert_checkfalse(execstr("eigs(A, [], 4, which ,opts)", "errcatch") == 0);
+refMsg = msprintf(_("%s: Wrong type for input argument #%d: %s must be an integer scalar.\n"), "eigs", 7, "opts.ncv");
+assert_checkerror("eigs(A, [], 4, which, opts)", refMsg);
+assert_checkfalse(execstr("eigs(sparse(A), [], 4, which ,opts)", "errcatch") == 0);
+refMsg = msprintf(_("%s: Wrong type for input argument #%d: %s must be an integer scalar.\n"), "eigs", 7, "opts.ncv");
+assert_checkerror("eigs(sparse(A), [], 4, which, opts)", refMsg);
+opts.ncv = %eps;
+assert_checkfalse(execstr("eigs(A, [], 4, which ,opts)", "errcatch") == 0);
+refMsg = msprintf(_("%s: Wrong type for input argument #%d: %s must be an integer scalar.\n"), "eigs", 7, "opts.ncv");
+assert_checkerror("eigs(A, [], 4, which, opts)", refMsg);
+assert_checkfalse(execstr("eigs(sparse(A), [], 4, which ,opts)", "errcatch") == 0);
+refMsg = msprintf(_("%s: Wrong type for input argument #%d: %s must be an integer scalar.\n"), "eigs", 7, "opts.ncv");
+assert_checkerror("eigs(sparse(A), [], 4, which, opts)", refMsg);
+opts.ncv = -5.1;
+assert_checkfalse(execstr("eigs(A, [], 4, which ,opts)", "errcatch") == 0);
+refMsg = msprintf(_("%s: Wrong type for input argument #%d: %s must be an integer scalar.\n"), "eigs", 7, "opts.ncv");
+assert_checkerror("eigs(A, [], 4, which, opts)", refMsg);
+assert_checkfalse(execstr("eigs(sparse(A), [], 4, which ,opts)", "errcatch") == 0);
+refMsg = msprintf(_("%s: Wrong type for input argument #%d: %s must be an integer scalar.\n"), "eigs", 7, "opts.ncv");
+assert_checkerror("eigs(sparse(A), [], 4, which, opts)", refMsg);
+opts.ncv = 5.1;
+assert_checkfalse(execstr("eigs(A, [], 4, which ,opts)", "errcatch") == 0);
+refMsg = msprintf(_("%s: Wrong type for input argument #%d: %s must be an integer scalar.\n"), "eigs", 7, "opts.ncv");
+assert_checkerror("eigs(A, [], 4, which, opts)", refMsg);
+assert_checkfalse(execstr("eigs(sparse(A), [], 4, which ,opts)", "errcatch") == 0);
+refMsg = msprintf(_("%s: Wrong type for input argument #%d: %s must be an integer scalar.\n"), "eigs", 7, "opts.ncv");
+assert_checkerror("eigs(sparse(A), [], 4, which, opts)", refMsg);
+opts.ncv = n + 6;
+assert_checkfalse(execstr("eigs(A, [], 4, which ,opts)", "errcatch") == 0);
+refMsg = msprintf(_("%s: Wrong value for input argument #%d: For real symmetric problems, NCV must be k < NCV <= N.\n"), "eigs", 7);
+assert_checkerror("eigs(A, [], 4, which, opts)", refMsg);
+assert_checkfalse(execstr("eigs(sparse(A), [], 4, which ,opts)", "errcatch") == 0);
+refMsg = msprintf(_("%s: Wrong value for input argument #%d: For real symmetric problems, NCV must be k < NCV <= N.\n"), "eigs", 7);
+assert_checkerror("eigs(sparse(A), [], 4, which, opts)", refMsg);
+clear opts
+opts.cholB = %nan;
+assert_checkfalse(execstr("eigs(A, [], 4, which ,opts)", "errcatch") == 0);
+refMsg = msprintf(_("%s: Wrong value for input argument #%d: %s must be %s or %s.\n"), "eigs", 8, "opts.cholB", "%f", "%t");
+assert_checkerror("eigs(A, [], 4, which, opts)", refMsg);
+assert_checkfalse(execstr("eigs(sparse(A), [], 4, which ,opts)", "errcatch") == 0);
+refMsg = msprintf(_("%s: Wrong value for input argument #%d: %s must be %s or %s.\n"), "eigs", 8, "opts.cholB", "%f", "%t");
+assert_checkerror("eigs(sparse(A), [], 4, which, opts)", refMsg);
+opts.cholB = "ahh";
+assert_checkfalse(execstr("eigs(A, [], 4, which ,opts)", "errcatch") == 0);
+refMsg = msprintf(_("%s: Wrong type for input argument #%d: %s must be an integer scalar or a boolean.\n"), "eigs", 8, "opts.cholB");
+assert_checkerror("eigs(A, [], 4, which, opts)", refMsg);
+assert_checkfalse(execstr("eigs(sparse(A), [], 4, which ,opts)", "errcatch") == 0);
+refMsg = msprintf(_("%s: Wrong type for input argument #%d: %s must be an integer scalar or a boolean.\n"), "eigs", 8, "opts.cholB");
+assert_checkerror("eigs(sparse(A), [], 4, which, opts)", refMsg);
+opts.cholB = %eps;
+assert_checkfalse(execstr("eigs(A, [], 4, which ,opts)", "errcatch") == 0);
+refMsg = msprintf(_("%s: Wrong value for input argument #%d: %s must be %s or %s.\n"), "eigs", 8, "opts.cholB", "%f", "%t");
+assert_checkerror("eigs(A, [], 4, which, opts)", refMsg);
+assert_checkfalse(execstr("eigs(sparse(A), [], 4, which ,opts)", "errcatch") == 0);
+refMsg = msprintf(_("%s: Wrong value for input argument #%d: %s must be %s or %s.\n"), "eigs", 8, "opts.cholB", "%f", "%t");
+assert_checkerror("eigs(sparse(A), [], 4, which, opts)", refMsg);
+opts.cholB = -5.1;
+assert_checkfalse(execstr("eigs(A, [], 4, which ,opts)", "errcatch") == 0);
+refMsg = msprintf(_("%s: Wrong value for input argument #%d: %s must be %s or %s.\n"), "eigs", 8, "opts.cholB", "%f", "%t");
+assert_checkerror("eigs(A, [], 4, which, opts)", refMsg);
+assert_checkfalse(execstr("eigs(sparse(A), [], 4, which ,opts)", "errcatch") == 0);
+refMsg = msprintf(_("%s: Wrong value for input argument #%d: %s must be %s or %s.\n"), "eigs", 8, "opts.cholB", "%f", "%t");
+assert_checkerror("eigs(sparse(A), [], 4, which, opts)", refMsg);
+opts.cholB = 5.1;
+assert_checkfalse(execstr("eigs(A, [], 4, which ,opts)", "errcatch") == 0);
+refMsg = msprintf(_("%s: Wrong value for input argument #%d: %s must be %s or %s.\n"), "eigs", 8, "opts.cholB", "%f", "%t");
+assert_checkerror("eigs(A, [], 4, which, opts)", refMsg);
+assert_checkfalse(execstr("eigs(sparse(A), [], 4, which ,opts)", "errcatch") == 0);
+refMsg = msprintf(_("%s: Wrong value for input argument #%d: %s must be %s or %s.\n"), "eigs", 8, "opts.cholB", "%f", "%t");
+assert_checkerror("eigs(sparse(A), [], 4, which, opts)", refMsg);
+opts.cholB = [];
+assert_checkfalse(execstr("eigs(A, [], 4, which ,opts)", "errcatch") == 0);
+refMsg = msprintf(_("%s: Wrong type for input argument #%d: %s must be an integer scalar or a boolean.\n"), "eigs", 8, "opts.cholB");
+assert_checkerror("eigs(A, [], 4, which, opts)", refMsg);
+assert_checkfalse(execstr("eigs(sparse(A), [], 4, which ,opts)", "errcatch") == 0);
+refMsg = msprintf(_("%s: Wrong type for input argument #%d: %s must be an integer scalar or a boolean.\n"), "eigs", 8, "opts.cholB");
+assert_checkerror("eigs(sparse(A), [], 4, which, opts)", refMsg);
+clear opts
+opts.resid = %nan;
+assert_checkfalse(execstr("eigs(A, [], 4, which ,opts)", "errcatch") == 0);
+refMsg = msprintf(_("%s: Wrong dimension for input argument #%d: Start vector %s must be N by 1.\n"), "eigs", 9, "opts.resid");
+assert_checkerror("eigs(A, [], 4, which, opts)", refMsg);
+assert_checkfalse(execstr("eigs(sparse(A), [], 4, which ,opts)", "errcatch") == 0);
+refMsg = msprintf(_("%s: Wrong dimension for input argument #%d: Start vector %s must be N by 1.\n"), "eigs", 9, "opts.resid");
+assert_checkerror("eigs(sparse(A), [], 4, which, opts)", refMsg);
+opts.resid = %f;
+assert_checkfalse(execstr("eigs(A, [], 4, which ,opts)", "errcatch") == 0);
+refMsg = msprintf(_("%s: Wrong type for input argument #%d: A real or complex matrix expected.\n"), "eigs", 9);
+assert_checkerror("eigs(A, [], 4, which, opts)", refMsg);
+assert_checkfalse(execstr("eigs(sparse(A), [], 4, which ,opts)", "errcatch") == 0);
+refMsg = msprintf(_("%s: Wrong type for input argument #%d: A real or complex matrix expected.\n"), "eigs", 9);
+assert_checkerror("eigs(sparse(A), [], 4, which, opts)", refMsg);
+opts.resid = "ahh";
+assert_checkfalse(execstr("eigs(A, [], 4, which ,opts)", "errcatch") == 0);
+refMsg = msprintf(_("%s: Wrong type for input argument #%d: A real or complex matrix expected.\n"), "eigs", 9);
+assert_checkerror("eigs(A, [], 4, which, opts)", refMsg);
+assert_checkfalse(execstr("eigs(sparse(A), [], 4, which ,opts)", "errcatch") == 0);
+refMsg = msprintf(_("%s: Wrong type for input argument #%d: A real or complex matrix expected.\n"), "eigs", 9);
+assert_checkerror("eigs(sparse(A), [], 4, which, opts)", refMsg);
+opts.resid = %eps;
+assert_checkfalse(execstr("eigs(A, [], 4, which ,opts)", "errcatch") == 0);
+refMsg = msprintf(_("%s: Wrong dimension for input argument #%d: Start vector %s must be N by 1.\n"), "eigs", 9, "opts.resid");
+assert_checkerror("eigs(A, [], 4, which, opts)", refMsg);
+assert_checkfalse(execstr("eigs(sparse(A), [], 4, which ,opts)", "errcatch") == 0);
+refMsg = msprintf(_("%s: Wrong dimension for input argument #%d: Start vector %s must be N by 1.\n"), "eigs", 9, "opts.resid");
+assert_checkerror("eigs(sparse(A), [], 4, which, opts)", refMsg);
+opts.resid = [1 2];
+assert_checkfalse(execstr("eigs(A, [], 4, which ,opts)", "errcatch") == 0);
+refMsg = msprintf(_("%s: Wrong dimension for input argument #%d: Start vector %s must be N by 1.\n"), "eigs", 9, "opts.resid");
+assert_checkerror("eigs(A, [], 4, which, opts)", refMsg);
+assert_checkfalse(execstr("eigs(sparse(A), [], 4, which ,opts)", "errcatch") == 0);
+refMsg = msprintf(_("%s: Wrong dimension for input argument #%d: Start vector %s must be N by 1.\n"), "eigs", 9, "opts.resid");
+assert_checkerror("eigs(sparse(A), [], 4, which, opts)", refMsg);
+opts.resid = [1;2];
+assert_checkfalse(execstr("eigs(A, [], 4, which ,opts)", "errcatch") == 0);
+refMsg = msprintf(_("%s: Wrong dimension for input argument #%d: Start vector %s must be N by 1.\n"), "eigs", 9, "opts.resid");
+assert_checkerror("eigs(A, [], 4, which, opts)", refMsg);
+assert_checkfalse(execstr("eigs(sparse(A), [], 4, which ,opts)", "errcatch") == 0);
+refMsg = msprintf(_("%s: Wrong dimension for input argument #%d: Start vector %s must be N by 1.\n"), "eigs", 9, "opts.resid");
+assert_checkerror("eigs(sparse(A), [], 4, which, opts)", refMsg);
+opts.resid = [];
+assert_checkfalse(execstr("eigs(A, [], 4, which ,opts)", "errcatch") == 0);
+refMsg = msprintf(_("%s: Wrong dimension for input argument #%d: Start vector %s must be N by 1.\n"), "eigs", 9, "opts.resid");
+assert_checkerror("eigs(A, [], 4, which, opts)", refMsg);
+assert_checkfalse(execstr("eigs(sparse(A), [], 4, which ,opts)", "errcatch") == 0);
+refMsg = msprintf(_("%s: Wrong dimension for input argument #%d: Start vector %s must be N by 1.\n"), "eigs", 9, "opts.resid");
+assert_checkerror("eigs(sparse(A), [], 4, which, opts)", refMsg);
+clear opts
+opts.issym = %f;
+assert_checkfalse(execstr("eigs(A, [], 4, which ,opts)", "errcatch") == 0);
+refMsg = msprintf(_("%s: Wrong type for input argument: If A is a matrix, use opts with tol, maxiter, ncv, resid, cholB"), "eigs");
+assert_checkerror("eigs(A, [], 4, which, opts)", refMsg);
+clear opts
+opts.isreal = %f;
+assert_checkfalse(execstr("eigs(A, [], 4, which ,opts)", "errcatch") == 0);
+refMsg = msprintf(_("%s: Wrong type for input argument: If A is a matrix, use opts with tol, maxiter, ncv, resid, cholB"), "eigs");
+assert_checkerror("eigs(A, [], 4, which, opts)", refMsg);
+clear opts
+n = 20;
+k = 5;
+A = diag(10*ones(n,1));
+A(1:$-1,2:$) = A(1:$-1,2:$) + diag(6*ones(n-1,1));
+A(2:$,1:$-1) = A(2:$,1:$-1) + diag(6*ones(n-1,1));
+A = sparse(A);
+d1 = eigs(A, [], k);
+d0 = spec(full(A));
+assert_checkalmostequal(d1, d0(($-k+1):$), 1.e-10);
+d1 = eigs(A, [], k, "LM");
+assert_checkalmostequal(d1, d0(($-k+1):$), 1.e-10);
+d1 = eigs(A, [], k, "SM");
+assert_checkalmostequal(d1, d0(1:k), 1.e-10);
+d1 = eigs(A, [], k, "LA");
+assert_checkalmostequal(d1, d0(($-k+1):$), 1.e-10);
+d1 = eigs(A, [], k, "SA");
+assert_checkalmostequal(d1, d0(k:-1:1), 1.e-10);
+d1 = eigs(A, [], k, "BE");
+assert_checkalmostequal(d1, [d0(1:2); d0($-2:$)], 1.e-10);
+d1 = eigs(A, [], k, 2);
+assert_checkalmostequal(d1, d0(3:3+k-1), 1.e-10);
+d1 = eigs(A, speye(n,n), k, "LM");
+assert_checkalmostequal(d1, d0(($-k+1):$), 1.e-10);
+d1 = eigs(A, speye(n,n), k, 2);
+assert_checkalmostequal(d1, d0(3:3+k-1), 1.e-10);
+opts.cholB = %t;
+d1 = eigs(A, speye(n,n), k, "LM", opts);
+assert_checkalmostequal(d1, d0(($-k+1):$), 1.e-10);
+opts.cholB = %t;
+d1 = eigs(A, speye(n,n), k, 2, opts);
+assert_checkalmostequal(eigs(A, [],k, 2), d0(3:3+k-1), 1.e-10);
+[d1, v1] = eigs(A, [], k, "LM");
+assert_checkalmostequal(A*v1, v1*d1,sqrt(%eps), 1.e-10);
+[d1, v1] = eigs(A, [], k, "SM");
+assert_checkalmostequal(A*v1, v1*d1,sqrt(%eps), 1.e-10);
+[d1, v1] = eigs(A, [], k, "LA");
+assert_checkalmostequal(A*v1, v1*d1,sqrt(%eps), 1.e-10);
+[d1, v1] = eigs(A, [], k, "SA");
+assert_checkalmostequal(A*v1, v1*d1,sqrt(%eps), 1.e-10);
+[d1, v1] = eigs(A, [], k, "BE");
+assert_checkalmostequal(A*v1, v1*d1,sqrt(%eps), 1.e-10);
+n = 20;
+k = 5;
+A = diag((1:n));
+A(1:$-1,2:$) = A(1:$-1,2:$) + diag(6*ones(n-1,1));
+A(2:$,1:$-1) = A(2:$,1:$-1) + diag(-6*ones(n-1,1));
+A = sparse(A);
+d1 = eigs(A, [], k);
+d0 = gsort(spec(full(A)));
+assert_checkalmostequal(abs(d1), abs(d0(k+2-1:-1:2)), 1.e-10);
+d1 = eigs(A, [], k, "LM");
+assert_checkalmostequal(abs(d1), abs(d0(k+2-1:-1:2)), 1.e-10);
+d1 = eigs(A, [], k, "SM");
+assert_checkalmostequal(abs(d1), abs(d0($-k:$-1)), 1.e-10);
+d1 = eigs(A, [], k, "LR");
+assert_checkalmostequal(real(d1), real(d0(k+2-1:-1:2)), 1.e-10);
+d1 = eigs(A, [], k, "SR");
+assert_checkalmostequal(real(d1), gsort(real(d0([13 14 18 19 20]))), 1.e-10);
+d1 = eigs(A, [], k, "LI");
+assert_checkalmostequal(abs(imag(d1)), abs(imag(d0([3 4 2 1 18]))), 1.e-10);
+d1 = eigs(A, [], k, "SI");
+assert_checkalmostequal(abs(imag(d1)), abs(imag(d0([9 10 11 12 15]))), 1.e-10);
+d1 = eigs(A, [], k, 2);
+assert_checkalmostequal(abs(d1), abs(d0([19 20 12 11 15])), 1.e-10);
+d1 = eigs(A, speye(n,n), k, "LM");
+assert_checkalmostequal(abs(d1), abs(d0(k+2-1:-1:2)), 1.e-10);
+d1 = eigs(A, speye(n,n), k, 2);
+assert_checkalmostequal(abs(d1), abs(d0([19 20 12 11 15])), 1.e-10);
+opts.cholB = %t;
+d1 = eigs(A, speye(n,n), k, "LM", opts);
+assert_checkalmostequal(abs(d1), abs(d0(k+2-1:-1:2)), 1.e-10);
+opts.cholB = %t;
+d1 = eigs(A, speye(n,n), k, 2, opts);
+assert_checkalmostequal(abs(d1), abs(d0([19 20 12 11 15])), 1.e-10);
+[d1, v1] = eigs(A, [], k, "LM");
+assert_checkalmostequal(A*v1, v1*d1,sqrt(%eps), 1.e-10);
+[d1, v1] = eigs(A, [], k, "SM");
+assert_checkalmostequal(A*v1, v1*d1,sqrt(%eps), 1.e-10);
+[d1, v1] = eigs(A, [], k, "LR");
+assert_checkalmostequal(A*v1, v1*d1,sqrt(%eps), 1.e-10);
+[d1, v1] = eigs(A, [], k, "SR");
+assert_checkalmostequal(A*v1, v1*d1,sqrt(%eps), 1.e-10);
+[d1, v1] = eigs(A, [], k, "LI");
+assert_checkalmostequal(A*v1, v1*d1,sqrt(%eps), 1.e-10);
+[d1, v1] = eigs(A, [], k, "SI");
+assert_checkalmostequal(A*v1, v1*d1,sqrt(%eps), 1.e-10);
+n = 20;
+k = 5;
+A = diag((1:n) + %i * ones(1,n));
+A(1:$-1,2:$) = A(1:$-1,2:$) + diag(6*ones(n-1,1));
+A(2:$,1:$-1) = A(2:$,1:$-1) + diag(-6*ones(n-1,1));
+A = sparse(A);
+d1 = eigs(A, [], k);
+d0 = gsort(spec(full(A)));
+r = gsort(real(d0));
+im = gsort(imag(d0));
+assert_checkalmostequal(abs(d1), abs(d0(k:-1:1)), 1.e-10);
+d1 = eigs(A, [], k, "LM");
+assert_checkalmostequal(abs(d1), abs(d0(k:-1:1)), 1.e-10);
+//d1 = eigs(A, [], k, 'SM');
+//assert_checkalmostequal(abs(d1), abs(d0(1:k)), 1.e-14); // error -> impossible to invert complex sparse matrix
+d1 = eigs(A, [], k, "LR");
+assert_checkalmostequal(real(d1), real(d0(k:-1:1)), 1.e-10);
+d1 = eigs(A, [], k, "SR");
+assert_checkalmostequal(real(d1), r($-k+1:$), 1.e-10);
+d1 = eigs(A, [], k, "LI");
+assert_checkalmostequal(imag(d1), im(k:-1:1), 1.e-10);
+d1 = eigs(A, [], k, "SI");
+assert_checkalmostequal(imag(d1), im($-k+1:$), 1.e-10);
+d1 = eigs(A, speye(n,n), k, "LM");
+assert_checkalmostequal(abs(d1), abs(d0(k:-1:1)), 1.e-10);
+opts.cholB = %t;
+d1 = eigs(A, speye(n,n), k, "LM", opts);
+assert_checkalmostequal(abs(d1), abs(d0(k:-1:1)), 1.e-10);
+[d1, v1] = eigs(A, [], k, "LM");
+assert_checkalmostequal(A*v1, v1*d1,sqrt(%eps), 1.e-10);
+[d1, v1] = eigs(A, [], k, "LR");
+assert_checkalmostequal(A*v1, v1*d1,sqrt(%eps), 1.e-10);
+[d1, v1] = eigs(A, [], k, "SR");
+assert_checkalmostequal(A*v1, v1*d1,sqrt(%eps), 1.e-10);
+[d1, v1] = eigs(A, [], k, "LI");
+assert_checkalmostequal(A*v1, v1*d1,sqrt(%eps), 1.e-10);
+[d1, v1] = eigs(A, [], k, "SI");
+assert_checkalmostequal(A*v1, v1*d1,sqrt(%eps), 1.e-10);
+n = 20;
+k = 5;
+A = diag(10*ones(n,1));
+A(1:$-1,2:$) = A(1:$-1,2:$) + diag(6*ones(n-1,1));
+A(2:$,1:$-1) = A(2:$,1:$-1) + diag(6*ones(n-1,1));
+d1 = eigs(A, [], k);
+d0 = spec(A);
+assert_checkalmostequal(d1, d0(($-k+1):$), 1.e-10);
+d1 = eigs(A, [], k, "LM");
+assert_checkalmostequal(d1, d0(($-k+1):$), 1.e-10);
+d1 = eigs(A, [], k, "SM");
+assert_checkalmostequal(d1, d0(1:k), 1.e-10);
+d1 = eigs(A, [], k, "LA");
+assert_checkalmostequal(d1, d0(($-k+1):$), 1.e-10);
+d1 = eigs(A, [], k, "SA");
+assert_checkalmostequal(d1, d0(k:-1:1), 1.e-10);
+d1 = eigs(A, [], k, "BE");
+assert_checkalmostequal(d1, [d0(1:2); d0($-2:$)], 1.e-10);
+d1 = eigs(A, [], k, 2);
+assert_checkalmostequal(d1, d0(3:3+k-1), 1.e-10);
+d1 = eigs(A, eye(n,n), k, "LM");
+assert_checkalmostequal(d1, d0(($-k+1):$), 1.e-10);
+d1 = eigs(A, eye(n,n), k, 2);
+assert_checkalmostequal(d1, d0(3:3+k-1), 1.e-10);
+opts.cholB = %t;
+d1 = eigs(A, eye(n,n), k, "LM", opts);
+assert_checkalmostequal(d1, d0(($-k+1):$), 1.e-10);
+opts.cholB = %t;
+d1 = eigs(A, eye(n,n), k, 2, opts);
+assert_checkalmostequal(eigs(A, [],k, 2), d0(3:3+k-1), 1.e-10);
+[d1, v1] = eigs(A, [], k, "LM");
+assert_checkalmostequal(A*v1, v1*d1,sqrt(%eps), 1.e-10);
+[d1, v1] = eigs(A, [], k, "SM");
+assert_checkalmostequal(A*v1, v1*d1,sqrt(%eps), 1.e-10);
+[d1, v1] = eigs(A, [], k, "LA");
+assert_checkalmostequal(A*v1, v1*d1,sqrt(%eps), 1.e-10);
+[d1, v1] = eigs(A, [], k, "SA");
+assert_checkalmostequal(A*v1, v1*d1,sqrt(%eps), 1.e-10);
+[d1, v1] = eigs(A, [], k, "BE");
+assert_checkalmostequal(A*v1, v1*d1,sqrt(%eps), 1.e-10);
+n = 20;
+k = 5;
+A = diag((1:n));
+A(1:$-1,2:$) = A(1:$-1,2:$) + diag(6*ones(n-1,1));
+A(2:$,1:$-1) = A(2:$,1:$-1) + diag(-6*ones(n-1,1));
+d1 = eigs(A, [], k);
+d0 = gsort(spec(A));
+assert_checkalmostequal(abs(d1), abs(d0(k+2-1:-1:2)), 1.e-10);
+d1 = eigs(A, [], k, "LM");
+assert_checkalmostequal(abs(d1), abs(d0(k+2-1:-1:2)), 1.e-10);
+d1 = eigs(A, [], k, "SM");
+assert_checkalmostequal(abs(d1), abs(d0($-k:$-1)), 1.e-10);
+d1 = eigs(A, [], k, "LR");
+assert_checkalmostequal(real(d1), real(d0(k+2-1:-1:2)), 1.e-10);
+d1 = eigs(A, [], k, "SR");
+assert_checkalmostequal(real(d1), gsort(real(d0([13 14 18 19 20]))), 1.e-10);
+d1 = eigs(A, [], k, "LI");
+assert_checkalmostequal(abs(imag(d1)), abs(imag(d0([3 4 2 1 18]))), 1.e-10);
+d1 = eigs(A, [], k, "SI");
+assert_checkalmostequal(abs(imag(d1)), abs(imag(d0([9 10 11 12 15]))), 1.e-10);
+d1 = eigs(A, [], k, 2);
+assert_checkalmostequal(abs(d1), abs(d0([19 20 12 11 15])), 1.e-10);
+d1 = eigs(A, eye(n,n), k, "LM");
+assert_checkalmostequal(abs(d1), abs(d0(k+2-1:-1:2)), 1.e-10);
+d1 = eigs(A, eye(n,n), k, 2);
+assert_checkalmostequal(abs(d1), abs(d0([19 20 12 11 15])), 1.e-10);
+opts.cholB = %t;
+d1 = eigs(A, eye(n,n), k, "LM", opts);
+assert_checkalmostequal(abs(d1), abs(d0(k+2-1:-1:2)), 1.e-10);
+opts.cholB = %t;
+d1 = eigs(A, eye(n,n), k, 2, opts);
+assert_checkalmostequal(abs(d1), abs(d0([19 20 12 11 15])), 1.e-10);
+[d1, v1] = eigs(A, [], k, "LM");
+assert_checkalmostequal(A*v1, v1*d1,sqrt(%eps), 1.e-10);
+[d1, v1] = eigs(A, [], k, "SM");
+assert_checkalmostequal(A*v1, v1*d1,sqrt(%eps), 1.e-10);
+[d1, v1] = eigs(A, [], k, "LR");
+assert_checkalmostequal(A*v1, v1*d1,sqrt(%eps), 1.e-10);
+[d1, v1] = eigs(A, [], k, "SR");
+assert_checkalmostequal(A*v1, v1*d1,sqrt(%eps), 1.e-10);
+[d1, v1] = eigs(A, [], k, "LI");
+assert_checkalmostequal(A*v1, v1*d1,sqrt(%eps), 1.e-10);
+[d1, v1] = eigs(A, [], k, "SI");
+assert_checkalmostequal(A*v1, v1*d1,sqrt(%eps), 1.e-10);
+n = 20;
+k = 5;
+A = diag((1:n) + %i * ones(1,n));
+A(1:$-1,2:$) = A(1:$-1,2:$) + diag(6*ones(n-1,1));
+A(2:$,1:$-1) = A(2:$,1:$-1) + diag(-6*ones(n-1,1));
+d1 = eigs(A, [], k);
+d0 = gsort(spec(A));
+r = gsort(real(d0));
+im = gsort(imag(d0));
+assert_checkalmostequal(abs(d1), abs(d0(k:-1:1)), 1.e-10);
+d1 = eigs(A, [], k, "LM");
+assert_checkalmostequal(abs(d1), abs(d0(k:-1:1)), 1.e-10);
+d1 = eigs(A, [], k, "SM");
+assert_checkalmostequal(abs(d1), abs(d0($-k+1:$)), 1.e-10);
+d1 = eigs(A, [], k, "LR");
+assert_checkalmostequal(real(d1), r(k:-1:1), 1.e-10);
+d1 = eigs(A, [], k, "SR");
+assert_checkalmostequal(real(d1), r($-k+1:$), 1.e-10);
+d1 = eigs(A, [], k, "LI");
+assert_checkalmostequal(imag(d1), im(k:-1:1), 1.e-10);
+d1 = eigs(A, [], k, "SI");
+assert_checkalmostequal(imag(d1), im($-k+1:$), 1.e-10);
+d1 = eigs(A, [], k, 2);
+assert_checkalmostequal(gsort(abs(d1)), gsort(abs(d0($-1:-1:$-k))), 1.e-10);
+d1 = eigs(A, eye(n,n), k, "LM");
+assert_checkalmostequal(abs(d1), abs(d0(k:-1:1)), 1.e-10);
+opts.cholB = %t;
+d1 = eigs(A, eye(n,n), k, "LM", opts);
+assert_checkalmostequal(abs(d1), abs(d0(k:-1:1)), 1.e-10);
+opts.cholB = %t;
+d1 = eigs(A, eye(n,n), k, 2, opts);
+assert_checkalmostequal(abs(eigs(A, [], k, 2)), abs(d1), 1.e-10);
+[d1, v1] = eigs(A, [], k, "LM");
+assert_checkalmostequal(A*v1, v1*d1, sqrt(%eps), 1.e-10);
+[d1, v1] = eigs(A, [], k, "LR");
+assert_checkalmostequal(A*v1, v1*d1, sqrt(%eps), 1.e-10);
+[d1, v1] = eigs(A, [], k, "SR");
+assert_checkalmostequal(A*v1, v1*d1, sqrt(%eps), 1.e-10);
+[d1, v1] = eigs(A, [], k, "LI");
+assert_checkalmostequal(A*v1, v1*d1, sqrt(%eps), 1.e-10);
+[d1, v1] = eigs(A, [], k, "SI");
+assert_checkalmostequal(A*v1, v1*d1, sqrt(%eps), 1.e-10);
+clear opts
+// Tests : A is a function
+// Sparse matrix tests
+n = 20;
+k = 5;
+A = diag(10*ones(n,1));
+A(1:$-1,2:$) = A(1:$-1,2:$) + diag(6*ones(n-1,1));
+A(2:$,1:$-1) = A(2:$,1:$-1) + diag(6*ones(n-1,1));
+A = sparse(A);
+function y = fn(x)
+ y = A * x;
+endfunction
+opts.isreal = %t;
+opts.issym = %t;
+d1 = eigs(fn, n, [], k, "LM", opts );
+d0 = spec(full(A));
+assert_checkalmostequal(d1, d0(($-k+1):$), 1.e-10);
+clear fn
+function y = fn(x)
+ y = A \x;
+endfunction
+opts.isreal = %t;
+opts.issym = %t;
+d1 = eigs(fn, n, [], k, "SM", opts );
+assert_checkalmostequal(d1, d0(1:k), 1.e-10);
+clear fn
+function y = fn(x)
+ y = (A - 2 * speye(n,n)) \x;
+endfunction
+opts.isreal = %t;
+opts.issym = %t;
+d1 = eigs(fn, n, [], k, 2, opts);
+assert_checkalmostequal(d1, d0(3:3+k-1), 1.e-10);
+n = 20;
+k = 5;
+A = diag((1:n));
+A(1:$-1,2:$) = A(1:$-1,2:$) + diag(6*ones(n-1,1));
+A(2:$,1:$-1) = A(2:$,1:$-1) + diag(-6*ones(n-1,1));
+A = sparse(A);
+clear fn
+function y = fn(x)
+ y = A * x;
+endfunction
+opts.isreal = %t;
+opts.issym = %f;
+d1 = eigs(fn, n, [], k, "LM", opts );
+d0 = gsort(spec(full(A)));
+assert_checkalmostequal(abs(d1), abs(d0(k+2-1:-1:2)), 1.e-10);
+clear fn
+function y = fn(x)
+ y = A \x;
+endfunction
+opts.isreal = %t;
+opts.issym = %f;
+d1 = eigs(fn, n, [], k, "SM", opts );
+assert_checkalmostequal(abs(d1), abs(d0($-k:$-1)), 1.e-10);
+clear fn
+function y = fn(x)
+ y = (A - 2 * speye(n,n)) \x;
+endfunction
+opts.isreal = %t;
+opts.issym = %f;
+d1 = eigs(fn, n, [], k, 2, opts );
+assert_checkalmostequal(abs(d1), abs(d0([19 20 12 11 15])), 1.e-10);
+n = 20;
+k = 5;
+A = diag((1:n) + %i * ones(1,n));
+A(1:$-1,2:$) = A(1:$-1,2:$) + diag(6*ones(n-1,1));
+A(2:$,1:$-1) = A(2:$,1:$-1) + diag(-6*ones(n-1,1));
+A = sparse(A);
+clear fn
+function y = fn(x)
+ y = A * x;
+endfunction
+opts.isreal = %f;
+opts.issym = %f;
+d1 = eigs(fn, n, [], k, "LM", opts );
+d0 = gsort(spec(full(A)));
+r = gsort(real(d0));
+im = gsort(imag(d0));
+assert_checkalmostequal(abs(d1), abs(d0(k:-1:1)), 1.e-10);
+clear fn
+function y = fn(x)
+ y = A \x;
+endfunction
+opts.isreal = %f;
+opts.issym = %f;
+d1 = eigs(fn, n, [], k, "SM", opts );
+assert_checkalmostequal(abs(d1), abs(d0($-k+1:$)), 1.e-10);
+clear fn
+function y = fn(x)
+ y = (A - 2 * speye(n,n)) \x;
+endfunction
+opts.isreal = %f;
+opts.issym = %f;
+d1 = eigs(fn, n, [], k, 2, opts );
+assert_checkalmostequal(gsort(abs(d1)), gsort(abs(d0($-1:-1:$-k))), 1.e-10);
+clear opts
+// Full matrix tests
+n = 20;
+k = 5;
+A = diag(10*ones(n,1));
+A(1:$-1,2:$) = A(1:$-1,2:$) + diag(6*ones(n-1,1));
+A(2:$,1:$-1) = A(2:$,1:$-1) + diag(6*ones(n-1,1));
+clear fn
+function y = fn(x)
+ y = A * x;
+endfunction
+opts.isreal = %t;
+opts.issym = %t;
+d1 = eigs(fn, n, [], k, "LM", opts );
+d0 = spec(A);
+assert_checkalmostequal(d1, d0(($-k+1):$), 1.e-10);
+clear fn
+function y = fn(x)
+ y = A \x;
+endfunction
+opts.isreal = %t;
+opts.issym = %t;
+d1 = eigs(fn, n, [], k, "SM", opts );
+assert_checkalmostequal(d1, d0(1:k), 1.e-10);
+clear fn
+function y = fn(x)
+ y = (A - 2 * speye(n,n)) \x;
+endfunction
+opts.isreal = %t;
+opts.issym = %t;
+d1 = eigs(fn, n, [], k, 2, opts);
+assert_checkalmostequal(d1, d0(3:3+k-1), 1.e-10);
+n = 20;
+k = 5;
+A = diag((1:n));
+A(1:$-1,2:$) = A(1:$-1,2:$) + diag(6*ones(n-1,1));
+A(2:$,1:$-1) = A(2:$,1:$-1) + diag(-6*ones(n-1,1));
+clear fn
+function y = fn(x)
+ y = A * x;
+endfunction
+opts.isreal = %t;
+opts.issym = %f;
+d1 = eigs(fn, n, [], k, "LM", opts );
+d0 = gsort(spec(A));
+assert_checkalmostequal(abs(d1), abs(d0(k+2-1:-1:2)), 1.e-10);
+clear fn
+function y = fn(x)
+ y = A \x;
+endfunction
+opts.isreal = %t;
+opts.issym = %f;
+d1 = eigs(fn, n, [], k, "SM", opts );
+assert_checkalmostequal(abs(d1), abs(d0($-k:$-1)), 1.e-10);
+clear fn
+function y = fn(x)
+ y = (A - 2 * speye(n,n)) \x;
+endfunction
+opts.isreal = %t;
+opts.issym = %f;
+d1 = eigs(fn, n, [], k, 2, opts );
+assert_checkalmostequal(abs(d1), abs(d0([19 20 12 11 15])), 1.e-10);
+n = 20;
+k = 5;
+A = diag((1:n) + %i * ones(1,n));
+A(1:$-1,2:$) = A(1:$-1,2:$) + diag(6*ones(n-1,1));
+A(2:$,1:$-1) = A(2:$,1:$-1) + diag(-6*ones(n-1,1));
+clear fn
+function y = fn(x)
+ y = A * x;
+endfunction
+opts.isreal = %f;
+opts.issym = %f;
+d1 = eigs(fn, n, [], k, "LM", opts );
+d0 = gsort(spec(A));
+r = gsort(real(d0));
+im = gsort(imag(d0));
+assert_checkalmostequal(abs(d1), abs(d0(k:-1:1)), 1.e-10);
+clear fn
+function y = fn(x)
+ y = A \x;
+endfunction
+opts.isreal = %f;
+opts.issym = %f;
+d1 = eigs(fn, n, [], k, "SM", opts );
+assert_checkalmostequal(abs(d1), abs(d0($-k+1:$)), 1.e-10);
+clear fn
+function y = fn(x)
+ y = (A - 2 * speye(n,n)) \x;
+endfunction
+opts.isreal = %f;
+opts.issym = %f;
+d1 = eigs(fn, n, [], k, 2, opts );
+assert_checkalmostequal(gsort(abs(d1)), gsort(abs(d0($-1:-1:$-k))), 1.e-10);
diff --git a/modules/arnoldi/tests/unit_tests/eigs.tst b/modules/arnoldi/tests/unit_tests/eigs.tst
new file mode 100755
index 000000000..3c8cd4080
--- /dev/null
+++ b/modules/arnoldi/tests/unit_tests/eigs.tst
@@ -0,0 +1,1131 @@
+// =============================================================================
+// Scilab ( http://www.scilab.org/ ) - This file is part of Scilab
+// Copyright (C) 2012 - Scilab Enterprises - Adeline CARNIS
+//
+// This file is distributed under the same license as the Scilab package.
+// =============================================================================
+
+// <-- CLI SHELL MODE -->
+
+// unit tests for eigs function
+// =============================================================================
+
+// Interface
+// =========
+assert_checkfalse(execstr("eigs()" ,"errcatch") == 0);
+refMsg = msprintf(_("%s : Wrong number of input arguments : %d to %d expected.\n"), "eigs", 1, 6);
+assert_checkerror("eigs()", refMsg);
+
+assert_checkfalse(execstr("eigs(1)","errcatch") == 0);
+refMsg = msprintf(_("%s: Wrong type for input argument #%d: A square matrix expected.\n"), "eigs", 1);
+assert_checkerror("eigs(1)", refMsg);
+
+assert_checkfalse(execstr("eigs([])", "errcatch") == 0);
+refMsg = msprintf(_("%s: Wrong type for input argument #%d: A full or sparse square matrix or a function expected"), "eigs", 1);
+assert_checkerror("eigs([])", refMsg);
+
+assert_checkfalse(execstr("eigs(%nan)", "errcatch") == 0);
+refMsg = msprintf(_("%s: Wrong type for input argument #%d: A square matrix expected.\n"), "eigs", 1);
+assert_checkerror("eigs(%nan)", refMsg);
+
+assert_checkfalse(execstr("eigs(%inf)", "errcatch") == 0);
+refMsg = msprintf(_("%s: Wrong type for input argument #%d: A square matrix expected.\n"), "eigs", 1);
+assert_checkerror("eigs(%inf)", refMsg);
+
+assert_checkfalse(execstr("eigs(%eps)", "errcatch") == 0);
+refMsg = msprintf(_("%s: Wrong type for input argument #%d: A square matrix expected.\n"), "eigs", 1);
+assert_checkerror("eigs(%eps)", refMsg);
+
+assert_checkfalse(execstr("eigs([%f %f])", "errcatch") == 0);
+refMsg = msprintf(_("%s: Wrong type for input argument #%d: A full or sparse square matrix or a function expected"), "eigs", 1);
+assert_checkerror("eigs([%f %f])", refMsg);
+
+assert_checkfalse(execstr("eigs(sparse([%f %f]))", "errcatch") == 0);
+refMsg = msprintf(_("%s: Wrong type for input argument #%d: A full or sparse square matrix or a function expected"), "eigs", 1);
+assert_checkerror("eigs(sparse([%f %f]))", refMsg);
+
+assert_checkfalse(execstr("eigs([1 2])", "errcatch") == 0);
+refMsg = msprintf(_("%s: Wrong type for input argument #%d: A square matrix expected.\n"), "eigs", 1);
+assert_checkerror("eigs([1 2])", refMsg);
+
+assert_checkfalse(execstr("eigs([1; 2])", "errcatch") == 0);
+refMsg = msprintf(_("%s: Wrong type for input argument #%d: A square matrix expected.\n"), "eigs", 1);
+assert_checkerror("eigs([1; 2])", refMsg);
+
+assert_checkfalse(execstr("eigs(sparse([1 2]))", "errcatch") == 0);
+refMsg = msprintf(_("%s: Wrong type for input argument #%d: A square matrix expected.\n"), "eigs", 1);
+assert_checkerror("eigs(sparse([1 2]))", refMsg);
+
+assert_checkfalse(execstr("eigs(sparse([1; 2]))", "errcatch") == 0);
+refMsg = msprintf(_("%s: Wrong type for input argument #%d: A square matrix expected.\n"), "eigs", 1);
+assert_checkerror("eigs(sparse([1; 2]))", refMsg);
+
+
+n = 20;
+A = diag(10*ones(n,1));
+A(1:$-1,2:$) = A(1:$-1,2:$) + diag(6*ones(n-1,1));
+A(2:$,1:$-1) = A(2:$,1:$-1) + diag(6*ones(n-1,1));
+
+assert_checkfalse(execstr("eigs(A, %f)", "errcatch") == 0);
+refMsg = msprintf(_("%s: Wrong type for input argument #%d: An empty matrix or full or sparse square matrix expected.\n"), "eigs", 2);
+assert_checkerror("eigs(A, %f)", refMsg);
+
+assert_checkfalse(execstr("eigs(A, %nan)", "errcatch") == 0);
+refMsg = msprintf(_("%s: Wrong dimension for input argument #%d: B must have the same size as A.\n"), "eigs", 2);
+assert_checkerror("eigs(A, %nan)", refMsg);
+
+assert_checkfalse(execstr("eigs(A, %inf)", "errcatch") == 0);
+refMsg = msprintf(_("%s: Wrong dimension for input argument #%d: B must have the same size as A.\n"), "eigs", 2);
+assert_checkerror("eigs(A, %inf)", refMsg);
+
+assert_checkfalse(execstr("eigs(A, %eps)", "errcatch") == 0);
+refMsg = msprintf(_("%s: Wrong dimension for input argument #%d: B must have the same size as A.\n"), "eigs", 2);
+assert_checkerror("eigs(A, %eps)", refMsg);
+
+assert_checkfalse(execstr("eigs(sparse(A), %f)", "errcatch") == 0);
+refMsg = msprintf(_("%s: Wrong type for input argument #%d: An empty matrix or full or sparse square matrix expected.\n"), "eigs", 2);
+assert_checkerror("eigs(sparse(A), %f)", refMsg);
+
+assert_checkfalse(execstr("eigs(sparse(A), %nan)", "errcatch") == 0);
+refMsg = msprintf(_("%s: Wrong dimension for input argument #%d: B must have the same size as A.\n"), "eigs", 2);
+assert_checkerror("eigs(sparse(A), %nan)", refMsg);
+
+assert_checkfalse(execstr("eigs(sparse(A), %inf)", "errcatch") == 0);
+refMsg = msprintf(_("%s: Wrong dimension for input argument #%d: B must have the same size as A.\n"), "eigs", 2);
+assert_checkerror("eigs(sparse(A), %inf)", refMsg);
+
+assert_checkfalse(execstr("eigs(sparse(A), %eps)", "errcatch") == 0);
+refMsg = msprintf(_("%s: Wrong dimension for input argument #%d: B must have the same size as A.\n"), "eigs", 2);
+assert_checkerror("eigs(sparse(A), %eps)", refMsg);
+
+assert_checkfalse(execstr("eigs(A,[1 2])", "errcatch") == 0);
+refMsg = msprintf(_("%s: Wrong dimension for input argument #%d: B must have the same size as A.\n"), "eigs", 2);
+assert_checkerror("eigs(A,[1 2])", refMsg);
+
+assert_checkfalse(execstr("eigs(A,[1;2])", "errcatch") == 0);
+refMsg = msprintf(_("%s: Wrong dimension for input argument #%d: B must have the same size as A.\n"), "eigs", 2);
+assert_checkerror("eigs(A,[1;2])", refMsg);
+
+assert_checkfalse(execstr("eigs(sparse(A), [1 2])", "errcatch") == 0);
+refMsg = msprintf(_("%s: Wrong dimension for input argument #%d: B must have the same size as A.\n"), "eigs", 2);
+assert_checkerror("eigs(sparse(A), [1 2])", refMsg);
+
+assert_checkfalse(execstr("eigs(sparse(A), [1;2])", "errcatch") == 0);
+refMsg = msprintf(_("%s: Wrong dimension for input argument #%d: B must have the same size as A.\n"), "eigs", 2);
+assert_checkerror("eigs(sparse(A), [1;2])", refMsg);
+
+
+assert_checkfalse(execstr("eigs(A, [], [])", "errcatch") == 0);
+refMsg = msprintf(_("%s: Wrong type for input argument #%d: A scalar expected.\n"), "eigs", 3);
+assert_checkerror("eigs(A, [], [])", refMsg);
+
+assert_checkfalse(execstr("eigs(A, [], %f)", "errcatch") == 0);
+refMsg = msprintf(_("%s: Wrong type for input argument #%d: A scalar expected.\n"), "eigs", 3);
+assert_checkerror("eigs(A, [], %f)", refMsg);
+
+assert_checkfalse(execstr("eigs(A, [], 2*%i)", "errcatch") == 0);
+refMsg = msprintf(_("%s: Wrong type for input argument #%d: A scalar expected.\n"), "eigs", 3);
+assert_checkerror("eigs(A, [], 2*%i)", refMsg);
+
+assert_checkfalse(execstr("eigs(A, [], -15)", "errcatch") == 0);
+refMsg = msprintf(_("%s: Wrong type for input argument #%d: k must be a positive integer.\n"), "eigs", 3);
+assert_checkerror("eigs(A, [], -15)", refMsg);
+
+assert_checkfalse(execstr("eigs(A, [], 5.6)", "errcatch") == 0);
+refMsg = msprintf(_("%s: Wrong type for input argument #%d: k must be a positive integer.\n"), "eigs", 3);
+assert_checkerror("eigs(A, [], 5.6)", refMsg);
+
+assert_checkfalse(execstr("eigs(A, [], [1 2])", "errcatch") == 0);
+refMsg = msprintf(_("%s: Wrong type for input argument #%d: A scalar expected.\n"), "eigs", 3);
+assert_checkerror("eigs(A, [], [1 2])", refMsg);
+
+assert_checkfalse(execstr("eigs(A, [], %nan)", "errcatch") == 0);
+refMsg = msprintf(_("%s: Wrong type for input argument #%d: k must be a positive integer.\n"), "eigs", 3);
+assert_checkerror("eigs(A, [], %nan)", refMsg);
+
+assert_checkfalse(execstr("eigs(A, [], %eps)", "errcatch") == 0);
+refMsg = msprintf(_("%s: Wrong type for input argument #%d: k must be a positive integer.\n"), "eigs", 3);
+assert_checkerror("eigs(A, [], %eps)", refMsg);
+
+assert_checkfalse(execstr("eigs(A, [], %inf)", "errcatch") == 0);
+refMsg = msprintf(_("%s: Wrong value for input argument #%d: k must be in the range 1 to N.\n"), "eigs", 3);
+assert_checkerror("eigs(A, [], %inf)", refMsg);
+
+assert_checkfalse(execstr("eigs(sparse(A), [], %f)", "errcatch") == 0);
+refMsg = msprintf(_("%s: Wrong type for input argument #%d: A scalar expected.\n"), "eigs", 3);
+assert_checkerror("eigs(sparse(A), [], %f)", refMsg);
+
+assert_checkfalse(execstr("eigs(sparse(A), [], 2*%i)", "errcatch") == 0);
+refMsg = msprintf(_("%s: Wrong type for input argument #%d: A scalar expected.\n"), "eigs", 3);
+assert_checkerror("eigs(sparse(A), [], 2*%i)", refMsg);
+
+assert_checkfalse(execstr("eigs(sparse(A), [], -15)", "errcatch") == 0);
+refMsg = msprintf(_("%s: Wrong type for input argument #%d: k must be a positive integer.\n"), "eigs", 3);
+assert_checkerror("eigs(sparse(A), [], -15)", refMsg);
+
+assert_checkfalse(execstr("eigs(sparse(A), [], 5.6)", "errcatch") == 0);
+refMsg = msprintf(_("%s: Wrong type for input argument #%d: k must be a positive integer.\n"), "eigs", 3);
+assert_checkerror("eigs(sparse(A), [], 5.6)", refMsg);
+
+assert_checkfalse(execstr("eigs(sparse(A), [], [1 2])", "errcatch") == 0);
+refMsg = msprintf(_("%s: Wrong type for input argument #%d: A scalar expected.\n"), "eigs", 3);
+assert_checkerror("eigs(sparse(A), [], [1 2])", refMsg);
+
+assert_checkfalse(execstr("eigs(A, [], 4, [])", "errcatch") == 0);
+refMsg = msprintf(_("%s: Wrong type for input argument #%d: A scalar expected.\n"), "eigs", 4);
+assert_checkerror("eigs(A, [], 4, [])", refMsg);
+
+assert_checkfalse(execstr("eigs(A, [], 4, %nan)", "errcatch") == 0);
+refMsg = msprintf(_("%s: Wrong type for input argument #%d: sigma must be a real.\n"), "eigs", 4);
+assert_checkerror("eigs(A, [], 4, %nan)", refMsg);
+
+assert_checkfalse(execstr("eigs(A, [], 4, %f)", "errcatch") == 0);
+refMsg = msprintf(_("%s: Wrong type for input argument #%d: A scalar expected.\n"), "eigs", 4);
+assert_checkerror("eigs(A, [], 4, %f)", refMsg);
+
+assert_checkfalse(execstr("eigs(sparse(A), [], 4, [])", "errcatch") == 0);
+refMsg = msprintf(_("%s: Wrong type for input argument #%d: A scalar expected.\n"), "eigs", 4);
+assert_checkerror("eigs(sparse(A), [], 4, [])", refMsg);
+
+assert_checkfalse(execstr("eigs(sparse(A), [], 4, %nan)", "errcatch") == 0);
+refMsg = msprintf(_("%s: Wrong type for input argument #%d: A scalar expected.\n"), "eigs", 4);
+assert_checkerror("eigs(sparse(A), [], 4, %nan)", refMsg);
+
+assert_checkfalse(execstr("eigs(sparse(A), [], 4, %f)", "errcatch") == 0);
+refMsg = msprintf(_("%s: Wrong type for input argument #%d: a real scalar or a string expected.\n"), "eigs", 4);
+assert_checkerror("eigs(sparse(A), [], 4, %f)", refMsg);
+
+which = "ahh";
+assert_checkfalse(execstr("eigs(A, [], 4, which)", "errcatch") == 0);
+refMsg = msprintf(_("%s: Wrong value for input argument #%d: Unrecognized sigma value.\n Sigma must be one of ''%s'', ''%s'', ''%s'', ''%s'' or ''%s''.\n"), "eigs", 4, "LM", "SM", "LA", "SA", "BE");
+assert_checkerror("eigs(A, [], 4, which)", refMsg);
+
+assert_checkfalse(execstr("eigs(sparse(A), [], 4, which)", "errcatch") == 0);
+refMsg = msprintf(_("%s: Wrong value for input argument #%d: Unrecognized sigma value.\n Sigma must be one of ''%s'', ''%s'', ''%s'', ''%s'' or ''%s''.\n"), "eigs", 4, "LM", "SM", "LA", "SA", "BE");
+assert_checkerror("eigs(sparse(A), [], 4, which)", refMsg);
+
+which = "LM";
+assert_checkfalse(execstr("eigs(A, [], 4, which ,%nan)", "errcatch") == 0);
+refMsg = msprintf(_("%s: Wrong type for input argument #%d: A structure expected"), "eigs", 5);
+assert_checkerror("eigs(A, [], 4, which ,%nan)", refMsg);
+
+assert_checkfalse(execstr("eigs(sparse(A), [], 4, which ,%nan)", "errcatch") == 0);
+refMsg = msprintf(_("%s: Wrong type for input argument #%d: A structure expected"), "eigs", 5);
+assert_checkerror("eigs(sparse(A), [], 4, which, %nan)", refMsg);
+
+opts.var = %nan;
+assert_checkfalse(execstr("eigs(A, [], 4, which ,opts)", "errcatch") == 0);
+refMsg = msprintf(_("%s: Wrong type for input argument: If A is a matrix, use opts with tol, maxiter, ncv, resid, cholB"), "eigs");
+assert_checkerror("eigs(A, [], 4, which, opts)", refMsg);
+
+assert_checkfalse(execstr("eigs(sparse(A), [], 4, which ,opts)", "errcatch") == 0);
+refMsg = msprintf(_("%s: Wrong type for input argument: If A is a matrix, use opts with tol, maxiter, ncv, resid, cholB"), "eigs");
+assert_checkerror("eigs(sparse(A), [], 4, which, opts)", refMsg);
+
+clear opts
+opts.maxiter = [];
+assert_checkfalse(execstr("eigs(A, [], 4, which ,opts)", "errcatch") == 0);
+refMsg = msprintf(_("%s: Wrong type for input argument #%d: %s must be a scalar.\n"), "eigs", 5, "opts.maxiter");
+assert_checkerror("eigs(A, [], 4, which, opts)", refMsg);
+
+assert_checkfalse(execstr("eigs(sparse(A), [], 4, which ,opts)", "errcatch") == 0);
+refMsg = msprintf(_("%s: Wrong type for input argument #%d: %s must be a scalar.\n"), "eigs", 5, "opts.maxiter");
+assert_checkerror("eigs(sparse(A), [], 4, which, opts)", refMsg);
+
+opts.maxiter = %nan;
+assert_checkfalse(execstr("eigs(A, [], 4, which ,opts)", "errcatch") == 0);
+refMsg = msprintf(_("%s: Wrong type for input argument #%d: %s must be an integer positive value.\n"), "eigs", 5, "opts.maxiter");
+assert_checkerror("eigs(A, [], 4, which, opts)", refMsg);
+
+assert_checkfalse(execstr("eigs(sparse(A), [], 4, which ,opts)", "errcatch") == 0);
+refMsg = msprintf(_("%s: Wrong type for input argument #%d: %s must be an integer positive value.\n"), "eigs", 5, "opts.maxiter");
+assert_checkerror("eigs(sparse(A), [], 4, which ,opts)", refMsg);
+
+opts.maxiter = %f;
+assert_checkfalse(execstr("eigs(A, [], 4, which ,opts)", "errcatch") == 0);
+refMsg = msprintf(_("%s: Wrong type for input argument #%d: %s must be a scalar.\n"), "eigs", 5, "opts.maxiter");
+assert_checkerror("eigs(A, [], 4, which, opts)", refMsg);
+
+assert_checkfalse(execstr("eigs(sparse(A), [], 4, which ,opts)", "errcatch") == 0);
+refMsg = msprintf(_("%s: Wrong type for input argument #%d: %s must be a scalar.\n"), "eigs", 5, "opts.maxiter");
+assert_checkerror("eigs(sparse(A), [], 4, which, opts)", refMsg);
+
+opts.maxiter = "ahh";
+assert_checkfalse(execstr("eigs(A, [], 4, which ,opts)", "errcatch") == 0);
+refMsg = msprintf(_("%s: Wrong type for input argument #%d: %s must be a scalar.\n"), "eigs", 5, "opts.maxiter");
+assert_checkerror("eigs(A, [], 4, which, opts)", refMsg);
+
+assert_checkfalse(execstr("eigs(sparse(A), [], 4, which ,opts)", "errcatch") == 0);
+refMsg = msprintf(_("%s: Wrong type for input argument #%d: %s must be a scalar.\n"), "eigs", 5, "opts.maxiter");
+assert_checkerror("eigs(sparse(A), [], 4, which, opts)", refMsg);
+
+opts.maxiter = 5.1;
+assert_checkfalse(execstr("eigs(A, [], 4, which ,opts)", "errcatch") == 0);
+refMsg = msprintf(_("%s: Wrong type for input argument #%d: %s must be an integer positive value.\n"), "eigs", 5, "opts.maxiter");
+assert_checkerror("eigs(A, [], 4, which, opts)", refMsg);
+
+assert_checkfalse(execstr("eigs(sparse(A), [], 4, which ,opts)", "errcatch") == 0);
+refMsg = msprintf(_("%s: Wrong type for input argument #%d: %s must be an integer positive value.\n"), "eigs", 5, "opts.maxiter");
+assert_checkerror("eigs(sparse(A), [], 4, which ,opts)", refMsg);
+
+opts.maxiter = -5.1;
+assert_checkfalse(execstr("eigs(A, [], 4, which ,opts)", "errcatch") == 0);
+refMsg = msprintf(_("%s: Wrong type for input argument #%d: %s must be an integer positive value.\n"), "eigs", 5, "opts.maxiter");
+assert_checkerror("eigs(A, [], 4, which, opts)", refMsg);
+
+assert_checkfalse(execstr("eigs(sparse(A), [], 4, which ,opts)", "errcatch") == 0);
+refMsg = msprintf(_("%s: Wrong type for input argument #%d: %s must be an integer positive value.\n"), "eigs", 5, "opts.maxiter");
+assert_checkerror("eigs(sparse(A), [], 4, which ,opts)", refMsg);
+
+clear opts
+opts.tol = [];
+assert_checkfalse(execstr("eigs(A, [], 4, which ,opts)", "errcatch") == 0);
+refMsg = msprintf(_("%s: Wrong type for input argument #%d: %s must be a real scalar.\n"), "eigs", 6, "opts.tol");
+assert_checkerror("eigs(A, [], 4, which, opts)", refMsg);
+
+assert_checkfalse(execstr("eigs(sparse(A), [], 4, which ,opts)", "errcatch") == 0);
+refMsg = msprintf(_("%s: Wrong type for input argument #%d: %s must be a real scalar.\n"), "eigs", 6, "opts.tol");
+assert_checkerror("eigs(sparse(A), [], 4, which, opts)", refMsg);
+
+
+
+opts.tol = %nan;
+assert_checkfalse(execstr("eigs(A, [], 4, which ,opts)", "errcatch") == 0);
+refMsg = msprintf(_("%s: Wrong type for input argument #%d: %s must be a real scalar.\n"), "eigs", 6, "opts.tol");
+assert_checkerror("eigs(A, [], 4, which, opts)", refMsg);
+
+assert_checkfalse(execstr("eigs(sparse(A), [], 4, which ,opts)", "errcatch") == 0);
+refMsg = msprintf(_("%s: Wrong type for input argument #%d: %s must be a real scalar.\n"), "eigs", 6, "opts.tol");
+assert_checkerror("eigs(sparse(A), [], 4, which, opts)", refMsg);
+
+opts.tol = %f;
+assert_checkfalse(execstr("eigs(A, [], 4, which ,opts)", "errcatch") == 0);
+refMsg = msprintf(_("%s: Wrong type for input argument #%d: %s must be a real scalar.\n"), "eigs", 6, "opts.tol");
+assert_checkerror("eigs(A, [], 4, which, opts)", refMsg);
+
+assert_checkfalse(execstr("eigs(sparse(A), [], 4, which ,opts)", "errcatch") == 0);
+refMsg = msprintf(_("%s: Wrong type for input argument #%d: %s must be a real scalar.\n"), "eigs", 6, "opts.tol");
+assert_checkerror("eigs(sparse(A), [], 4, which, opts)", refMsg);
+
+opts.tol = "ahh";
+assert_checkfalse(execstr("eigs(A, [], 4, which ,opts)", "errcatch") == 0);
+refMsg = msprintf(_("%s: Wrong type for input argument #%d: %s must be a real scalar.\n"), "eigs", 6, "opts.tol");
+assert_checkerror("eigs(A, [], 4, which, opts)", refMsg);
+
+assert_checkfalse(execstr("eigs(sparse(A), [], 4, which ,opts)", "errcatch") == 0);
+refMsg = msprintf(_("%s: Wrong type for input argument #%d: %s must be a real scalar.\n"), "eigs", 6, "opts.tol");
+assert_checkerror("eigs(sparse(A), [], 4, which, opts)", refMsg);
+
+clear opts
+opts.ncv = %nan;
+assert_checkfalse(execstr("eigs(A, [], 4, which ,opts)", "errcatch") == 0);
+refMsg = msprintf(_("%s: Wrong type for input argument #%d: %s must be an integer scalar.\n"), "eigs", 7, "opts.ncv");
+assert_checkerror("eigs(A, [], 4, which, opts)", refMsg);
+
+assert_checkfalse(execstr("eigs(sparse(A), [], 4, which ,opts)", "errcatch") == 0);
+refMsg = msprintf(_("%s: Wrong type for input argument #%d: %s must be an integer scalar.\n"), "eigs", 7, "opts.ncv");
+assert_checkerror("eigs(sparse(A), [], 4, which, opts)", refMsg);
+
+opts.ncv = %f;
+assert_checkfalse(execstr("eigs(A, [], 4, which ,opts)", "errcatch") == 0);
+refMsg = msprintf(_("%s: Wrong type for input argument #%d: %s must be an integer scalar.\n"), "eigs", 7, "opts.ncv");
+assert_checkerror("eigs(A, [], 4, which, opts)", refMsg);
+
+assert_checkfalse(execstr("eigs(sparse(A), [], 4, which ,opts)", "errcatch") == 0);
+refMsg = msprintf(_("%s: Wrong type for input argument #%d: %s must be an integer scalar.\n"), "eigs", 7, "opts.ncv");
+assert_checkerror("eigs(sparse(A), [], 4, which, opts)", refMsg);
+
+opts.ncv = "ahh";
+assert_checkfalse(execstr("eigs(A, [], 4, which ,opts)", "errcatch") == 0);
+refMsg = msprintf(_("%s: Wrong type for input argument #%d: %s must be an integer scalar.\n"), "eigs", 7, "opts.ncv");
+assert_checkerror("eigs(A, [], 4, which, opts)", refMsg);
+
+assert_checkfalse(execstr("eigs(sparse(A), [], 4, which ,opts)", "errcatch") == 0);
+refMsg = msprintf(_("%s: Wrong type for input argument #%d: %s must be an integer scalar.\n"), "eigs", 7, "opts.ncv");
+assert_checkerror("eigs(sparse(A), [], 4, which, opts)", refMsg);
+
+opts.ncv = %eps;
+assert_checkfalse(execstr("eigs(A, [], 4, which ,opts)", "errcatch") == 0);
+refMsg = msprintf(_("%s: Wrong type for input argument #%d: %s must be an integer scalar.\n"), "eigs", 7, "opts.ncv");
+assert_checkerror("eigs(A, [], 4, which, opts)", refMsg);
+
+assert_checkfalse(execstr("eigs(sparse(A), [], 4, which ,opts)", "errcatch") == 0);
+refMsg = msprintf(_("%s: Wrong type for input argument #%d: %s must be an integer scalar.\n"), "eigs", 7, "opts.ncv");
+assert_checkerror("eigs(sparse(A), [], 4, which, opts)", refMsg);
+
+opts.ncv = -5.1;
+assert_checkfalse(execstr("eigs(A, [], 4, which ,opts)", "errcatch") == 0);
+refMsg = msprintf(_("%s: Wrong type for input argument #%d: %s must be an integer scalar.\n"), "eigs", 7, "opts.ncv");
+assert_checkerror("eigs(A, [], 4, which, opts)", refMsg);
+
+assert_checkfalse(execstr("eigs(sparse(A), [], 4, which ,opts)", "errcatch") == 0);
+refMsg = msprintf(_("%s: Wrong type for input argument #%d: %s must be an integer scalar.\n"), "eigs", 7, "opts.ncv");
+assert_checkerror("eigs(sparse(A), [], 4, which, opts)", refMsg);
+
+opts.ncv = 5.1;
+assert_checkfalse(execstr("eigs(A, [], 4, which ,opts)", "errcatch") == 0);
+refMsg = msprintf(_("%s: Wrong type for input argument #%d: %s must be an integer scalar.\n"), "eigs", 7, "opts.ncv");
+assert_checkerror("eigs(A, [], 4, which, opts)", refMsg);
+
+assert_checkfalse(execstr("eigs(sparse(A), [], 4, which ,opts)", "errcatch") == 0);
+refMsg = msprintf(_("%s: Wrong type for input argument #%d: %s must be an integer scalar.\n"), "eigs", 7, "opts.ncv");
+assert_checkerror("eigs(sparse(A), [], 4, which, opts)", refMsg);
+
+opts.ncv = n + 6;
+assert_checkfalse(execstr("eigs(A, [], 4, which ,opts)", "errcatch") == 0);
+refMsg = msprintf(_("%s: Wrong value for input argument #%d: For real symmetric problems, NCV must be k < NCV <= N.\n"), "eigs", 7);
+assert_checkerror("eigs(A, [], 4, which, opts)", refMsg);
+
+assert_checkfalse(execstr("eigs(sparse(A), [], 4, which ,opts)", "errcatch") == 0);
+refMsg = msprintf(_("%s: Wrong value for input argument #%d: For real symmetric problems, NCV must be k < NCV <= N.\n"), "eigs", 7);
+assert_checkerror("eigs(sparse(A), [], 4, which, opts)", refMsg);
+
+clear opts
+opts.cholB = %nan;
+assert_checkfalse(execstr("eigs(A, [], 4, which ,opts)", "errcatch") == 0);
+refMsg = msprintf(_("%s: Wrong value for input argument #%d: %s must be %s or %s.\n"), "eigs", 8, "opts.cholB", "%f", "%t");
+assert_checkerror("eigs(A, [], 4, which, opts)", refMsg);
+
+assert_checkfalse(execstr("eigs(sparse(A), [], 4, which ,opts)", "errcatch") == 0);
+refMsg = msprintf(_("%s: Wrong value for input argument #%d: %s must be %s or %s.\n"), "eigs", 8, "opts.cholB", "%f", "%t");
+assert_checkerror("eigs(sparse(A), [], 4, which, opts)", refMsg);
+
+opts.cholB = "ahh";
+assert_checkfalse(execstr("eigs(A, [], 4, which ,opts)", "errcatch") == 0);
+refMsg = msprintf(_("%s: Wrong type for input argument #%d: %s must be an integer scalar or a boolean.\n"), "eigs", 8, "opts.cholB");
+assert_checkerror("eigs(A, [], 4, which, opts)", refMsg);
+
+assert_checkfalse(execstr("eigs(sparse(A), [], 4, which ,opts)", "errcatch") == 0);
+refMsg = msprintf(_("%s: Wrong type for input argument #%d: %s must be an integer scalar or a boolean.\n"), "eigs", 8, "opts.cholB");
+assert_checkerror("eigs(sparse(A), [], 4, which, opts)", refMsg);
+
+opts.cholB = %eps;
+assert_checkfalse(execstr("eigs(A, [], 4, which ,opts)", "errcatch") == 0);
+refMsg = msprintf(_("%s: Wrong value for input argument #%d: %s must be %s or %s.\n"), "eigs", 8, "opts.cholB", "%f", "%t");
+assert_checkerror("eigs(A, [], 4, which, opts)", refMsg);
+
+assert_checkfalse(execstr("eigs(sparse(A), [], 4, which ,opts)", "errcatch") == 0);
+refMsg = msprintf(_("%s: Wrong value for input argument #%d: %s must be %s or %s.\n"), "eigs", 8, "opts.cholB", "%f", "%t");
+assert_checkerror("eigs(sparse(A), [], 4, which, opts)", refMsg);
+
+opts.cholB = -5.1;
+assert_checkfalse(execstr("eigs(A, [], 4, which ,opts)", "errcatch") == 0);
+refMsg = msprintf(_("%s: Wrong value for input argument #%d: %s must be %s or %s.\n"), "eigs", 8, "opts.cholB", "%f", "%t");
+assert_checkerror("eigs(A, [], 4, which, opts)", refMsg);
+
+assert_checkfalse(execstr("eigs(sparse(A), [], 4, which ,opts)", "errcatch") == 0);
+refMsg = msprintf(_("%s: Wrong value for input argument #%d: %s must be %s or %s.\n"), "eigs", 8, "opts.cholB", "%f", "%t");
+assert_checkerror("eigs(sparse(A), [], 4, which, opts)", refMsg);
+
+opts.cholB = 5.1;
+assert_checkfalse(execstr("eigs(A, [], 4, which ,opts)", "errcatch") == 0);
+refMsg = msprintf(_("%s: Wrong value for input argument #%d: %s must be %s or %s.\n"), "eigs", 8, "opts.cholB", "%f", "%t");
+assert_checkerror("eigs(A, [], 4, which, opts)", refMsg);
+
+assert_checkfalse(execstr("eigs(sparse(A), [], 4, which ,opts)", "errcatch") == 0);
+refMsg = msprintf(_("%s: Wrong value for input argument #%d: %s must be %s or %s.\n"), "eigs", 8, "opts.cholB", "%f", "%t");
+assert_checkerror("eigs(sparse(A), [], 4, which, opts)", refMsg);
+
+
+
+opts.cholB = [];
+assert_checkfalse(execstr("eigs(A, [], 4, which ,opts)", "errcatch") == 0);
+refMsg = msprintf(_("%s: Wrong type for input argument #%d: %s must be an integer scalar or a boolean.\n"), "eigs", 8, "opts.cholB");
+assert_checkerror("eigs(A, [], 4, which, opts)", refMsg);
+
+assert_checkfalse(execstr("eigs(sparse(A), [], 4, which ,opts)", "errcatch") == 0);
+refMsg = msprintf(_("%s: Wrong type for input argument #%d: %s must be an integer scalar or a boolean.\n"), "eigs", 8, "opts.cholB");
+assert_checkerror("eigs(sparse(A), [], 4, which, opts)", refMsg);
+
+clear opts
+opts.resid = %nan;
+assert_checkfalse(execstr("eigs(A, [], 4, which ,opts)", "errcatch") == 0);
+refMsg = msprintf(_("%s: Wrong dimension for input argument #%d: Start vector %s must be N by 1.\n"), "eigs", 9, "opts.resid");
+assert_checkerror("eigs(A, [], 4, which, opts)", refMsg);
+
+assert_checkfalse(execstr("eigs(sparse(A), [], 4, which ,opts)", "errcatch") == 0);
+refMsg = msprintf(_("%s: Wrong dimension for input argument #%d: Start vector %s must be N by 1.\n"), "eigs", 9, "opts.resid");
+assert_checkerror("eigs(sparse(A), [], 4, which, opts)", refMsg);
+
+opts.resid = %f;
+assert_checkfalse(execstr("eigs(A, [], 4, which ,opts)", "errcatch") == 0);
+refMsg = msprintf(_("%s: Wrong type for input argument #%d: A real or complex matrix expected.\n"), "eigs", 9);
+assert_checkerror("eigs(A, [], 4, which, opts)", refMsg);
+
+assert_checkfalse(execstr("eigs(sparse(A), [], 4, which ,opts)", "errcatch") == 0);
+refMsg = msprintf(_("%s: Wrong type for input argument #%d: A real or complex matrix expected.\n"), "eigs", 9);
+assert_checkerror("eigs(sparse(A), [], 4, which, opts)", refMsg);
+
+opts.resid = "ahh";
+assert_checkfalse(execstr("eigs(A, [], 4, which ,opts)", "errcatch") == 0);
+refMsg = msprintf(_("%s: Wrong type for input argument #%d: A real or complex matrix expected.\n"), "eigs", 9);
+assert_checkerror("eigs(A, [], 4, which, opts)", refMsg);
+
+assert_checkfalse(execstr("eigs(sparse(A), [], 4, which ,opts)", "errcatch") == 0);
+refMsg = msprintf(_("%s: Wrong type for input argument #%d: A real or complex matrix expected.\n"), "eigs", 9);
+assert_checkerror("eigs(sparse(A), [], 4, which, opts)", refMsg);
+
+opts.resid = %eps;
+assert_checkfalse(execstr("eigs(A, [], 4, which ,opts)", "errcatch") == 0);
+refMsg = msprintf(_("%s: Wrong dimension for input argument #%d: Start vector %s must be N by 1.\n"), "eigs", 9, "opts.resid");
+assert_checkerror("eigs(A, [], 4, which, opts)", refMsg);
+
+assert_checkfalse(execstr("eigs(sparse(A), [], 4, which ,opts)", "errcatch") == 0);
+refMsg = msprintf(_("%s: Wrong dimension for input argument #%d: Start vector %s must be N by 1.\n"), "eigs", 9, "opts.resid");
+assert_checkerror("eigs(sparse(A), [], 4, which, opts)", refMsg);
+
+opts.resid = [1 2];
+assert_checkfalse(execstr("eigs(A, [], 4, which ,opts)", "errcatch") == 0);
+refMsg = msprintf(_("%s: Wrong dimension for input argument #%d: Start vector %s must be N by 1.\n"), "eigs", 9, "opts.resid");
+assert_checkerror("eigs(A, [], 4, which, opts)", refMsg);
+
+assert_checkfalse(execstr("eigs(sparse(A), [], 4, which ,opts)", "errcatch") == 0);
+refMsg = msprintf(_("%s: Wrong dimension for input argument #%d: Start vector %s must be N by 1.\n"), "eigs", 9, "opts.resid");
+assert_checkerror("eigs(sparse(A), [], 4, which, opts)", refMsg);
+
+opts.resid = [1;2];
+assert_checkfalse(execstr("eigs(A, [], 4, which ,opts)", "errcatch") == 0);
+refMsg = msprintf(_("%s: Wrong dimension for input argument #%d: Start vector %s must be N by 1.\n"), "eigs", 9, "opts.resid");
+assert_checkerror("eigs(A, [], 4, which, opts)", refMsg);
+
+assert_checkfalse(execstr("eigs(sparse(A), [], 4, which ,opts)", "errcatch") == 0);
+refMsg = msprintf(_("%s: Wrong dimension for input argument #%d: Start vector %s must be N by 1.\n"), "eigs", 9, "opts.resid");
+assert_checkerror("eigs(sparse(A), [], 4, which, opts)", refMsg);
+
+opts.resid = [];
+assert_checkfalse(execstr("eigs(A, [], 4, which ,opts)", "errcatch") == 0);
+refMsg = msprintf(_("%s: Wrong dimension for input argument #%d: Start vector %s must be N by 1.\n"), "eigs", 9, "opts.resid");
+assert_checkerror("eigs(A, [], 4, which, opts)", refMsg);
+
+assert_checkfalse(execstr("eigs(sparse(A), [], 4, which ,opts)", "errcatch") == 0);
+refMsg = msprintf(_("%s: Wrong dimension for input argument #%d: Start vector %s must be N by 1.\n"), "eigs", 9, "opts.resid");
+assert_checkerror("eigs(sparse(A), [], 4, which, opts)", refMsg);
+
+clear opts
+opts.issym = %f;
+assert_checkfalse(execstr("eigs(A, [], 4, which ,opts)", "errcatch") == 0);
+refMsg = msprintf(_("%s: Wrong type for input argument: If A is a matrix, use opts with tol, maxiter, ncv, resid, cholB"), "eigs");
+assert_checkerror("eigs(A, [], 4, which, opts)", refMsg);
+
+clear opts
+opts.isreal = %f;
+assert_checkfalse(execstr("eigs(A, [], 4, which ,opts)", "errcatch") == 0);
+refMsg = msprintf(_("%s: Wrong type for input argument: If A is a matrix, use opts with tol, maxiter, ncv, resid, cholB"), "eigs");
+assert_checkerror("eigs(A, [], 4, which, opts)", refMsg);
+
+clear opts
+n = 20;
+k = 5;
+A = diag(10*ones(n,1));
+A(1:$-1,2:$) = A(1:$-1,2:$) + diag(6*ones(n-1,1));
+A(2:$,1:$-1) = A(2:$,1:$-1) + diag(6*ones(n-1,1));
+A = sparse(A);
+
+d1 = eigs(A, [], k);
+d0 = spec(full(A));
+assert_checkalmostequal(d1, d0(($-k+1):$), 1.e-10);
+
+d1 = eigs(A, [], k, "LM");
+assert_checkalmostequal(d1, d0(($-k+1):$), 1.e-10);
+
+d1 = eigs(A, [], k, "SM");
+assert_checkalmostequal(d1, d0(1:k), 1.e-10);
+
+d1 = eigs(A, [], k, "LA");
+assert_checkalmostequal(d1, d0(($-k+1):$), 1.e-10);
+
+d1 = eigs(A, [], k, "SA");
+assert_checkalmostequal(d1, d0(k:-1:1), 1.e-10);
+
+d1 = eigs(A, [], k, "BE");
+assert_checkalmostequal(d1, [d0(1:2); d0($-2:$)], 1.e-10);
+
+d1 = eigs(A, [], k, 2);
+assert_checkalmostequal(d1, d0(3:3+k-1), 1.e-10);
+
+d1 = eigs(A, speye(n,n), k, "LM");
+assert_checkalmostequal(d1, d0(($-k+1):$), 1.e-10);
+
+d1 = eigs(A, speye(n,n), k, 2);
+assert_checkalmostequal(d1, d0(3:3+k-1), 1.e-10);
+
+opts.cholB = %t;
+d1 = eigs(A, speye(n,n), k, "LM", opts);
+assert_checkalmostequal(d1, d0(($-k+1):$), 1.e-10);
+
+opts.cholB = %t;
+d1 = eigs(A, speye(n,n), k, 2, opts);
+assert_checkalmostequal(eigs(A, [],k, 2), d0(3:3+k-1), 1.e-10);
+
+[d1, v1] = eigs(A, [], k, "LM");
+assert_checkalmostequal(A*v1, v1*d1,sqrt(%eps), 1.e-10);
+
+[d1, v1] = eigs(A, [], k, "SM");
+assert_checkalmostequal(A*v1, v1*d1,sqrt(%eps), 1.e-10);
+
+[d1, v1] = eigs(A, [], k, "LA");
+assert_checkalmostequal(A*v1, v1*d1,sqrt(%eps), 1.e-10);
+
+[d1, v1] = eigs(A, [], k, "SA");
+assert_checkalmostequal(A*v1, v1*d1,sqrt(%eps), 1.e-10);
+
+[d1, v1] = eigs(A, [], k, "BE");
+assert_checkalmostequal(A*v1, v1*d1,sqrt(%eps), 1.e-10);
+
+
+n = 20;
+k = 5;
+A = diag((1:n));
+A(1:$-1,2:$) = A(1:$-1,2:$) + diag(6*ones(n-1,1));
+A(2:$,1:$-1) = A(2:$,1:$-1) + diag(-6*ones(n-1,1));
+A = sparse(A);
+
+d1 = eigs(A, [], k);
+d0 = gsort(spec(full(A)));
+
+assert_checkalmostequal(abs(d1), abs(d0(k+2-1:-1:2)), 1.e-10);
+
+d1 = eigs(A, [], k, "LM");
+assert_checkalmostequal(abs(d1), abs(d0(k+2-1:-1:2)), 1.e-10);
+
+d1 = eigs(A, [], k, "SM");
+assert_checkalmostequal(abs(d1), abs(d0($-k:$-1)), 1.e-10);
+
+d1 = eigs(A, [], k, "LR");
+assert_checkalmostequal(real(d1), real(d0(k+2-1:-1:2)), 1.e-10);
+
+d1 = eigs(A, [], k, "SR");
+assert_checkalmostequal(real(d1), gsort(real(d0([13 14 18 19 20]))), 1.e-10);
+
+d1 = eigs(A, [], k, "LI");
+assert_checkalmostequal(abs(imag(d1)), abs(imag(d0([3 4 2 1 18]))), 1.e-10);
+
+d1 = eigs(A, [], k, "SI");
+assert_checkalmostequal(abs(imag(d1)), abs(imag(d0([9 10 11 12 15]))), 1.e-10);
+
+d1 = eigs(A, [], k, 2);
+assert_checkalmostequal(abs(d1), abs(d0([19 20 12 11 15])), 1.e-10);
+
+d1 = eigs(A, speye(n,n), k, "LM");
+assert_checkalmostequal(abs(d1), abs(d0(k+2-1:-1:2)), 1.e-10);
+
+d1 = eigs(A, speye(n,n), k, 2);
+assert_checkalmostequal(abs(d1), abs(d0([19 20 12 11 15])), 1.e-10);
+
+opts.cholB = %t;
+d1 = eigs(A, speye(n,n), k, "LM", opts);
+assert_checkalmostequal(abs(d1), abs(d0(k+2-1:-1:2)), 1.e-10);
+
+opts.cholB = %t;
+d1 = eigs(A, speye(n,n), k, 2, opts);
+assert_checkalmostequal(abs(d1), abs(d0([19 20 12 11 15])), 1.e-10);
+
+[d1, v1] = eigs(A, [], k, "LM");
+assert_checkalmostequal(A*v1, v1*d1,sqrt(%eps), 1.e-10);
+
+[d1, v1] = eigs(A, [], k, "SM");
+assert_checkalmostequal(A*v1, v1*d1,sqrt(%eps), 1.e-10);
+
+[d1, v1] = eigs(A, [], k, "LR");
+assert_checkalmostequal(A*v1, v1*d1,sqrt(%eps), 1.e-10);
+
+[d1, v1] = eigs(A, [], k, "SR");
+assert_checkalmostequal(A*v1, v1*d1,sqrt(%eps), 1.e-10);
+
+[d1, v1] = eigs(A, [], k, "LI");
+assert_checkalmostequal(A*v1, v1*d1,sqrt(%eps), 1.e-10);
+
+[d1, v1] = eigs(A, [], k, "SI");
+assert_checkalmostequal(A*v1, v1*d1,sqrt(%eps), 1.e-10);
+
+n = 20;
+k = 5;
+A = diag((1:n) + %i * ones(1,n));
+A(1:$-1,2:$) = A(1:$-1,2:$) + diag(6*ones(n-1,1));
+A(2:$,1:$-1) = A(2:$,1:$-1) + diag(-6*ones(n-1,1));
+A = sparse(A);
+
+d1 = eigs(A, [], k);
+d0 = gsort(spec(full(A)));
+r = gsort(real(d0));
+im = gsort(imag(d0));
+assert_checkalmostequal(abs(d1), abs(d0(k:-1:1)), 1.e-10);
+
+d1 = eigs(A, [], k, "LM");
+assert_checkalmostequal(abs(d1), abs(d0(k:-1:1)), 1.e-10);
+
+//d1 = eigs(A, [], k, 'SM');
+//assert_checkalmostequal(abs(d1), abs(d0(1:k)), 1.e-14); // error -> impossible to invert complex sparse matrix
+
+d1 = eigs(A, [], k, "LR");
+assert_checkalmostequal(real(d1), real(d0(k:-1:1)), 1.e-10);
+
+d1 = eigs(A, [], k, "SR");
+assert_checkalmostequal(real(d1), r($-k+1:$), 1.e-10);
+
+d1 = eigs(A, [], k, "LI");
+assert_checkalmostequal(imag(d1), im(k:-1:1), 1.e-10);
+
+d1 = eigs(A, [], k, "SI");
+assert_checkalmostequal(imag(d1), im($-k+1:$), 1.e-10);
+
+d1 = eigs(A, speye(n,n), k, "LM");
+assert_checkalmostequal(abs(d1), abs(d0(k:-1:1)), 1.e-10);
+
+opts.cholB = %t;
+d1 = eigs(A, speye(n,n), k, "LM", opts);
+assert_checkalmostequal(abs(d1), abs(d0(k:-1:1)), 1.e-10);
+
+[d1, v1] = eigs(A, [], k, "LM");
+assert_checkalmostequal(A*v1, v1*d1,sqrt(%eps), 1.e-10);
+
+[d1, v1] = eigs(A, [], k, "LR");
+assert_checkalmostequal(A*v1, v1*d1,sqrt(%eps), 1.e-10);
+
+[d1, v1] = eigs(A, [], k, "SR");
+assert_checkalmostequal(A*v1, v1*d1,sqrt(%eps), 1.e-10);
+
+[d1, v1] = eigs(A, [], k, "LI");
+assert_checkalmostequal(A*v1, v1*d1,sqrt(%eps), 1.e-10);
+
+[d1, v1] = eigs(A, [], k, "SI");
+assert_checkalmostequal(A*v1, v1*d1,sqrt(%eps), 1.e-10);
+
+
+n = 20;
+k = 5;
+A = diag(10*ones(n,1));
+A(1:$-1,2:$) = A(1:$-1,2:$) + diag(6*ones(n-1,1));
+A(2:$,1:$-1) = A(2:$,1:$-1) + diag(6*ones(n-1,1));
+
+d1 = eigs(A, [], k);
+d0 = spec(A);
+
+assert_checkalmostequal(d1, d0(($-k+1):$), 1.e-10);
+
+d1 = eigs(A, [], k, "LM");
+assert_checkalmostequal(d1, d0(($-k+1):$), 1.e-10);
+
+d1 = eigs(A, [], k, "SM");
+assert_checkalmostequal(d1, d0(1:k), 1.e-10);
+
+d1 = eigs(A, [], k, "LA");
+assert_checkalmostequal(d1, d0(($-k+1):$), 1.e-10);
+
+d1 = eigs(A, [], k, "SA");
+assert_checkalmostequal(d1, d0(k:-1:1), 1.e-10);
+
+d1 = eigs(A, [], k, "BE");
+assert_checkalmostequal(d1, [d0(1:2); d0($-2:$)], 1.e-10);
+
+d1 = eigs(A, [], k, 2);
+assert_checkalmostequal(d1, d0(3:3+k-1), 1.e-10);
+
+d1 = eigs(A, eye(n,n), k, "LM");
+assert_checkalmostequal(d1, d0(($-k+1):$), 1.e-10);
+
+d1 = eigs(A, eye(n,n), k, 2);
+assert_checkalmostequal(d1, d0(3:3+k-1), 1.e-10);
+
+opts.cholB = %t;
+d1 = eigs(A, eye(n,n), k, "LM", opts);
+assert_checkalmostequal(d1, d0(($-k+1):$), 1.e-10);
+
+opts.cholB = %t;
+d1 = eigs(A, eye(n,n), k, 2, opts);
+assert_checkalmostequal(eigs(A, [],k, 2), d0(3:3+k-1), 1.e-10);
+
+[d1, v1] = eigs(A, [], k, "LM");
+assert_checkalmostequal(A*v1, v1*d1,sqrt(%eps), 1.e-10);
+
+[d1, v1] = eigs(A, [], k, "SM");
+assert_checkalmostequal(A*v1, v1*d1,sqrt(%eps), 1.e-10);
+
+[d1, v1] = eigs(A, [], k, "LA");
+assert_checkalmostequal(A*v1, v1*d1,sqrt(%eps), 1.e-10);
+
+[d1, v1] = eigs(A, [], k, "SA");
+assert_checkalmostequal(A*v1, v1*d1,sqrt(%eps), 1.e-10);
+
+[d1, v1] = eigs(A, [], k, "BE");
+assert_checkalmostequal(A*v1, v1*d1,sqrt(%eps), 1.e-10);
+
+n = 20;
+k = 5;
+A = diag((1:n));
+A(1:$-1,2:$) = A(1:$-1,2:$) + diag(6*ones(n-1,1));
+A(2:$,1:$-1) = A(2:$,1:$-1) + diag(-6*ones(n-1,1));
+
+d1 = eigs(A, [], k);
+d0 = gsort(spec(A));
+
+assert_checkalmostequal(abs(d1), abs(d0(k+2-1:-1:2)), 1.e-10);
+
+d1 = eigs(A, [], k, "LM");
+assert_checkalmostequal(abs(d1), abs(d0(k+2-1:-1:2)), 1.e-10);
+
+d1 = eigs(A, [], k, "SM");
+assert_checkalmostequal(abs(d1), abs(d0($-k:$-1)), 1.e-10);
+
+d1 = eigs(A, [], k, "LR");
+assert_checkalmostequal(real(d1), real(d0(k+2-1:-1:2)), 1.e-10);
+
+d1 = eigs(A, [], k, "SR");
+assert_checkalmostequal(real(d1), gsort(real(d0([13 14 18 19 20]))), 1.e-10);
+
+d1 = eigs(A, [], k, "LI");
+assert_checkalmostequal(abs(imag(d1)), abs(imag(d0([3 4 2 1 18]))), 1.e-10);
+
+d1 = eigs(A, [], k, "SI");
+assert_checkalmostequal(abs(imag(d1)), abs(imag(d0([9 10 11 12 15]))), 1.e-10);
+
+d1 = eigs(A, [], k, 2);
+assert_checkalmostequal(abs(d1), abs(d0([19 20 12 11 15])), 1.e-10);
+
+d1 = eigs(A, eye(n,n), k, "LM");
+assert_checkalmostequal(abs(d1), abs(d0(k+2-1:-1:2)), 1.e-10);
+
+d1 = eigs(A, eye(n,n), k, 2);
+assert_checkalmostequal(abs(d1), abs(d0([19 20 12 11 15])), 1.e-10);
+
+opts.cholB = %t;
+d1 = eigs(A, eye(n,n), k, "LM", opts);
+assert_checkalmostequal(abs(d1), abs(d0(k+2-1:-1:2)), 1.e-10);
+
+opts.cholB = %t;
+d1 = eigs(A, eye(n,n), k, 2, opts);
+assert_checkalmostequal(abs(d1), abs(d0([19 20 12 11 15])), 1.e-10);
+
+[d1, v1] = eigs(A, [], k, "LM");
+assert_checkalmostequal(A*v1, v1*d1,sqrt(%eps), 1.e-10);
+
+[d1, v1] = eigs(A, [], k, "SM");
+assert_checkalmostequal(A*v1, v1*d1,sqrt(%eps), 1.e-10);
+
+[d1, v1] = eigs(A, [], k, "LR");
+assert_checkalmostequal(A*v1, v1*d1,sqrt(%eps), 1.e-10);
+
+[d1, v1] = eigs(A, [], k, "SR");
+assert_checkalmostequal(A*v1, v1*d1,sqrt(%eps), 1.e-10);
+
+[d1, v1] = eigs(A, [], k, "LI");
+assert_checkalmostequal(A*v1, v1*d1,sqrt(%eps), 1.e-10);
+
+[d1, v1] = eigs(A, [], k, "SI");
+assert_checkalmostequal(A*v1, v1*d1,sqrt(%eps), 1.e-10);
+
+
+n = 20;
+k = 5;
+A = diag((1:n) + %i * ones(1,n));
+A(1:$-1,2:$) = A(1:$-1,2:$) + diag(6*ones(n-1,1));
+A(2:$,1:$-1) = A(2:$,1:$-1) + diag(-6*ones(n-1,1));
+
+d1 = eigs(A, [], k);
+d0 = gsort(spec(A));
+r = gsort(real(d0));
+im = gsort(imag(d0));
+
+assert_checkalmostequal(abs(d1), abs(d0(k:-1:1)), 1.e-10);
+
+d1 = eigs(A, [], k, "LM");
+assert_checkalmostequal(abs(d1), abs(d0(k:-1:1)), 1.e-10);
+
+d1 = eigs(A, [], k, "SM");
+assert_checkalmostequal(abs(d1), abs(d0($-k+1:$)), 1.e-10);
+
+d1 = eigs(A, [], k, "LR");
+assert_checkalmostequal(real(d1), r(k:-1:1), 1.e-10);
+
+d1 = eigs(A, [], k, "SR");
+assert_checkalmostequal(real(d1), r($-k+1:$), 1.e-10);
+
+d1 = eigs(A, [], k, "LI");
+assert_checkalmostequal(imag(d1), im(k:-1:1), 1.e-10);
+
+d1 = eigs(A, [], k, "SI");
+assert_checkalmostequal(imag(d1), im($-k+1:$), 1.e-10);
+
+d1 = eigs(A, [], k, 2);
+assert_checkalmostequal(gsort(abs(d1)), gsort(abs(d0($-1:-1:$-k))), 1.e-10);
+
+d1 = eigs(A, eye(n,n), k, "LM");
+assert_checkalmostequal(abs(d1), abs(d0(k:-1:1)), 1.e-10);
+
+opts.cholB = %t;
+d1 = eigs(A, eye(n,n), k, "LM", opts);
+assert_checkalmostequal(abs(d1), abs(d0(k:-1:1)), 1.e-10);
+
+opts.cholB = %t;
+d1 = eigs(A, eye(n,n), k, 2, opts);
+assert_checkalmostequal(abs(eigs(A, [], k, 2)), abs(d1), 1.e-10);
+
+[d1, v1] = eigs(A, [], k, "LM");
+assert_checkalmostequal(A*v1, v1*d1, sqrt(%eps), 1.e-10);
+
+[d1, v1] = eigs(A, [], k, "LR");
+assert_checkalmostequal(A*v1, v1*d1, sqrt(%eps), 1.e-10);
+
+[d1, v1] = eigs(A, [], k, "SR");
+assert_checkalmostequal(A*v1, v1*d1, sqrt(%eps), 1.e-10);
+
+[d1, v1] = eigs(A, [], k, "LI");
+assert_checkalmostequal(A*v1, v1*d1, sqrt(%eps), 1.e-10);
+
+[d1, v1] = eigs(A, [], k, "SI");
+assert_checkalmostequal(A*v1, v1*d1, sqrt(%eps), 1.e-10);
+
+clear opts
+// Tests : A is a function
+// Sparse matrix tests
+n = 20;
+k = 5;
+A = diag(10*ones(n,1));
+A(1:$-1,2:$) = A(1:$-1,2:$) + diag(6*ones(n-1,1));
+A(2:$,1:$-1) = A(2:$,1:$-1) + diag(6*ones(n-1,1));
+A = sparse(A);
+
+function y = fn(x)
+ y = A * x;
+endfunction
+
+opts.isreal = %t;
+opts.issym = %t;
+
+d1 = eigs(fn, n, [], k, "LM", opts );
+d0 = spec(full(A));
+assert_checkalmostequal(d1, d0(($-k+1):$), 1.e-10);
+
+clear fn
+function y = fn(x)
+ y = A \x;
+endfunction
+
+opts.isreal = %t;
+opts.issym = %t;
+
+d1 = eigs(fn, n, [], k, "SM", opts );
+assert_checkalmostequal(d1, d0(1:k), 1.e-10);
+
+clear fn
+function y = fn(x)
+ y = (A - 2 * speye(n,n)) \x;
+endfunction
+
+opts.isreal = %t;
+opts.issym = %t;
+
+d1 = eigs(fn, n, [], k, 2, opts);
+assert_checkalmostequal(d1, d0(3:3+k-1), 1.e-10);
+
+n = 20;
+k = 5;
+A = diag((1:n));
+A(1:$-1,2:$) = A(1:$-1,2:$) + diag(6*ones(n-1,1));
+A(2:$,1:$-1) = A(2:$,1:$-1) + diag(-6*ones(n-1,1));
+A = sparse(A);
+
+clear fn
+function y = fn(x)
+ y = A * x;
+endfunction
+
+opts.isreal = %t;
+opts.issym = %f;
+
+d1 = eigs(fn, n, [], k, "LM", opts );
+d0 = gsort(spec(full(A)));
+assert_checkalmostequal(abs(d1), abs(d0(k+2-1:-1:2)), 1.e-10);
+
+clear fn
+function y = fn(x)
+ y = A \x;
+endfunction
+
+opts.isreal = %t;
+opts.issym = %f;
+
+d1 = eigs(fn, n, [], k, "SM", opts );
+assert_checkalmostequal(abs(d1), abs(d0($-k:$-1)), 1.e-10);
+
+clear fn
+function y = fn(x)
+ y = (A - 2 * speye(n,n)) \x;
+endfunction
+
+opts.isreal = %t;
+opts.issym = %f;
+
+d1 = eigs(fn, n, [], k, 2, opts );
+assert_checkalmostequal(abs(d1), abs(d0([19 20 12 11 15])), 1.e-10);
+
+
+n = 20;
+k = 5;
+A = diag((1:n) + %i * ones(1,n));
+A(1:$-1,2:$) = A(1:$-1,2:$) + diag(6*ones(n-1,1));
+A(2:$,1:$-1) = A(2:$,1:$-1) + diag(-6*ones(n-1,1));
+A = sparse(A);
+
+clear fn
+function y = fn(x)
+ y = A * x;
+endfunction
+
+opts.isreal = %f;
+opts.issym = %f;
+
+d1 = eigs(fn, n, [], k, "LM", opts );
+d0 = gsort(spec(full(A)));
+r = gsort(real(d0));
+im = gsort(imag(d0));
+assert_checkalmostequal(abs(d1), abs(d0(k:-1:1)), 1.e-10);
+
+clear fn
+function y = fn(x)
+ y = A \x;
+endfunction
+
+opts.isreal = %f;
+opts.issym = %f;
+
+d1 = eigs(fn, n, [], k, "SM", opts );
+assert_checkalmostequal(abs(d1), abs(d0($-k+1:$)), 1.e-10);
+
+clear fn
+function y = fn(x)
+ y = (A - 2 * speye(n,n)) \x;
+endfunction
+
+opts.isreal = %f;
+opts.issym = %f;
+
+d1 = eigs(fn, n, [], k, 2, opts );
+assert_checkalmostequal(gsort(abs(d1)), gsort(abs(d0($-1:-1:$-k))), 1.e-10);
+
+
+
+clear opts
+// Full matrix tests
+n = 20;
+k = 5;
+A = diag(10*ones(n,1));
+A(1:$-1,2:$) = A(1:$-1,2:$) + diag(6*ones(n-1,1));
+A(2:$,1:$-1) = A(2:$,1:$-1) + diag(6*ones(n-1,1));
+
+clear fn
+function y = fn(x)
+ y = A * x;
+endfunction
+
+opts.isreal = %t;
+opts.issym = %t;
+
+d1 = eigs(fn, n, [], k, "LM", opts );
+d0 = spec(A);
+assert_checkalmostequal(d1, d0(($-k+1):$), 1.e-10);
+
+clear fn
+function y = fn(x)
+ y = A \x;
+endfunction
+
+opts.isreal = %t;
+opts.issym = %t;
+
+d1 = eigs(fn, n, [], k, "SM", opts );
+assert_checkalmostequal(d1, d0(1:k), 1.e-10);
+
+clear fn
+function y = fn(x)
+ y = (A - 2 * speye(n,n)) \x;
+endfunction
+
+opts.isreal = %t;
+opts.issym = %t;
+
+d1 = eigs(fn, n, [], k, 2, opts);
+assert_checkalmostequal(d1, d0(3:3+k-1), 1.e-10);
+
+n = 20;
+k = 5;
+A = diag((1:n));
+A(1:$-1,2:$) = A(1:$-1,2:$) + diag(6*ones(n-1,1));
+A(2:$,1:$-1) = A(2:$,1:$-1) + diag(-6*ones(n-1,1));
+
+clear fn
+function y = fn(x)
+ y = A * x;
+endfunction
+
+opts.isreal = %t;
+opts.issym = %f;
+
+d1 = eigs(fn, n, [], k, "LM", opts );
+d0 = gsort(spec(A));
+assert_checkalmostequal(abs(d1), abs(d0(k+2-1:-1:2)), 1.e-10);
+
+clear fn
+function y = fn(x)
+ y = A \x;
+endfunction
+
+opts.isreal = %t;
+opts.issym = %f;
+
+d1 = eigs(fn, n, [], k, "SM", opts );
+assert_checkalmostequal(abs(d1), abs(d0($-k:$-1)), 1.e-10);
+
+clear fn
+function y = fn(x)
+ y = (A - 2 * speye(n,n)) \x;
+endfunction
+
+opts.isreal = %t;
+opts.issym = %f;
+
+d1 = eigs(fn, n, [], k, 2, opts );
+assert_checkalmostequal(abs(d1), abs(d0([19 20 12 11 15])), 1.e-10);
+
+
+n = 20;
+k = 5;
+A = diag((1:n) + %i * ones(1,n));
+A(1:$-1,2:$) = A(1:$-1,2:$) + diag(6*ones(n-1,1));
+A(2:$,1:$-1) = A(2:$,1:$-1) + diag(-6*ones(n-1,1));
+
+clear fn
+function y = fn(x)
+ y = A * x;
+endfunction
+
+opts.isreal = %f;
+opts.issym = %f;
+
+d1 = eigs(fn, n, [], k, "LM", opts );
+d0 = gsort(spec(A));
+r = gsort(real(d0));
+im = gsort(imag(d0));
+assert_checkalmostequal(abs(d1), abs(d0(k:-1:1)), 1.e-10);
+
+clear fn
+function y = fn(x)
+ y = A \x;
+endfunction
+
+opts.isreal = %f;
+opts.issym = %f;
+
+d1 = eigs(fn, n, [], k, "SM", opts );
+assert_checkalmostequal(abs(d1), abs(d0($-k+1:$)), 1.e-10);
+
+clear fn
+function y = fn(x)
+ y = (A - 2 * speye(n,n)) \x;
+endfunction
+
+opts.isreal = %f;
+opts.issym = %f;
+
+d1 = eigs(fn, n, [], k, 2, opts );
+assert_checkalmostequal(gsort(abs(d1)), gsort(abs(d0($-1:-1:$-k))), 1.e-10);
diff --git a/modules/arnoldi/tests/unit_tests/znaupd-win.dia.ref b/modules/arnoldi/tests/unit_tests/znaupd-win.dia.ref
new file mode 100755
index 000000000..d75f28712
--- /dev/null
+++ b/modules/arnoldi/tests/unit_tests/znaupd-win.dia.ref
@@ -0,0 +1,59 @@
+// =============================================================================
+// Scilab ( http://www.scilab.org/ ) - This file is part of Scilab
+// Copyright (C) 2012 - SE - Sylvestre Ledru
+//
+// This file is distributed under the same license as the Scilab package.
+// =============================================================================
+// <-- WINDOWS ONLY -->
+nx = 10;
+nev = 3;
+ncv = 6;
+bmat = 'I';
+which = 'LM';
+// Local Arrays
+iparam = zeros(11, 1);
+ipntr = zeros(14, 1);
+_select = zeros(ncv, 1);
+d = zeros(nev + 1, 1) + 0 * %i;
+z = zeros(nx, nev) + 0* %i;
+resid = zeros(nx, 1) + 0 * %i;
+v = zeros(nx, ncv) + 0 * %i;
+workd = zeros(3 * nx, 1) + 0 * %i;
+workev = zeros(2 * ncv, 1) + 0 * %i;
+rwork = zeros(ncv, 1);
+workl = zeros(3 * ncv * ncv + 5 *ncv, 1) + 0 * %i;
+// Build the complex test matrix
+A = diag(10 * ones(nx,1) + %i * ones(nx,1));
+A(1:$-1,2:$) = A(1:$-1,2:$) + diag(6 * ones(nx - 1,1));
+A(2:$,1:$-1) = A(2:$,1:$-1) + diag(-6 * ones(nx - 1,1));
+tol = 0;
+ido = 0;
+ishfts = 1;
+maxitr = 300;
+mode1 = 1;
+iparam(1) = ishfts;
+iparam(3) = maxitr;
+iparam(7) = mode1;
+sigma = complex(0);
+info_znaupd = 0;
+// M A I N L O O P (Reverse communication)
+while(ido <> 99)
+ // Repeatedly call the routine ZNAUPD and take actions indicated by parameter IDO until
+ // either convergence is indicated or maxitr has been exceeded.
+ [ido, resid, v, iparam, ipntr, workd, workl, rwork, info_znaupd] = znaupd(ido, bmat, nx, which, nev, tol, resid, ncv, v, iparam, ipntr, workd, workl, rwork, info_znaupd);
+ if(info_znaupd < 0)
+ printf('\nError with znaupd, info = %d\n', info_znaupd);
+ printf('Check the documentation of znaupd\n\n');
+ end
+ if(ido == -1 | ido == 1)
+ // Perform matrix vector multiplication
+ workd(ipntr(2):ipntr(2) + nx - 1) = A * workd(ipntr(1):ipntr(1) + nx - 1);
+ end
+end
+// Post-Process using ZNEUPD.
+rvec = 1;
+howmany = 'A';
+info_zneupd = 0;
+[d, z, resid, iparam, ipntr, workd, workl, rwork, info_zneupd] = zneupd(rvec, howmany, _select, d, z, sigma, workev, bmat, nx, which, nev, tol, resid, ncv, v, ...
+ iparam, ipntr, workd, workl, rwork, info_zneupd);
+assert_checkalmostequal(A * z, z * diag(d(1:3)), sqrt(%eps), 1.e-10);
diff --git a/modules/arnoldi/tests/unit_tests/znaupd-win.tst b/modules/arnoldi/tests/unit_tests/znaupd-win.tst
new file mode 100755
index 000000000..80faf85af
--- /dev/null
+++ b/modules/arnoldi/tests/unit_tests/znaupd-win.tst
@@ -0,0 +1,74 @@
+// =============================================================================
+// Scilab ( http://www.scilab.org/ ) - This file is part of Scilab
+// Copyright (C) 2012 - SE - Sylvestre Ledru
+//
+// This file is distributed under the same license as the Scilab package.
+// =============================================================================
+// <-- WINDOWS ONLY -->
+nx = 10;
+
+nev = 3;
+ncv = 6;
+bmat = 'I';
+which = 'LM';
+
+// Local Arrays
+
+iparam = zeros(11, 1);
+ipntr = zeros(14, 1);
+_select = zeros(ncv, 1);
+d = zeros(nev + 1, 1) + 0 * %i;
+z = zeros(nx, nev) + 0* %i;
+resid = zeros(nx, 1) + 0 * %i;
+v = zeros(nx, ncv) + 0 * %i;
+workd = zeros(3 * nx, 1) + 0 * %i;
+workev = zeros(2 * ncv, 1) + 0 * %i;
+rwork = zeros(ncv, 1);
+workl = zeros(3 * ncv * ncv + 5 *ncv, 1) + 0 * %i;
+
+// Build the complex test matrix
+A = diag(10 * ones(nx,1) + %i * ones(nx,1));
+A(1:$-1,2:$) = A(1:$-1,2:$) + diag(6 * ones(nx - 1,1));
+A(2:$,1:$-1) = A(2:$,1:$-1) + diag(-6 * ones(nx - 1,1));
+
+tol = 0;
+ido = 0;
+
+ishfts = 1;
+maxitr = 300;
+mode1 = 1;
+
+iparam(1) = ishfts;
+iparam(3) = maxitr;
+iparam(7) = mode1;
+
+sigma = complex(0);
+info_znaupd = 0;
+// M A I N L O O P (Reverse communication)
+while(ido <> 99)
+ // Repeatedly call the routine ZNAUPD and take actions indicated by parameter IDO until
+ // either convergence is indicated or maxitr has been exceeded.
+
+ [ido, resid, v, iparam, ipntr, workd, workl, rwork, info_znaupd] = znaupd(ido, bmat, nx, which, nev, tol, resid, ncv, v, iparam, ipntr, workd, workl, rwork, info_znaupd);
+
+ if(info_znaupd < 0)
+ printf('\nError with znaupd, info = %d\n', info_znaupd);
+ printf('Check the documentation of znaupd\n\n');
+ end
+
+ if(ido == -1 | ido == 1)
+ // Perform matrix vector multiplication
+ workd(ipntr(2):ipntr(2) + nx - 1) = A * workd(ipntr(1):ipntr(1) + nx - 1);
+ end
+end
+
+// Post-Process using ZNEUPD.
+
+rvec = 1;
+howmany = 'A';
+info_zneupd = 0;
+
+[d, z, resid, iparam, ipntr, workd, workl, rwork, info_zneupd] = zneupd(rvec, howmany, _select, d, z, sigma, workev, bmat, nx, which, nev, tol, resid, ncv, v, ...
+ iparam, ipntr, workd, workl, rwork, info_zneupd);
+
+assert_checkalmostequal(A * z, z * diag(d(1:3)), sqrt(%eps), 1.e-10);
diff --git a/modules/arnoldi/tests/unit_tests/znaupd.dia.ref b/modules/arnoldi/tests/unit_tests/znaupd.dia.ref
new file mode 100755
index 000000000..5b691200b
--- /dev/null
+++ b/modules/arnoldi/tests/unit_tests/znaupd.dia.ref
@@ -0,0 +1,60 @@
+// =============================================================================
+// Scilab ( http://www.scilab.org/ ) - This file is part of Scilab
+// Copyright (C) 2012 - SE - Sylvestre Ledru
+//
+// This file is distributed under the same license as the Scilab package.
+// =============================================================================
+// <-- CLI SHELL MODE -->
+// <-- LINUX ONLY -->
+nx = 10;
+nev = 3;
+ncv = 6;
+bmat = 'I';
+which = 'LM';
+// Local Arrays
+iparam = zeros(11, 1);
+ipntr = zeros(14, 1);
+_select = zeros(ncv, 1);
+d = zeros(nev + 1, 1) + 0 * %i;
+z = zeros(nx, nev) + 0* %i;
+resid = zeros(nx, 1) + 0 * %i;
+v = zeros(nx, ncv) + 0 * %i;
+workd = zeros(3 * nx, 1) + 0 * %i;
+workev = zeros(2 * ncv, 1) + 0 * %i;
+rwork = zeros(ncv, 1);
+workl = zeros(3 * ncv * ncv + 5 *ncv, 1) + 0 * %i;
+// Build the complex test matrix
+A = diag(10 * ones(nx,1) + %i * ones(nx,1));
+A(1:$-1,2:$) = A(1:$-1,2:$) + diag(6 * ones(nx - 1,1));
+A(2:$,1:$-1) = A(2:$,1:$-1) + diag(-6 * ones(nx - 1,1));
+tol = 0;
+ido = 0;
+ishfts = 1;
+maxitr = 300;
+mode1 = 1;
+iparam(1) = ishfts;
+iparam(3) = maxitr;
+iparam(7) = mode1;
+sigma = complex(0);
+info_znaupd = 0;
+// M A I N L O O P (Reverse communication)
+while(ido <> 99)
+ // Repeatedly call the routine ZNAUPD and take actions indicated by parameter IDO until
+ // either convergence is indicated or maxitr has been exceeded.
+ [ido, resid, v, iparam, ipntr, workd, workl, rwork, info_znaupd] = znaupd(ido, bmat, nx, which, nev, tol, resid, ncv, v, iparam, ipntr, workd, workl, rwork, info_znaupd);
+ if(info_znaupd < 0)
+ printf('\nError with znaupd, info = %d\n', info_znaupd);
+ printf('Check the documentation of znaupd\n\n');
+ end
+ if(ido == -1 | ido == 1)
+ // Perform matrix vector multiplication
+ workd(ipntr(2):ipntr(2) + nx - 1) = A * workd(ipntr(1):ipntr(1) + nx - 1);
+ end
+end
+// Post-Process using ZNEUPD.
+rvec = 1;
+howmany = 'A';
+info_zneupd = 0;
+[d, z, resid, iparam, ipntr, workd, workl, rwork, info_zneupd] = zneupd(rvec, howmany, _select, d, z, sigma, workev, bmat, nx, which, nev, tol, resid, ncv, v, ...
+ iparam, ipntr, workd, workl, rwork, info_zneupd);
+assert_checkalmostequal(A * z, z * diag(d(1:3)), sqrt(%eps), 1.e-10);
diff --git a/modules/arnoldi/tests/unit_tests/znaupd.tst b/modules/arnoldi/tests/unit_tests/znaupd.tst
new file mode 100755
index 000000000..4bc06776e
--- /dev/null
+++ b/modules/arnoldi/tests/unit_tests/znaupd.tst
@@ -0,0 +1,76 @@
+// =============================================================================
+// Scilab ( http://www.scilab.org/ ) - This file is part of Scilab
+// Copyright (C) 2012 - SE - Sylvestre Ledru
+//
+// This file is distributed under the same license as the Scilab package.
+// =============================================================================
+
+// <-- CLI SHELL MODE -->
+// <-- LINUX ONLY -->
+nx = 10;
+
+nev = 3;
+ncv = 6;
+bmat = 'I';
+which = 'LM';
+
+// Local Arrays
+
+iparam = zeros(11, 1);
+ipntr = zeros(14, 1);
+_select = zeros(ncv, 1);
+d = zeros(nev + 1, 1) + 0 * %i;
+z = zeros(nx, nev) + 0* %i;
+resid = zeros(nx, 1) + 0 * %i;
+v = zeros(nx, ncv) + 0 * %i;
+workd = zeros(3 * nx, 1) + 0 * %i;
+workev = zeros(2 * ncv, 1) + 0 * %i;
+rwork = zeros(ncv, 1);
+workl = zeros(3 * ncv * ncv + 5 *ncv, 1) + 0 * %i;
+
+// Build the complex test matrix
+A = diag(10 * ones(nx,1) + %i * ones(nx,1));
+A(1:$-1,2:$) = A(1:$-1,2:$) + diag(6 * ones(nx - 1,1));
+A(2:$,1:$-1) = A(2:$,1:$-1) + diag(-6 * ones(nx - 1,1));
+
+tol = 0;
+ido = 0;
+
+ishfts = 1;
+maxitr = 300;
+mode1 = 1;
+
+iparam(1) = ishfts;
+iparam(3) = maxitr;
+iparam(7) = mode1;
+
+sigma = complex(0);
+info_znaupd = 0;
+// M A I N L O O P (Reverse communication)
+while(ido <> 99)
+ // Repeatedly call the routine ZNAUPD and take actions indicated by parameter IDO until
+ // either convergence is indicated or maxitr has been exceeded.
+
+ [ido, resid, v, iparam, ipntr, workd, workl, rwork, info_znaupd] = znaupd(ido, bmat, nx, which, nev, tol, resid, ncv, v, iparam, ipntr, workd, workl, rwork, info_znaupd);
+
+ if(info_znaupd < 0)
+ printf('\nError with znaupd, info = %d\n', info_znaupd);
+ printf('Check the documentation of znaupd\n\n');
+ end
+
+ if(ido == -1 | ido == 1)
+ // Perform matrix vector multiplication
+ workd(ipntr(2):ipntr(2) + nx - 1) = A * workd(ipntr(1):ipntr(1) + nx - 1);
+ end
+end
+
+// Post-Process using ZNEUPD.
+
+rvec = 1;
+howmany = 'A';
+info_zneupd = 0;
+
+[d, z, resid, iparam, ipntr, workd, workl, rwork, info_zneupd] = zneupd(rvec, howmany, _select, d, z, sigma, workev, bmat, nx, which, nev, tol, resid, ncv, v, ...
+ iparam, ipntr, workd, workl, rwork, info_zneupd);
+
+assert_checkalmostequal(A * z, z * diag(d(1:3)), sqrt(%eps), 1.e-10);
diff --git a/modules/arnoldi/tests/unit_tests/zneupd-win.dia.ref b/modules/arnoldi/tests/unit_tests/zneupd-win.dia.ref
new file mode 100755
index 000000000..d75f28712
--- /dev/null
+++ b/modules/arnoldi/tests/unit_tests/zneupd-win.dia.ref
@@ -0,0 +1,59 @@
+// =============================================================================
+// Scilab ( http://www.scilab.org/ ) - This file is part of Scilab
+// Copyright (C) 2012 - SE - Sylvestre Ledru
+//
+// This file is distributed under the same license as the Scilab package.
+// =============================================================================
+// <-- WINDOWS ONLY -->
+nx = 10;
+nev = 3;
+ncv = 6;
+bmat = 'I';
+which = 'LM';
+// Local Arrays
+iparam = zeros(11, 1);
+ipntr = zeros(14, 1);
+_select = zeros(ncv, 1);
+d = zeros(nev + 1, 1) + 0 * %i;
+z = zeros(nx, nev) + 0* %i;
+resid = zeros(nx, 1) + 0 * %i;
+v = zeros(nx, ncv) + 0 * %i;
+workd = zeros(3 * nx, 1) + 0 * %i;
+workev = zeros(2 * ncv, 1) + 0 * %i;
+rwork = zeros(ncv, 1);
+workl = zeros(3 * ncv * ncv + 5 *ncv, 1) + 0 * %i;
+// Build the complex test matrix
+A = diag(10 * ones(nx,1) + %i * ones(nx,1));
+A(1:$-1,2:$) = A(1:$-1,2:$) + diag(6 * ones(nx - 1,1));
+A(2:$,1:$-1) = A(2:$,1:$-1) + diag(-6 * ones(nx - 1,1));
+tol = 0;
+ido = 0;
+ishfts = 1;
+maxitr = 300;
+mode1 = 1;
+iparam(1) = ishfts;
+iparam(3) = maxitr;
+iparam(7) = mode1;
+sigma = complex(0);
+info_znaupd = 0;
+// M A I N L O O P (Reverse communication)
+while(ido <> 99)
+ // Repeatedly call the routine ZNAUPD and take actions indicated by parameter IDO until
+ // either convergence is indicated or maxitr has been exceeded.
+ [ido, resid, v, iparam, ipntr, workd, workl, rwork, info_znaupd] = znaupd(ido, bmat, nx, which, nev, tol, resid, ncv, v, iparam, ipntr, workd, workl, rwork, info_znaupd);
+ if(info_znaupd < 0)
+ printf('\nError with znaupd, info = %d\n', info_znaupd);
+ printf('Check the documentation of znaupd\n\n');
+ end
+ if(ido == -1 | ido == 1)
+ // Perform matrix vector multiplication
+ workd(ipntr(2):ipntr(2) + nx - 1) = A * workd(ipntr(1):ipntr(1) + nx - 1);
+ end
+end
+// Post-Process using ZNEUPD.
+rvec = 1;
+howmany = 'A';
+info_zneupd = 0;
+[d, z, resid, iparam, ipntr, workd, workl, rwork, info_zneupd] = zneupd(rvec, howmany, _select, d, z, sigma, workev, bmat, nx, which, nev, tol, resid, ncv, v, ...
+ iparam, ipntr, workd, workl, rwork, info_zneupd);
+assert_checkalmostequal(A * z, z * diag(d(1:3)), sqrt(%eps), 1.e-10);
diff --git a/modules/arnoldi/tests/unit_tests/zneupd-win.tst b/modules/arnoldi/tests/unit_tests/zneupd-win.tst
new file mode 100755
index 000000000..80faf85af
--- /dev/null
+++ b/modules/arnoldi/tests/unit_tests/zneupd-win.tst
@@ -0,0 +1,74 @@
+// =============================================================================
+// Scilab ( http://www.scilab.org/ ) - This file is part of Scilab
+// Copyright (C) 2012 - SE - Sylvestre Ledru
+//
+// This file is distributed under the same license as the Scilab package.
+// =============================================================================
+// <-- WINDOWS ONLY -->
+nx = 10;
+
+nev = 3;
+ncv = 6;
+bmat = 'I';
+which = 'LM';
+
+// Local Arrays
+
+iparam = zeros(11, 1);
+ipntr = zeros(14, 1);
+_select = zeros(ncv, 1);
+d = zeros(nev + 1, 1) + 0 * %i;
+z = zeros(nx, nev) + 0* %i;
+resid = zeros(nx, 1) + 0 * %i;
+v = zeros(nx, ncv) + 0 * %i;
+workd = zeros(3 * nx, 1) + 0 * %i;
+workev = zeros(2 * ncv, 1) + 0 * %i;
+rwork = zeros(ncv, 1);
+workl = zeros(3 * ncv * ncv + 5 *ncv, 1) + 0 * %i;
+
+// Build the complex test matrix
+A = diag(10 * ones(nx,1) + %i * ones(nx,1));
+A(1:$-1,2:$) = A(1:$-1,2:$) + diag(6 * ones(nx - 1,1));
+A(2:$,1:$-1) = A(2:$,1:$-1) + diag(-6 * ones(nx - 1,1));
+
+tol = 0;
+ido = 0;
+
+ishfts = 1;
+maxitr = 300;
+mode1 = 1;
+
+iparam(1) = ishfts;
+iparam(3) = maxitr;
+iparam(7) = mode1;
+
+sigma = complex(0);
+info_znaupd = 0;
+// M A I N L O O P (Reverse communication)
+while(ido <> 99)
+ // Repeatedly call the routine ZNAUPD and take actions indicated by parameter IDO until
+ // either convergence is indicated or maxitr has been exceeded.
+
+ [ido, resid, v, iparam, ipntr, workd, workl, rwork, info_znaupd] = znaupd(ido, bmat, nx, which, nev, tol, resid, ncv, v, iparam, ipntr, workd, workl, rwork, info_znaupd);
+
+ if(info_znaupd < 0)
+ printf('\nError with znaupd, info = %d\n', info_znaupd);
+ printf('Check the documentation of znaupd\n\n');
+ end
+
+ if(ido == -1 | ido == 1)
+ // Perform matrix vector multiplication
+ workd(ipntr(2):ipntr(2) + nx - 1) = A * workd(ipntr(1):ipntr(1) + nx - 1);
+ end
+end
+
+// Post-Process using ZNEUPD.
+
+rvec = 1;
+howmany = 'A';
+info_zneupd = 0;
+
+[d, z, resid, iparam, ipntr, workd, workl, rwork, info_zneupd] = zneupd(rvec, howmany, _select, d, z, sigma, workev, bmat, nx, which, nev, tol, resid, ncv, v, ...
+ iparam, ipntr, workd, workl, rwork, info_zneupd);
+
+assert_checkalmostequal(A * z, z * diag(d(1:3)), sqrt(%eps), 1.e-10);
diff --git a/modules/arnoldi/tests/unit_tests/zneupd.dia.ref b/modules/arnoldi/tests/unit_tests/zneupd.dia.ref
new file mode 100755
index 000000000..5b691200b
--- /dev/null
+++ b/modules/arnoldi/tests/unit_tests/zneupd.dia.ref
@@ -0,0 +1,60 @@
+// =============================================================================
+// Scilab ( http://www.scilab.org/ ) - This file is part of Scilab
+// Copyright (C) 2012 - SE - Sylvestre Ledru
+//
+// This file is distributed under the same license as the Scilab package.
+// =============================================================================
+// <-- CLI SHELL MODE -->
+// <-- LINUX ONLY -->
+nx = 10;
+nev = 3;
+ncv = 6;
+bmat = 'I';
+which = 'LM';
+// Local Arrays
+iparam = zeros(11, 1);
+ipntr = zeros(14, 1);
+_select = zeros(ncv, 1);
+d = zeros(nev + 1, 1) + 0 * %i;
+z = zeros(nx, nev) + 0* %i;
+resid = zeros(nx, 1) + 0 * %i;
+v = zeros(nx, ncv) + 0 * %i;
+workd = zeros(3 * nx, 1) + 0 * %i;
+workev = zeros(2 * ncv, 1) + 0 * %i;
+rwork = zeros(ncv, 1);
+workl = zeros(3 * ncv * ncv + 5 *ncv, 1) + 0 * %i;
+// Build the complex test matrix
+A = diag(10 * ones(nx,1) + %i * ones(nx,1));
+A(1:$-1,2:$) = A(1:$-1,2:$) + diag(6 * ones(nx - 1,1));
+A(2:$,1:$-1) = A(2:$,1:$-1) + diag(-6 * ones(nx - 1,1));
+tol = 0;
+ido = 0;
+ishfts = 1;
+maxitr = 300;
+mode1 = 1;
+iparam(1) = ishfts;
+iparam(3) = maxitr;
+iparam(7) = mode1;
+sigma = complex(0);
+info_znaupd = 0;
+// M A I N L O O P (Reverse communication)
+while(ido <> 99)
+ // Repeatedly call the routine ZNAUPD and take actions indicated by parameter IDO until
+ // either convergence is indicated or maxitr has been exceeded.
+ [ido, resid, v, iparam, ipntr, workd, workl, rwork, info_znaupd] = znaupd(ido, bmat, nx, which, nev, tol, resid, ncv, v, iparam, ipntr, workd, workl, rwork, info_znaupd);
+ if(info_znaupd < 0)
+ printf('\nError with znaupd, info = %d\n', info_znaupd);
+ printf('Check the documentation of znaupd\n\n');
+ end
+ if(ido == -1 | ido == 1)
+ // Perform matrix vector multiplication
+ workd(ipntr(2):ipntr(2) + nx - 1) = A * workd(ipntr(1):ipntr(1) + nx - 1);
+ end
+end
+// Post-Process using ZNEUPD.
+rvec = 1;
+howmany = 'A';
+info_zneupd = 0;
+[d, z, resid, iparam, ipntr, workd, workl, rwork, info_zneupd] = zneupd(rvec, howmany, _select, d, z, sigma, workev, bmat, nx, which, nev, tol, resid, ncv, v, ...
+ iparam, ipntr, workd, workl, rwork, info_zneupd);
+assert_checkalmostequal(A * z, z * diag(d(1:3)), sqrt(%eps), 1.e-10);
diff --git a/modules/arnoldi/tests/unit_tests/zneupd.tst b/modules/arnoldi/tests/unit_tests/zneupd.tst
new file mode 100755
index 000000000..4bc06776e
--- /dev/null
+++ b/modules/arnoldi/tests/unit_tests/zneupd.tst
@@ -0,0 +1,76 @@
+// =============================================================================
+// Scilab ( http://www.scilab.org/ ) - This file is part of Scilab
+// Copyright (C) 2012 - SE - Sylvestre Ledru
+//
+// This file is distributed under the same license as the Scilab package.
+// =============================================================================
+
+// <-- CLI SHELL MODE -->
+// <-- LINUX ONLY -->
+nx = 10;
+
+nev = 3;
+ncv = 6;
+bmat = 'I';
+which = 'LM';
+
+// Local Arrays
+
+iparam = zeros(11, 1);
+ipntr = zeros(14, 1);
+_select = zeros(ncv, 1);
+d = zeros(nev + 1, 1) + 0 * %i;
+z = zeros(nx, nev) + 0* %i;
+resid = zeros(nx, 1) + 0 * %i;
+v = zeros(nx, ncv) + 0 * %i;
+workd = zeros(3 * nx, 1) + 0 * %i;
+workev = zeros(2 * ncv, 1) + 0 * %i;
+rwork = zeros(ncv, 1);
+workl = zeros(3 * ncv * ncv + 5 *ncv, 1) + 0 * %i;
+
+// Build the complex test matrix
+A = diag(10 * ones(nx,1) + %i * ones(nx,1));
+A(1:$-1,2:$) = A(1:$-1,2:$) + diag(6 * ones(nx - 1,1));
+A(2:$,1:$-1) = A(2:$,1:$-1) + diag(-6 * ones(nx - 1,1));
+
+tol = 0;
+ido = 0;
+
+ishfts = 1;
+maxitr = 300;
+mode1 = 1;
+
+iparam(1) = ishfts;
+iparam(3) = maxitr;
+iparam(7) = mode1;
+
+sigma = complex(0);
+info_znaupd = 0;
+// M A I N L O O P (Reverse communication)
+while(ido <> 99)
+ // Repeatedly call the routine ZNAUPD and take actions indicated by parameter IDO until
+ // either convergence is indicated or maxitr has been exceeded.
+
+ [ido, resid, v, iparam, ipntr, workd, workl, rwork, info_znaupd] = znaupd(ido, bmat, nx, which, nev, tol, resid, ncv, v, iparam, ipntr, workd, workl, rwork, info_znaupd);
+
+ if(info_znaupd < 0)
+ printf('\nError with znaupd, info = %d\n', info_znaupd);
+ printf('Check the documentation of znaupd\n\n');
+ end
+
+ if(ido == -1 | ido == 1)
+ // Perform matrix vector multiplication
+ workd(ipntr(2):ipntr(2) + nx - 1) = A * workd(ipntr(1):ipntr(1) + nx - 1);
+ end
+end
+
+// Post-Process using ZNEUPD.
+
+rvec = 1;
+howmany = 'A';
+info_zneupd = 0;
+
+[d, z, resid, iparam, ipntr, workd, workl, rwork, info_zneupd] = zneupd(rvec, howmany, _select, d, z, sigma, workev, bmat, nx, which, nev, tol, resid, ncv, v, ...
+ iparam, ipntr, workd, workl, rwork, info_zneupd);
+
+assert_checkalmostequal(A * z, z * diag(d(1:3)), sqrt(%eps), 1.e-10);