template <class T> void ht_grappa_solve_spd_system(hoNDArray<T> *A, hoNDArray<T> *B) { /* We are swithcing off OpenMP threading before this call to posv. There seems to be a bad interaction between openmp, cuda, and BLAS. So far this problem has only been observed from *.cu files (or in functions called from *.cu files) but the problem may be more general. This is a temporary fix that we should keep an eye on. */ hoNDArray<T> A_ori; A_ori = *A; try { posv(*A, *B); } catch(...) { // it is found that if signal is very very high, the posv can throw exceptions due to ill-conditioned matrix of A // hesv does not require A to be a positive-definite matrix, but an n-by-n symmetric matrix GERROR_STREAM("ht_grappa_solve_spd_system : posv(*A, *B) throws exceptions ... "); *A = A_ori; hesv(*A, *B); GERROR_STREAM("ht_grappa_solve_spd_system : hesv(*A, *B) is called "); } }
inline int hesv (char const ul, HermA& a, IVec& i, MatrB& b, Work& w) { int const n = traits::matrix_size1 (a); assert (n == traits::matrix_size2 (a)); assert (n == traits::matrix_size1 (b)); assert (n == traits::vector_size (i)); int info; hesv (ul, n, traits::matrix_size2 (b), traits::matrix_storage (a), traits::leading_dimension (a), traits::vector_storage (i), traits::matrix_storage (b), traits::leading_dimension (b), traits::vector_storage (w), traits::vector_size (w), &info); return info; }