From 955079bf30321c1c06c3ede250883cb6fb117449 Mon Sep 17 00:00:00 2001 From: "Viral B. Shah" Date: Sat, 6 Aug 2011 17:35:59 +0530 Subject: [PATCH] Add more tests for eigs Fix path for test_utf8.j --- test/Makefile | 4 ++-- test/test_utf8.j | 4 ++-- test/tests.j | 10 +++++++--- test/unittests.j | 5 ++--- 4 files changed, 13 insertions(+), 10 deletions(-) diff --git a/test/Makefile b/test/Makefile index 603c8962cf43e..34d116757a2b1 100644 --- a/test/Makefile +++ b/test/Makefile @@ -1,3 +1,5 @@ +testall: test test-utf8 test-perf + unittests: ../julia unittests.j @@ -10,5 +12,3 @@ test-utf8: test-perf: ../julia perf.j - -testall: test test-utf8 test-perf diff --git a/test/test_utf8.j b/test/test_utf8.j index 9077d8a4b2b8d..a6bb73482d5e6 100644 --- a/test/test_utf8.j +++ b/test/test_utf8.j @@ -1,5 +1,5 @@ -str1 = CharString(read(open("test/unicode/UTF-32LE.txt"), Char, 1112065)[2:]); -str2 = UTF8String(read(open("test/unicode/UTF-8.txt"), Uint8, 4382595)[4:]); +str1 = CharString(read(open("unicode/UTF-32LE.txt"), Char, 1112065)[2:]); +str2 = UTF8String(read(open("unicode/UTF-8.txt"), Uint8, 4382595)[4:]); @assert str1 == str2 str1 = "∀ ε > 0, ∃ δ > 0: |x-y| < δ ⇒ |f(x)-f(y)| < ε" diff --git a/test/tests.j b/test/tests.j index 356c95d51e196..5c988bea52198 100644 --- a/test/tests.j +++ b/test/tests.j @@ -771,6 +771,13 @@ x = triu(a) \ b x = tril(a) \ b @assert sum(tril(a)*x-b) < 1e-8 +# arpack +(d,v) = eigs(asym, 3) +@assert sum(asym*v[:,1]-d[1,1]*v[:,1]) < 1e-8 + +(d,v) = eigs(a,3) +@assert abs(sum(a*v[:,2]-d[2,2]*v[:,2])) < 1e-8 + # hash table h = HashTable() for i=1:10000 @@ -814,6 +821,3 @@ end a = rand(8) + im*rand(8) @assert norm((1/length(a))*ifft(fft(a)) - a) < 1e-8 -# arpack -(d,v) = eigs(asym, 3) -@assert sum(asym*v[:,1]-d[1]*v[:,1]) < 1e-8 diff --git a/test/unittests.j b/test/unittests.j index c709b617e2aac..3f348c5761aa3 100644 --- a/test/unittests.j +++ b/test/unittests.j @@ -189,9 +189,8 @@ a = rand(n,n) @assert sum(l[p,:]*u - a) < 1e-8 # arpack -asym = a+a' -(d,v) = eigs(asym, 3) -@assert sum(asym*v[:,1]-d[1]*v[:,1]) < 1e-8 +(d,v) = eigs(a, 3) +@assert abs(sum(a*v[:,1]-d[1,1]*v[:,1])) < 1e-8 # hash table h = HashTable()