convert linalg library from Fortran to C++

This commit is contained in:
Axel Kohlmeyer
2022-12-28 13:18:38 -05:00
parent 7cceabe5bd
commit c5a87f75d6
410 changed files with 80736 additions and 30 deletions

30
lib/linalg/xerbla.cpp Normal file
View File

@ -0,0 +1,30 @@
#include <exception>
#include <string>
class LinalgException : public std::exception {
std::string message;
public:
LinalgException() = delete;
explicit LinalgException(const std::string &msg) { message = msg; }
const char *what() const noexcept override { return message.c_str(); }
};
extern "C" {
#include "lmp_f2c.h"
integer xerbla_(const char *srname, integer *info)
{
std::string mesg = " ** On entry to ";
for (int i = 0; i < 1024; ++i) {
if ((srname[i] == '\0') || (srname[i] == ' ')) break;
mesg.push_back(srname[i]);
}
mesg += " parameter number " + std::to_string(*info) + " had an illegal value\n";
throw LinalgException(mesg);
return 0;
}
}