


"""simple docstring"""







import numpy as np






def 					a__ (       _UpperCamelCase ):





						"""simple docstring"""

						UpperCAmelCase__	,				UpperCAmelCase__		=    a.shape
						UpperCAmelCase__		=    min(_UpperCamelCase	,			_UpperCamelCase )
						UpperCAmelCase__		=    np.eye(_UpperCamelCase )
						UpperCAmelCase__		=    a.copy()

						for k in range(t - 1 ):
												# select a column of modified matrix A':
												UpperCAmelCase__		=    r[k:, [k]]
												# construct first basis vector
												UpperCAmelCase__		=    np.zeros_like(_UpperCamelCase )
												UpperCAmelCase__		=    1.0
												# determine scaling factor
												UpperCAmelCase__		=    np.linalg.norm(_UpperCamelCase )
												# construct vector v for Householder reflection
												UpperCAmelCase__		=    x + np.sign(x[0] ) * alpha * ea
												v /= np.linalg.norm(_UpperCamelCase )

												# construct the Householder matrix
												UpperCAmelCase__		=    np.eye(m - k ) - 2.0 * v @ v.T
												# pad with ones and zeros as necessary
												UpperCAmelCase__		=    np.block([[np.eye(_UpperCamelCase ), np.zeros((k, m - k) )], [np.zeros((m - k, k) ), q_k]] )

												UpperCAmelCase__		=    q @ q_k.T
												UpperCAmelCase__		=    q_k @ r

						return q, r


if __name__ == "__main__":
						import doctest

						doctest.testmod()



"""simple docstring"""







import safs
class 							lowerCamelCase       (			safs.SaFileSystem ):


							"""simple docstring"""