python - Using numpy.linalg with large system of equations -


i'm stucked trying use numpy.linalg functions solve big system of linear equations.

for instance, i've been trying use:

numpy.linalg.solve numpy.linalg.cg numpy.linalg.inv 

among others, , none of these functions return anything. program seems abort raising no error or warning @ all.

to demonstrate, have piece of code create a matrix:

   import numpy    intertools import product     indices = numpy.arange(x_steps * y_steps).reshape(x_steps, y_steps)    = numpy.zeros((x_steps * y_steps, x_steps * y_steps))    x, y in product(range(x_steps), range(y_steps)):         neighbors_x = indices[x, max(0, y-1):y+2].flatten()         neighbors_y = indices[max(0, x-1):x+2, y].flatten()         current = indices[x, y]          a[current, neighbors_x] = 1.0         a[current, neighbors_y] = 1.0         a[current, current] = -4.0      h = (x_dim / x_steps) * (y_dim / y_steps)     /= h 

withx_dim = y_dim = 12 , x_steps = y_steps = 100.

the code works fine. when try calculate det(a) 0.0144, correct.

but system never solved. tried calculate inverse of a:

print 'inv' z = numpy.linalg.inv(a) print 'here' 

and 'here' never printed, , no error raised @ all. see first print , appears on console the program finished code 0. said, tried solve system conjugate gradient method , same occurs. weird, because didn't error/warning me find wrong.

i think memory problem (i running code in 64bits windows 8.1 -- 4gb ram -- 32bits numpy -- 64 generated lot of incompatibilities here) don't know if there way solve it. if problem, conjugate gradient method shouldn't able solve this, since purpose?

thank in advance.


Comments