Commit 6a9c8092 authored by Alvarez, Gonzalo's avatar Alvarez, Gonzalo
Browse files

Svd.h: do not dump matrix on failure; continue on fallback failure

parent 9db81f89
Loading
Loading
Loading
Loading
+10 −20
Original line number Diff line number Diff line
@@ -99,28 +99,18 @@ public:
		        &(iwork[0]),
		        &info);
		if (info != 0) {
			pid_t pid = getpid();
			PsimagLite::String dumpFile = "SvdFailedForThisMatrix" + ttos(pid) + ".txt";

			String str(__FILE__);
			str += " " + ttos(__LINE__);
			str += " svd(...) failed with info=" + ttos(info);
			str += " matrix is " + ttos(a.rows()) + " " + ttos(a.cols());
			str += " and dumped to file " + dumpFile + "\n";

			std::ofstream fout(dumpFile.c_str());
			fout<<a<<"\n";
			fout.close();
			sleep(2);
			if (info < 0)
				throw RuntimeError(String(__FILE__) + ": " + ttos(__LINE__) +
			                       " info= " + ttos(info));

			if (info < 0 || !canTryAgain())
				throw RuntimeError(str);

			std::cerr<<str;
			if (canTryAgain()) {
				std::cerr<<__FILE__<<": "<<__LINE__<<" info= "<<"\n";
				std::cerr<<"Will try with fallback...\n";
				name_ = "gesvd";
				operator()(jobz, a, s, vt);
			}
		}

		a = u;
	}