[Rd] F77_CALL(dgetrs) C++ call in R-devel

Lars Relund |@r@@re|und @end|ng |rom gm@||@com
Tue Dec 20 12:33:40 CET 2022


In my package, I have the method:

    /** Solve equations transpose(P)w = r. */
    int LASolveT(MatSimple<double> &P, MatSimple<double> &w, const
MatSimple<double> &r) {
        int rows = P.rows;
        int nrhs = 1;
        int lda = rows;
        int ldb = rows;
        int info = -1;
        MatSimple<int> ipivot(1,rows);
        w.Inject(r);    // copy r to w;
        F77_CALL(dgetrf)(&rows, &rows, &P(0,0), &lda, &ipivot(0,0), &info);
        if (info!=0) {
            cout << "Error in LASolve (dgetrf). Info=" << info << endl;
            return 1;
        }
        F77_CALL(dgetrs)("T", &rows, &nrhs, &P(0,0), &lda, &ipivot(0,0),
&w(0,0), &ldb, &info);("T", &rows, &nrhs, &P(0,0), &lda, &ipivot(0,0),
&w(0,0), &ldb, &info);
        if (info!=0) {
            cout << "Error in LASolve (dgetrs). Info=" << info << endl;
            return 1;
        }
        return 0;
    }

When compiling the package on using R-devel the error for F77_CALL(dgetrs)
occur:

matalg.h:67:25: error: too few arguments to function ‘void dgetrs_(const
char*, const int*, const int*, const double*, const int*, const int*,
double*, const int*, int*, size_t)’
   67 |         F77_CALL(dgetrs)("T", &rows, &nrhs, &P(0,0), &lda,
&ipivot(0,0), &w(0,0), &ldb, &info);

It works in R-release and I guess it have something to do with
https://cran.r-project.org/doc/manuals/r-devel/NEWS.html and LAPACK.

Any hints on how to get it to work for both R-release and R-devel.

Best
Lars Relund

	[[alternative HTML version deleted]]



More information about the R-devel mailing list