From eba14d944e7029d4f62b364816f0cc2599c661b0 Mon Sep 17 00:00:00 2001 From: Ernesto Tapia Date: Fri, 12 Feb 2016 14:51:03 +0100 Subject: [PATCH 1/2] Using general matrix type in the argument of qr_decomposition::get_q --- dlib/matrix/matrix_qr.h | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) 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 From e553b0fc625004ec35c568c7d013009b7bc79c58 Mon Sep 17 00:00:00 2001 From: Ernesto Tapia Date: Fri, 12 Feb 2016 16:59:07 +0100 Subject: [PATCH 2/2] Test orthogonalize. --- dlib/test/matrix4.cpp | 10 ++++++++++ 1 file changed, 10 insertions(+) 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)); + } }