Browse files

Bot matrices have good (A+E)-norm, didnt check their condition number…

…s though
  • Loading branch information...
1 parent 51ae447 commit a16fddbd467a8b99ae347381ed1b3eae869270b5 @shevchen committed Mar 5, 2012
Showing with 3 additions and 2 deletions.
  1. +1 −1 testNorm.py
  2. +2 −1 utils.py
View
2 testNorm.py
@@ -2,7 +2,7 @@
from numpy.linalg import *
for n in range(50):
- a = wellConditioned(n + 1) + identityMatrix(n + 1)
+ a = illConditioned(n + 1) + identityMatrix(n + 1)
if norm(a) > 1:
print "||A + E|| > 1:", (n + 1)
print a
View
3 utils.py
@@ -12,7 +12,8 @@ def illConditioned(n):
m = matrix([[0.] * n] * n)
for i in range(n):
for j in range(n):
- m[i, j] = 1. / (i + j + 1)
+ m[i, j] = 1. / (i + j + 1) / n
+ m[i, i] = -1.
return m
def identityMatrix(n):

0 comments on commit a16fddb

Please sign in to comment.