diff --git a/dlib/matrix/matrix_qr.h b/dlib/matrix/matrix_qr.h index e63c8f320..086d481f1 100644 --- a/dlib/matrix/matrix_qr.h +++ b/dlib/matrix/matrix_qr.h @@ -62,8 +62,9 @@ namespace dlib const matrix_type get_q ( ) const; + template void get_q ( - matrix_type& Q + matrix& Q ) const; template @@ -270,9 +271,10 @@ namespace dlib // ---------------------------------------------------------------------------------------- template + template void qr_decomposition:: get_q( - matrix_type& X + matrix& X ) const { #ifdef DLIB_USE_LAPACK diff --git a/dlib/test/matrix4.cpp b/dlib/test/matrix4.cpp index dd63940ed..5c4cc925c 100644 --- a/dlib/test/matrix4.cpp +++ b/dlib/test/matrix4.cpp @@ -631,6 +631,16 @@ namespace 3,3,3; DLIB_TEST(upperbound(m,3) == M); } + + { + matrix A = randm(9,5); + matrix B = A; + + orthogonalize(A); + orthogonalize(B); + + DLIB_TEST(equal(A,B)); + } }