-
Notifications
You must be signed in to change notification settings - Fork 95
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Changes to address upcoming problem of #447 and USE_FC_LEN_T #496
Conversation
…hile maintaining ability to run on R >= 3.4.0 even though USE_FC_LEN_T only appeard in 3.6.2
@jarioksa This all seems to be working now on an old version of R without needing to |
Yep, this is similar as I did, but never wanted to push to vegan. There was several years ago a plan to change Fortran call in GNU fortran, but it never was done, but you can think that it may be implemented in some future version of GNU fortran and therefore R calls must be changed. Even if this would happen, it would concern cases where character string constant is used as an argument to the call, but we do not use character string constant: we use a character[2] variable. To be consistent with this scenario, the call should be changed from |
I had a closer look at this and preprocessed the source file (switch /* Definition in the header */
dgesdd_(const char* jobz,
const int *m, const int *n,
double *a, const int *lda, double *s,
double *u, const int *ldu,
double *vt, const int *ldvt,
double *work, const int *lwork, int *iwork, int *info ,size_t );
/* Call in svdfirst() in getF.c */
dgesdd_(jobz, &nr, &nc, xwork, &nr, sigma, &dummy,
&nr, &dummy, &nc, &query, &lwork, iwork, &info ,(size_t)1); The switches add char[2] jobz = "N"; That is, we pass a variable of length 2 (it must be of length 2 in C, because character strings are terminated with F77_CALL(dgesdd)("N", &nr, &nc, xwork, &nr, sigma, &dummy,
&nr, &dummy, &nc, &query, &lwork, iwork, &info FCONE); which may be more readable. In I find the the new call interface really confusing: you just add |
About backward compatibility: if
and our practice of defining |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Please see the comments in "Conversation"
Thanks Jari; have read and followed you comments. I agree with your conclusion to just leave the code alone and call with |
This (is a work-in-progress) PR that addresses the issue reported by CRAN with regard to calls to fortran code that involves strings. @jarioksa noted that we do this in
src/getF.c
with calls to LAPACK functions.The PR adds the required code that R itself uses to handle the problem, exploiting the ability to pass string lengths as hidden variables to the compiler.
Just checking that this works on an older version of R (currently checking with 3.5)