1340{
1341 bool ret = true;
1342 char doit = 'A';
1343 int rows = size;
1344 int cols = size;
1345 int info;
1346 int min = (rows <= cols) ? rows : cols;
1347
1348 if (min == 0)
1349 {
1350 ERROR(
"expected a matrix with positive dimensions");
1351 return false;
1352 }
1353
1354 int max = (rows >= cols) ? rows : cols;
1355 int wsize = 4 *
min + 2 *
max;
1358
1359 double* copyA = (double*)A;
1363
1365 &doit,
1366 &rows,
1367 &cols,
1368 copyA,
1369 &rows,
1370 sigma,
1371 u,
1372 &rows,
1373 vt,
1374 &cols,
1375 workspace,
1376 &wsize,
1377 rwork,
1378 &info);
1379
1380 if (info < 0)
1381 {
1382 ERROR(
"argument passed to zgesvd had an illegal value");
1383 ret = false;
1384 }
1385 else if (info > 0)
1386 {
1387 ERROR(
"zgesvd did not converge");
1388 ret = false;
1389 }
1390 else
1391 {
1392 if (sigma[size - 1] == 0)
1393 {
1394 ERROR(
"invertible matrix expected");
1395 ret = false;
1396 }
1397 norm = 1 / sigma[size - 1];
1398 }
1399
1402
1406
1407 return ret;
1408}
int zgesvd_(char *jobU, char *jobV, int *rows, int *cols, double *A, int *ldA, double *Sigma, double *U, int *ldU, double *VT, int *ldVT, double *w, int *lwork, double *rwork, int *info)
const mpreal min(const mpreal &x, const mpreal &y)
#define newarray_atomic(T, len)