From c305778e3a20e314fcf48cc77dd31c4d997e7497 Mon Sep 17 00:00:00 2001 From: Timothy Hanson Date: Mon, 27 Aug 2012 16:08:27 -0700 Subject: [PATCH] fixed least-squares output bug: matrix was correct but shape was transposed. --- lmatrix.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/lmatrix.c b/lmatrix.c index de2e964..1335740 100644 --- a/lmatrix.c +++ b/lmatrix.c @@ -1514,7 +1514,7 @@ static int nl_ls (lua_State *L, nl_Matrix *a, nl_Matrix *b, nl_Matrix *s, x = pushmatrix(L, b->iscomplex, 1, &n, 1, n, NULL, NULL); else { x = pushmatrix(L, b->iscomplex, 2, NULL, 1, nrhs * n, NULL, NULL); - x->dim[0] = nrhs; x->dim[1] = n; + x->dim[0] = n; x->dim[1] = nrhs; // A: m by n, x n by nrhs, b m by nrhs. } if (b->iscomplex) { nl_Complex *pb = CPX(bufb->data.bnum);