Skip to content

Commit

Permalink
Add more tests for eigs
Browse files Browse the repository at this point in the history
Fix path for test_utf8.j
  • Loading branch information
ViralBShah committed Aug 6, 2011
1 parent f6b8578 commit 955079b
Show file tree
Hide file tree
Showing 4 changed files with 13 additions and 10 deletions.
4 changes: 2 additions & 2 deletions test/Makefile
Original file line number Diff line number Diff line change
@@ -1,3 +1,5 @@
testall: test test-utf8 test-perf

unittests:
../julia unittests.j

Expand All @@ -10,5 +12,3 @@ test-utf8:

test-perf:
../julia perf.j

testall: test test-utf8 test-perf
4 changes: 2 additions & 2 deletions test/test_utf8.j
Original file line number Diff line number Diff line change
@@ -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)| < ε"
Expand Down
10 changes: 7 additions & 3 deletions test/tests.j
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down Expand Up @@ -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
5 changes: 2 additions & 3 deletions test/unittests.j
Original file line number Diff line number Diff line change
Expand Up @@ -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()
Expand Down

0 comments on commit 955079b

Please sign in to comment.