function [U, rk] = lsq_solve_system(nx,nf,A,B,verbose)
%?int lsq_solve_system(int nx, int nf, double A[], double B[], double U[], bool_t verbose)

%Solves the system {A * U = B} for {U}. Returns the apparent rank of {A}.

%     if (verbose)
%       %Print the least squares system:
%         fprintf(stderr, '  least squares systems:\n');
%         for iv = 1:nx
%           fprintf(stderr, '  %-4s', (iv == nx/2 ? 'A = ' : ''));
%             lsq_debug_double_vec(nx, &(A[iv*nx]), '%12.5f');
%             fprintf(stderr, '  %-4s', (iv == nx/2 ? 'B = ' : ''));
%             lsq_debug_double_vec(nf, &(B[iv*nf]), '%12.5f');
%             fprintf(stderr, '\n');
%         end
%         fprintf(stderr, '\n');
%     end

%Solve the least squares system:
U = A\B;
rk = nx;

%     rk = gsel_solve(nx, nx, A, nf, B, U, 0.0);%?
%     if (verbose)
%       fprintf(stderr, '  rank = %d', rank);
%         if (rank < nx)
%             fprintf(stderr, ' (%s)', 'indeterminate');
%         end
%         fprintf(stderr, '\n');
%     end
%     return rank;
