diff --git a/dlib/matrix/lapack/gesdd.h b/dlib/matrix/lapack/gesdd.h index 47b402695..f0c8c341c 100644 --- a/dlib/matrix/lapack/gesdd.h +++ b/dlib/matrix/lapack/gesdd.h @@ -222,6 +222,10 @@ namespace dlib u.set_size(m, std::min(m,n)); vt.set_size(std::min(m,n), n); } + else if (jobz == 'O') + { + DLIB_CASSERT(false, "jobz == 'O' not supported"); + } else { u.set_size(1,1); @@ -290,6 +294,10 @@ namespace dlib u.set_size(std::min(m,n), m); vt.set_size(n, std::min(m,n)); } + else if (jobz == 'O') + { + DLIB_CASSERT(false, "jobz == 'O' not supported"); + } else { u.set_size(1,1); diff --git a/dlib/matrix/lapack/gesvd.h b/dlib/matrix/lapack/gesvd.h index 26a7174aa..c65bb549b 100644 --- a/dlib/matrix/lapack/gesvd.h +++ b/dlib/matrix/lapack/gesvd.h @@ -214,6 +214,13 @@ namespace dlib else vt.set_size(1,1); + + if (jobu == 'O' || jobvt == 'O') + { + DLIB_CASSERT(false, "job == 'O' not supported"); + } + + // figure out how big the workspace needs to be. T work_size = 1; int info = binding::gesvd(jobu, jobvt, a.nr(), a.nc(), &a(0,0), a.nr(), @@ -243,8 +250,8 @@ namespace dlib typename MM > int gesvd ( - const char jobu, - const char jobvt, + char jobu, + char jobvt, matrix& a, matrix& s, matrix& u_, @@ -256,6 +263,7 @@ namespace dlib // Row major order matrices are transposed from LAPACK's point of view. matrix& u = vt_; matrix& vt = u_; + std::swap(jobu, jobvt); const long m = a.nc(); const long n = a.nr(); @@ -275,6 +283,12 @@ namespace dlib else vt.set_size(1,1); + if (jobu == 'O' || jobvt == 'O') + { + DLIB_CASSERT(false, "job == 'O' not supported"); + } + + // figure out how big the workspace needs to be. T work_size = 1; int info = binding::gesvd(jobu, jobvt, m, n, &a(0,0), a.nc(),