#NEWLINE# def _solve_lsqr( X , y , alpha , max_iter = None , tol = 0.001 ) : #NEWLINE# #INDENT# ( n_samples , n_features ) = X . shape #NEWLINE# coefs = np . empty ( ( y . shape [ 1 ] , n_features ) ) #NEWLINE# n_iter = np . empty ( y . shape [ 1 ] , dtype = np . int32 ) #NEWLINE# sqrt_alpha = np . sqrt ( alpha ) #NEWLINE# for i in range ( y . shape [ 1 ] ) : #NEWLINE# #INDENT# y_column = y [ : , i ] #NEWLINE# info = sp_linalg . lsqr ( X , y_column , damp = sqrt_alpha [ i ] , atol = tol , btol = tol , iter_lim = max_iter ) #NEWLINE# coefs [ i ] = info [ 0 ] #NEWLINE# n_iter [ i ] = info [ 2 ] #NEWLINE# #UNINDENT# return ( coefs , n_iter )