Mercurial > hg > octave-nkf
changeset 2728:0bb420249195
[project @ 1997-02-24 22:16:23 by jwe]
line wrap: on
line diff
new file mode 100644 --- /dev/null +++ b/test/octave.test/linalg/det-1.m @@ -0,0 +1,1 @@ +det ([1, 2; 3, 4]) == -2
new file mode 100644 --- /dev/null +++ b/test/octave.test/linalg/det-3.m @@ -0,0 +1,1 @@ +det (1, 2)
new file mode 100644 --- /dev/null +++ b/test/octave.test/linalg/det-4.m @@ -0,0 +1,1 @@ +det ([1, 2; 3, 4; 5, 6])
new file mode 100644 --- /dev/null +++ b/test/octave.test/linalg/eig-1.m @@ -0,0 +1,1 @@ +all (eig ([1, 2; 2, 1]) - [3; -1] < sqrt (eps))
new file mode 100644 --- /dev/null +++ b/test/octave.test/linalg/eig-2.m @@ -0,0 +1,4 @@ +[v, d] = eig ([1, 2; 2, 1]); +x = 1 / sqrt (2); +(abs (d - [3, 0; 0, -1] < sqrt (eps)) + && abs (v - [x, -x; x, x] < sqrt (eps)))
new file mode 100644 --- /dev/null +++ b/test/octave.test/linalg/eig-4.m @@ -0,0 +1,1 @@ +eig ([1, 2; 3, 4], 2)
new file mode 100644 --- /dev/null +++ b/test/octave.test/linalg/eig-5.m @@ -0,0 +1,1 @@ +eig ([1, 2; 3, 4; 5, 6])
new file mode 100644 --- /dev/null +++ b/test/octave.test/linalg/inv-1.m @@ -0,0 +1,1 @@ +all (all (inv ([1, 2; 3, 4]) - [-2, 1; 1.5, -0.5] < sqrt (eps)))
new file mode 100644 --- /dev/null +++ b/test/octave.test/linalg/inv-3.m @@ -0,0 +1,1 @@ +inv ([1, 2; 3, 4], 2)
new file mode 100644 --- /dev/null +++ b/test/octave.test/linalg/inv-4.m @@ -0,0 +1,1 @@ +inv ([1, 2; 3, 4; 5, 6])
--- a/test/octave.test/linalg/linalg.exp +++ b/test/octave.test/linalg/linalg.exp @@ -1,21 +1,156 @@ # balance # cond -# det -# eig + +set test det-1 +set prog_output "ans = 1" +do_test det-1.m + +set test det-2 +set prog_output "\n... det:.*" +do_test det-2.m + +set test det-3 +set prog_output "\n... det:.*" +do_test det-3.m + +set test det-4 +set prog_output "error:.*" +do_test det-4.m + +set test eig-1 +set prog_output "ans = 1" +do_test eig-1.m + +set test eig-2 +set prog_output "ans = 1" +do_test eig-2.m + +set test eig-3 +set prog_output "\n... eig:.*" +do_test eig-3.m + +set test eig-4 +set prog_output "\n... eig:.*" +do_test eig-4.m + +set test eig-5 +set prog_output "error:.*" +do_test eig-5.m + # givens -# inv + +set test inv-1 +set prog_output "ans = 1" +do_test inv-1.m + +set test inv-2 +set prog_output "\n... inv:.*" +do_test inv-2.m + +set test inv-3 +set prog_output "\n... inv:.*" +do_test inv-3.m + +set test inv-4 +set prog_output "error:.*" +do_test inv-4.m + # norm -# null +# null # orth # pinv # rank # trace # chol # hess -# lu -# qr + +set test lu-1 +set prog_output "ans = 1" +do_test lu-1.m + +set test lu-2 +set prog_output "ans = 1" +do_test lu-2.m + +set test lu-3 +set prog_output "ans = 1" +do_test lu-3.m + +set test lu-4 +set prog_output "\n... lu:.*" +do_test lu-4.m + +set test lu-5 +set prog_output "\n... lu:.*" +do_test lu-5.m + +set test lu-6 +set prog_output "error:.*" +do_test lu-6.m + +set test qr-1 +set prog_output "ans = 1" +do_test qr-1.m + +set test qr-2 +set prog_output "ans = 1" +do_test qr-2.m + +set test qr-3 +set prog_output "ans = 1" +do_test qr-3.m + +set test qr-4 +set prog_output "ans = 1" +do_test qr-4.m + +set test qr-5 +set prog_output "\n... qr:.*" +do_test qr-5.m + +set test qr-6 +set prog_output "\n... qr:.*" +do_test qr-6.m + # schur -# svdexpm + +set test svd-1 +set prog_output "ans = 1" +do_test svd-1.m + +set test svd-2 +set prog_output "ans = 1" +do_test svd-2.m + +set test svd-3 +set prog_output "ans = 1" +do_test svd-3.m + +set test svd-4 +set prog_output "ans = 1" +do_test svd-4.m + +set test svd-5 +set prog_output "ans = 1" +do_test svd-5.m + +set test svd-6 +set prog_output "ans = 1" +do_test svd-6.m + +set test svd-7 +set prog_output "\n... svd:.*" +do_test svd-7.m + +set test svd-8 +set prog_output "\n... svd:.*" +do_test svd-8.m + +set test svd-9 +set prog_output "\n... svd:.*" +do_test svd-9.m + +# expm # logm # sqrtm # kron
new file mode 100644 --- /dev/null +++ b/test/octave.test/linalg/lu-1.m @@ -0,0 +1,1 @@ +all (all (lu ([1, 2; 3, 4]) - [1/3, 1; 1, 0] < eps))
new file mode 100644 --- /dev/null +++ b/test/octave.test/linalg/lu-2.m @@ -0,0 +1,3 @@ +[l, u] = lu ([1, 2; 3, 4]) +(abs (l - [1/3, 1; 1, 0] < sqrt (eps)) + && abs (u - [3, 4; 0, 2/3] < sqrt (eps)))
new file mode 100644 --- /dev/null +++ b/test/octave.test/linalg/lu-3.m @@ -0,0 +1,4 @@ +[l, u, p] = lu ([1, 2; 3, 4]); +(abs (l - [1, 0; 1/3, 1]) < sqrt (eps) + && abs (u - [3, 4; 0, 2/3]) < sqrt (eps) + && abs (p - [0, 1; 1, 0]) < sqrt (eps))
new file mode 100644 --- /dev/null +++ b/test/octave.test/linalg/lu-5.m @@ -0,0 +1,1 @@ +lu ([1, 2; 3, 4], 2)
new file mode 100644 --- /dev/null +++ b/test/octave.test/linalg/lu-6.m @@ -0,0 +1,1 @@ +lu ([1, 2; 3, 4; 5, 6])
new file mode 100644 --- /dev/null +++ b/test/octave.test/linalg/qr-1.m @@ -0,0 +1,3 @@ +[q, r] = qr ([0, 2, 1; 2, 1, 2]) +(abs (q - [0, -1; -1, 0] < sqrt (eps)) + && abs (r - [-2, -1, -2; 0, -2, -1] < sqrt (eps))) \ No newline at end of file
new file mode 100644 --- /dev/null +++ b/test/octave.test/linalg/qr-2.m @@ -0,0 +1,4 @@ +a = [0, 2, 1; 2, 1, 2]; +[q, r, p] = qr (a); +(size (q) == [2, 2] && size (r) == [2, 3] && size (p) == [3, 3] + && abs (a * p - q * r) < sqrt (eps))
new file mode 100644 --- /dev/null +++ b/test/octave.test/linalg/qr-3.m @@ -0,0 +1,4 @@ +a = [0, 2; 2, 1; 1, 2]; +[q, r, p] = qr (a); +(size (q) == [3, 3] && size (r) == [3, 2] && size (p) == [2, 2] + && abs (a - q * r * p) < sqrt (eps))
new file mode 100644 --- /dev/null +++ b/test/octave.test/linalg/qr-4.m @@ -0,0 +1,4 @@ +a = [0, 2; 2, 1; 1, 2]; +[q, r, p] = qr (a, 0); +(size (q) == [3, 2] && size (r) == [2, 2] && size (p) == [1, 2] + && abs (a (:, p) - q * r) < sqrt (eps))
new file mode 100644 --- /dev/null +++ b/test/octave.test/linalg/qr-6.m @@ -0,0 +1,1 @@ +qr ([1, 2; 3, 4], 0, 2)
new file mode 100644 --- /dev/null +++ b/test/octave.test/linalg/svd-1.m @@ -0,0 +1,1 @@ +all (abs (svd ([1, 2; 2, 1]) - [3; 1]) < sqrt (eps))
new file mode 100644 --- /dev/null +++ b/test/octave.test/linalg/svd-10.m @@ -0,0 +1,1 @@ +all (svd ([eye(3), eye(3)]) - [rt2; rt2; rt2] < sqrt (eps))
new file mode 100644 --- /dev/null +++ b/test/octave.test/linalg/svd-2.m @@ -0,0 +1,5 @@ +[u, s, v] = svd ([1, 2; 2, 1]); +x = 1 / sqrt (2); +(abs (u - [-x, -x; -x, x] < sqrt (eps)) + && abs (s - [3, 0; 0, 1] < sqrt (eps)) + && abs (v - [-x, x; -x, -x] < sqrt (eps)))
new file mode 100644 --- /dev/null +++ b/test/octave.test/linalg/svd-3.m @@ -0,0 +1,4 @@ +a = [1, 2, 3; 4, 5, 6]; +[u, s, v] = svd (a); +(size (u) == [2, 2] && size (s) == [2, 3] && size (v) == [3, 3] + && abs (a - u * s * v') < sqrt (eps))
new file mode 100644 --- /dev/null +++ b/test/octave.test/linalg/svd-4.m @@ -0,0 +1,4 @@ +a = [1, 2; 3, 4; 5, 6]; +[u, s, v] = svd (a); +(size (u) == [3, 3] && size (s) == [3, 2] && size (v) == [2, 2] + && abs (a - u * s * v') < sqrt (eps))
new file mode 100644 --- /dev/null +++ b/test/octave.test/linalg/svd-5.m @@ -0,0 +1,4 @@ +a = [1, 2, 3; 4, 5, 6]; +[u, s, v] = svd (a, 1); +(size (u) == [2, 2] && size (s) == [2, 2] && size (v) == [3, 2] + && abs (a - u * s * v') < sqrt (eps))
new file mode 100644 --- /dev/null +++ b/test/octave.test/linalg/svd-6.m @@ -0,0 +1,4 @@ +a = [1, 2; 3, 4; 5, 6]; +[u, s, v] = svd (a, 1); +(size (u) == [3, 2] && size (s) == [2, 2] && size (v) == [2, 2] + && abs (a - u * s * v') < sqrt (eps))