1#!/usr/bin/env python3 2 3import sys 4import numpy as np 5import scipy.linalg as la 6 7n = 3 8 9if sys.argv.__len__()!=n*n+1: 10 print( "bad # args" ) 11 sys.exit() 12 13 14A = np.empty([n,n], dtype='f8') 15 16for j in range(n): 17 for i in range(n): 18 A[j][i] = sys.argv[1+j*n+i] 19 20print( "A:" ) 21print( A ) 22 23Q,R,P = la.qr(A, pivoting=True) 24 25print( "Q:" ) 26print( Q ) 27 28print( "R:" ) 29print( R ) 30 31print( "P:" ) 32print( P ) 33