| 346 | |
| 347 | template<unsigned int Precision> |
| 348 | void testsvdproblem(const ap::template_2d_array< amp::ampf<Precision> >& a, |
| 349 | int m, |
| 350 | int n, |
| 351 | amp::ampf<Precision>& materr, |
| 352 | amp::ampf<Precision>& orterr, |
| 353 | amp::ampf<Precision>& othererr, |
| 354 | bool& wsorted, |
| 355 | bool& wfailed) |
| 356 | { |
| 357 | ap::template_2d_array< amp::ampf<Precision> > u; |
| 358 | ap::template_2d_array< amp::ampf<Precision> > vt; |
| 359 | ap::template_2d_array< amp::ampf<Precision> > u2; |
| 360 | ap::template_2d_array< amp::ampf<Precision> > vt2; |
| 361 | ap::template_1d_array< amp::ampf<Precision> > w; |
| 362 | ap::template_1d_array< amp::ampf<Precision> > w2; |
| 363 | int i; |
| 364 | int j; |
| 365 | int k; |
| 366 | int ujob; |
| 367 | int vtjob; |
| 368 | int memjob; |
| 369 | int ucheck; |
| 370 | int vtcheck; |
| 371 | amp::ampf<Precision> v; |
| 372 | amp::ampf<Precision> mx; |
| 373 | |
| 374 | |
| 375 | |
| 376 | // |
| 377 | // Main SVD test |
| 378 | // |
| 379 | if( !svd::rmatrixsvd<Precision>(a, m, n, 2, 2, 2, w, u, vt) ) |
| 380 | { |
| 381 | failcount = failcount+1; |
| 382 | wfailed = true; |
| 383 | return; |
| 384 | } |
| 385 | getsvderror<Precision>(a, m, n, u, w, vt, materr, orterr, wsorted); |
| 386 | |
| 387 | // |
| 388 | // Additional SVD tests |
| 389 | // |
| 390 | for(ujob=0; ujob<=2; ujob++) |
| 391 | { |
| 392 | for(vtjob=0; vtjob<=2; vtjob++) |
| 393 | { |
| 394 | for(memjob=0; memjob<=2; memjob++) |
| 395 | { |
| 396 | if( !svd::rmatrixsvd<Precision>(a, m, n, ujob, vtjob, memjob, w2, u2, vt2) ) |
| 397 | { |
| 398 | failcount = failcount+1; |
| 399 | wfailed = true; |
| 400 | return; |
| 401 | } |
| 402 | ucheck = 0; |
| 403 | if( ujob==1 ) |
| 404 | { |
| 405 | ucheck = ap::minint(m, n); |