diff --git a/freeimodpoly.cpp b/freeimodpoly.cpp index e427f7c..e3a23e9 100644 --- a/freeimodpoly.cpp +++ b/freeimodpoly.cpp @@ -13,7 +13,7 @@ // General Public License for more details. // // You should have received a copy of the GNU General Public License -// along with Octave; see the file COPYING. If not, see +// along with Octave; see the file LICENSE. If not, see // . // // FreeIModPoly: A free software implementation of the Vancouver Raman Algorithm @@ -157,8 +157,9 @@ vec FreeIModPoly::CalcPoly(const vec &coefs, const vec &x) /// vec FreeIModPoly::OrdinaryLeastSquares(const mat &X, const vec &y) { - return (pinv(X.t() * X) * (X.t() * y)); - + mat Q, R; + qr(Q, R, X); + return solve(R, Q.t()) * y; } /// diff --git a/freeimodpoly.h b/freeimodpoly.h index f4f8824..2f3889c 100644 --- a/freeimodpoly.h +++ b/freeimodpoly.h @@ -13,7 +13,7 @@ // General Public License for more details. // // You should have received a copy of the GNU General Public License -// along with Octave; see the file COPYING. If not, see +// along with Octave; see the file LICENSE. If not, see // . // // FreeIModPoly: A free software implementation of the Vancouver Raman Algorithm