Made bindings more robust

--HG--
extra : convert_revision : svn%3Afdd8eb12-d10e-0410-9acb-85c331704f74/trunk%403825
This commit is contained in:
Davis King 2010-09-12 02:44:44 +00:00
parent 9446d98dbc
commit 76981f1e57
2 changed files with 24 additions and 2 deletions

View File

@ -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);

View File

@ -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<T,NR1,NC1,MM,row_major_layout>& a,
matrix<T,NR2,NC2,MM,row_major_layout>& s,
matrix<T,NR3,NC3,MM,row_major_layout>& u_,
@ -256,6 +263,7 @@ namespace dlib
// Row major order matrices are transposed from LAPACK's point of view.
matrix<T,NR3,NC3,MM,row_major_layout>& u = vt_;
matrix<T,NR4,NC4,MM,row_major_layout>& 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(),