#include <gpr/linalg/ScalapackLib.h>
class ScalapackLib {
public:
// typedefs
typedef void(*)(int*, int*) Cblacs_pinfo_t;
typedef void(*)(int, int, int*) Cblacs_get_t;
typedef void(*)(int*, const char*, int, int) Cblacs_gridinit_t;
typedef void(*)(int, int*, int*, int*, int*) Cblacs_gridinfo_t;
typedef void(*)(int) Cblacs_gridexit_t;
typedef void(*)(int) Cblacs_exit_t;
typedef MPI_Comm(*)(int) Cblacs2sys_handle_t;
typedef int(*)(MPI_Comm) Csys2blacs_handle_t;
typedef void(*)(int) Cfree_blacs_system_handle_t;
typedef void(*)(int*, const int*, const int*, const int*, const int*, const int*, const int*, const int*, const int*, int*) descinit_t;
typedef int(*)(const int*, const int*, const int*, const int*, const int*) numroc_t;
typedef void(*)(int, int, const double*, int, int, const int*, double*, int, int, const int*, int) Cpdgemr2d_t;
typedef void(*)(const char*, const char*, const int*, const int*, double*, const int*, const int*, const int*, double*, double*, const int*, const int*, const int*, double*, const int*, const int*, const int*, double*, const int*, int*) pdgesvd_t;
typedef void(*)(const char*, const char*, const int*, double*, const int*, const int*, const int*, double*, double*, const int*, const int*, const int*, double*, const int*, int*) pdsyev_t;
typedef void(*)(const char*, const char*, const int*, double*, const int*, const int*, const int*, double*, double*, const int*, const int*, const int*, double*, const int*, int*, const int*, int*) pdsyevd_t;
typedef void(*)(const char*, const char*, const char*, const int*, double*, const int*, const int*, const int*, const double*, const double*, const int*, const int*, int*, int*, double*, double*, const int*, const int*, const int*, double*, const int*, int*, const int*, int*) pdsyevr_t;
typedef void(*)(const char*, const int*, double*, const int*, const int*, const int*, int*) pdpotrf_t;
typedef void(*)(const char*, const int*, double*, const int*, const int*, const int*, int*) pdpotri_t;
typedef void(*)(const char*, const char*, const int*, double*, const int*, const int*, const int*, int*) pdtrtri_t;
typedef void(*)(const char*, const char*, const char*, const char*, const int*, const int*, const double*, const double*, const int*, const int*, const int*, double*, const int*, const int*, const int*) pdtrsm_t;
typedef void(*)(const char*, const int*, const int*, const double*, const double*, const int*, const int*, const int*, const double*, const int*, const int*, const int*, const int*, const double*, double*, const int*, const int*, const int*, const int*) pdgemv_t;
typedef void(*)(const char*, const char*, const int*, const int*, const double*, const double*, const int*, const int*, const int*, const double*, double*, const int*, const int*, const int*) pdsyrk_t;
typedef void(*)(const int*, const int*, const double*, const double*, const int*, const int*, const int*, const double*, double*, const int*, const int*, const int*) pdtran_t;
// fields
Cblacs_pinfo_t Cblacs_pinfo = nullptr;
Cblacs_get_t Cblacs_get = nullptr;
Cblacs_gridinit_t Cblacs_gridinit = nullptr;
Cblacs_gridinfo_t Cblacs_gridinfo = nullptr;
Cblacs_gridexit_t Cblacs_gridexit = nullptr;
Cblacs_exit_t Cblacs_exit = nullptr;
Cblacs2sys_handle_t Cblacs2sys_handle = nullptr;
Csys2blacs_handle_t Csys2blacs_handle = nullptr;
Cfree_blacs_system_handle_t Cfree_blacs_system_handle = nullptr;
descinit_t descinit = nullptr;
numroc_t numroc = nullptr;
Cpdgemr2d_t Cpdgemr2d = nullptr;
pdgesvd_t pdgesvd = nullptr;
pdsyev_t pdsyev = nullptr;
pdsyevd_t pdsyevd = nullptr;
pdsyevr_t pdsyevr = nullptr;
pdpotrf_t pdpotrf = nullptr;
pdpotri_t pdpotri = nullptr;
pdtrtri_t pdtrtri = nullptr;
pdtrsm_t pdtrsm = nullptr;
pdgemv_t pdgemv = nullptr;
pdsyrk_t pdsyrk = nullptr;
pdtran_t pdtran = nullptr;
// methods
static ScalapackLib& instance();
bool available() const;
};