sindibadthesailor

Factorisation LU

Apr 15th, 2023
556
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Python 0.35 KB | Source Code | 0 0
  1. import pprint
  2. import numpy
  3. import scipy
  4. import scipy.linalg   # SciPy Linear Algebra Library
  5.  
  6. A = numpy.array([ [7, 3, -1, 2], [3, 8, 1, -4], [-1, 1, 4, -1], [2, -4, -1, 6] ])
  7. P, L, U = scipy.linalg.lu(A)
  8.  
  9. print ("A:")
  10. pprint.pprint(A)
  11.  
  12. #print ("P:")
  13. #pprint.pprint(P)
  14.  
  15. print ("L:")
  16. pprint.pprint(L)
  17.  
  18. print ("U:")
  19.  
  20.  
  21.  
  22. pprint.pprint(U)
Advertisement
Add Comment
Please, Sign In to add comment