### 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

Linear Algebra Derivation in Gertler-Karadi (2015) AEJ

Lapack Orthonormalization Function for Rectangular Matrix

Speed of linear dynamical system trajectory

Linear iterative solver vs direct solver stability

Linear algebra algorithms example [closed]

Solving Matrix equation over GF(2) in Sage

Which sparse linear solver is faster? SparseLU or BiCGSTAB?

Maple: LinearSystemPlot with two variables

Finding connected components in adjacency matrix

proof of each row of self product of transition matrix sums to 1

AB+C when you only have ABC and C [closed]

Project idea using Eigen

Sympy: Singular Value Decomposition of Symbolic Matrix

Max size of set linear equations to solve? (X=AX+B)

Rank of the product of two full rank matrices

Mean Centering a Tensor in torch7