I'm new to Python, but I can use a library to do this, right? Like this one:
import pprint
import scipy
import scipy.linalg # SciPy Linear Algebra Library
A = scipy.array([ [7, 3, -1, 2], [3, 8, 1, -4], [-1, 1, 4, -1], [2, -4, -1, 6] ])
P, L, U = scipy.linalg.lu(A)
print "A:"
pprint.pprint(A)
print "P:"
pprint.pprint(P)
print "L:"
pprint.pprint(L)
print "U:"
pprint.pprint(U)
First of all, is this an ok way of doing it? And, how about pivoting ? Is there something that can do this for me or do I have to come up with a seperate algorithm ?
P.S. I just noticed that it dosen't even compile :( Or, I'm not doing it right. But this compiler should work.
"SyntaxError: multiple statements found while compiling a single statement".