I'm trying to use armadillo to do linear regression as in the following function:

```
void compute_weights()
{
    printf("transpose\n");
    const mat &xt(X.t());
    printf("inverse\n");
    mat xd;
    printf("mul\n");
    xd = (xt * X);
    printf("inv\n");
    xd = xd.i();
    printf("mul2\n");
    xd = xd * xt;
    printf("mul3\n");
    W = xd * Y;
}

```

I've split this up so I could see what was going on with the program getting so huge. The matrix X has 64 columns and over 23 million rows. The transpose isn't too bad, but that first multiply causes the memory footprint to completely blow up. Now, as I understand it, if I multiply X.t() \* X, each element of the matrix product will be the dot product of a column of X and a row of X.t(), and the result should be a 64x64 matrix. 

Sure, it should take a long time, but why would the memory suddenly blow up to nearly 30 gigabytes?

Then it seems to hang on to that memory, and then when it gets to the second multiply, it's just too much, and the OS kills it for getting so huge.

Is there a way to compute products without so much memory usage? Can that memory be reclaimed? Is there a better way to represent these calculations?