### linear-algebra

#### Lapack Orthonormalization Function for Rectangular Matrix

I was wondering if there was a function in Lapack for orthonormalizing the columns of a very tall and skinny matrix. A similar previous question asked this question, presumably in the context of a square matrix. My setting is as follows: I have an M by N matrix A that I am trying to orthonormalize the columns of. So, my first thought was to do a qr decomposition. The functions for doing a qr decomposition in Lapack seem to be dgeqrf and dormqr. Great. However, my problem is as follows: my matrix A is so tall, that I don't want to actually compute all of Q, because it is M by M. In fact, I can't afford to instantiate an M by M matrix at all during any of my computation (it would not fit in memory). I would rather compute just the matrix that wikipedia calls Q1. However, I can't seem to find a way to make this work. The weird thing is, that I think it is possible. Numpy, in particular, has a function numpy.linalg.qr that appears to do just this. However, even after reading their source code, I can't figure out how they are using lapack calls to get this to work. Do folks have ideas? I would strongly prefer this to only use lapack functions because I am hoping to port this code to CuSOLVE, which has implemented several lapack functions (including dgeqrf and dormqr) for the GPU.

You want the "thin" or "economy size" version of QR. In matlab, you can do this with: [Q,R] = qr(A,0); I haven't used Lapack directly, but I would imagine there's a corresponding call there. It appears that you can do this in python with: numpy.linalg.qr(a, mode='reduced')

### Related Links

How to calculate an orthogonal plane from a vector

Calculating error in PCA

Calculate the position of a point

How do I get all solutions from this system?

How is a Line Represented in Epipolar Geometry?

Does ALS require zero entries?

How can I find linear dependency's , when one (or more) coefficients are fixed?

How to solve Linear ODEs system using matrix method in Maple?

Matrix Division

How to represent a bus ride in linear programming?

Matlab : How do I ensure that the covariance matrix is positive definite when using Kalman Filter

Computing singular values vs eigenvalues when you have the choice

Solving of a linear system with parameters

Upper Division Linear Algebra

positive solutions to a homogeneous linear system

Use LispLab within AutoCAD