Re: [R-pkg-devel] is Fortran write still strictly forbidden?

2024-05-09 Thread Berend Hasselman
Hi, Have a look at package nleqslv to see how you can avoid Fortran write completely. Look at the file src/nwout.c and the calls of various functions therein in the other fortran files. regards, Berend Hasselman > On 08-05-2024, at 10:37, Jisca Huisman wrote: > > Hello, &g

Re: [Rd] Fw: Calling a LAPACK subroutine from R

2019-09-12 Thread Berend Hasselman
> On 12 Sep 2019, at 10:36, Serguei Sokol wrote: > > On 11/09/2019 21:38, Berend Hasselman wrote: >> The Lapack library is loaded automatically by R itself when it needs it for >> doing some calculation. >> You can force it to do that with a (dummy) solve for ex

Re: [Rd] Calling a LAPACK subroutine from R

2019-09-12 Thread Berend Hasselman
Followup: I have checked my package nleqslv which uses dgemv only from Fortran, on Kubuntu 18.04 with the development version of R. No errors or problems. Berend > On 12 Sep 2019, at 08:57, Berend Hasselman wrote: > > > I have tried what I proposed in a virtual Kubuntu 18.0

Re: [Rd] Calling a LAPACK subroutine from R

2019-09-12 Thread Berend Hasselman
y of dgemv and changing the character parameter to integer, and > adding Jack Dongarra, Jeremy Du Croz, Sven Hammarling, and Richard Hanson as > authors of eha. And a Copyright note, all in the DESCRIPTION file. Ugly but > what can I do (except rewriting the Fortran code in C with f2c)?

Re: [Rd] Fw: Calling a LAPACK subroutine from R

2019-09-11 Thread Berend Hasselman
B.ch <- .Fortran("xdpbtrf", kUPLO=1L, N = as.integer(n), KD = 1L, AB = AB, LDAB = 2L, INFO = as.integer(0))$AB AB.ch and you are good to go. You should always do something as described above when you need to pass character arguments to Fortran code. All of th

Re: [Rd] gfortran 9 quantreg bug

2019-08-04 Thread Berend Hasselman
ngs "Possible change of value ...". This is going to be very difficult. Berend Hasselman > On 4 Aug 2019, at 08:48, Koenker, Roger W wrote: > > I’d like to solicit some advice on a debugging problem I have in the quantreg > package. > Kurt and Brian have reported

Re: [Rd] R problems with lapack with gfortran

2019-05-04 Thread Berend Hasselman
Hi, Thomas, Tomas, Doesn't this issue demonstrate the warning and advice given in the last paragraph of section 6.6 of the "Writing R Extensions" manual: Passing character strings from C to Fortran or vice versa is not portable (and to Fortran 90 or later is even less so). We have found

Re: [Rd] code for sum function

2019-02-20 Thread Berend Hasselman
<- (s-t)+xi # intermediate step needed in R otherwise cancellation z <- z+b # If sum is bigger, low-order digits of xi are lost. } else { b <- (xi-t)+s # intermediate step needed in R otherwise cancellation z <- z+b # else low-order digits of sum are lost } s <- t } s+z # correction only applied once in the very end } testx <- c(1,10^100,1,-10^100) neumaierSum(testx) gives 2 as answer. Berend Hasselman __ R-devel@r-project.org mailing list https://stat.ethz.ch/mailman/listinfo/r-devel

Re: [Rd] nlminb with constraints failing on some platforms

2019-02-06 Thread Berend Hasselman
> On 6 Feb 2019, at 10:58, Martin Maechler wrote: > . > --- > > I summarize what has been reported till: > > Failure in these cases > > 1. Kasper K ("Scientific Linux", self compiled R, using Intel's MKL >

Re: [Rd] nlminb with constraints failing on some platforms

2019-02-01 Thread Berend Hasselman
opt$par, xhat, tol=0) # good: 5.53 e-7 > [1] "Mean relative difference: 5.534757e-07" >> all.equal(opt$objective, f(xhat), tol=0) # good: 1.8 e-12 > [1] "Mean relative difference: 1.816536e-12" >> abs( opt$objective - f(xhat) ) < 1e-4 ## Must be TRUE > [1]

[Rd] Where are dggsvd3 and dggsvp3?

2017-11-13 Thread Berend Hasselman
Where are they in the R sources? Berend Hasselman __ R-devel@r-project.org mailing list https://stat.ethz.ch/mailman/listinfo/r-devel

Re: [Rd] Possible with enableJIT function

2017-06-14 Thread Berend Hasselman
> On 13 Jun 2017, at 22:05, luke-tier...@uiowa.edu wrote: > > Thanks. This should be resolved in R-devel(r72788) and R-patched > (r72789) > Also thanks. It is resolved in R-patched. Berend > Best, > > luke > > On Mon, 12 Jun 2017, Berend Hasselman wrot

[Rd] Possible with enableJIT function

2017-06-12 Thread Berend Hasselman
y used is 24495816" [1] "nleqslv iteration 7 and memory used is 24495816" [1] "nleqslv iteration 8 and memory used is 24495816" [1] "nleqslv iteration 9 and memory used is 24495816" [1] "nleqslv iteration 10 and memory used is 24495816" My questions are

Re: [Rd] precision of do_arith() in arithmetic.c

2017-05-24 Thread Berend Hasselman
> On 24 May 2017, at 04:24, M Kim wrote: > > To the R development team: > > First of all, thank you so much for maintaining wonderful R software. > > Perhaps, Dr. Ahn has just reported an error on the wilcox.test() function, > and suggesting that an error may arise from

Re: [Rd] registering Fortran routines in R packages

2017-05-10 Thread Berend Hasselman
> On 10 May 2017, at 08:48, Berend Hasselman <b...@xs4all.nl> wrote: > > Christophe, > >> On 10 May 2017, at 08:08, Christophe Dutang <duta...@gmail.com> wrote: >> >> Thanks for your email. >> >> I try to change the name in lowercase b

Re: [Rd] registering Fortran routines in R packages

2017-05-10 Thread Berend Hasselman
Christophe, > On 10 May 2017, at 08:08, Christophe Dutang wrote: > > Thanks for your email. > > I try to change the name in lowercase but it conflicts with a C > implementation also named halton. So I rename the C function halton2() and > sobol2() while the Fortran

Re: [Rd] registering Fortran routines in R packages

2017-05-09 Thread Berend Hasselman
LL, NULL, 0} > }; > > But the problem remains the same. > > Is there a way to have header file for Fortran codes? how to declare routines > defined in my Fortran file src/LowDiscrepancy.f? > lowercase routine names? manual does mention that. Berend Hasselman > An

Re: [Rd] Ancient C /Fortran code linpack error

2017-02-10 Thread Berend Hasselman
> On 10 Feb 2017, at 14:53, Göran Broström wrote: > > Thanks to all who answered my third question. I learned something, but: > > On 2017-02-09 17:44, Martin Maechler wrote: >> On 9 Feb 2017, at 16:00, Göran Broström wrote: In my

Re: [Rd] Ancient C /Fortran code linpack error

2017-02-09 Thread Berend Hasselman
o read but even faster is > > double *fj = REAL(sexp_fjac); > for (j = 0; j < *n; j++) >for (i = 0; i < *n; i++) { >if( !R_FINITE(fj[(*n)*j + i]) ) > error("non-finite value(s) returned by jacobian > (row=%d,col=%d)",

Re: [Rd] Ancient C /Fortran code linpack error

2017-02-09 Thread Berend Hasselman
EAL(sexp_fjac)[(*n)*j + i]; } There may be a more compact way with a macro in the R headers. I feel that If other code can't handle non-finite values: then test. Berend Hasselman __ R-devel@r-project.org mailing list https://stat.ethz.ch/mailman/listinfo/r-devel

Re: [Rd] BUG?: On Linux setTimeLimit() fails to propagate timeout error when it occurs (works on Windows)

2016-10-26 Thread Berend Hasselman
> On 26 Oct 2016, at 04:44, Henrik Bengtsson wrote: > ... > This looks like a bug to me. Can anyone on macOS confirm whether this > is also a problem there or not? > Tried it on macOS El Capitan and got this (running in R.app with R version 3.3.2 RC

Re: [Rd] rmultinom.c error probability not sum to 1

2016-03-10 Thread Berend Hasselman
> On 10 Mar 2016, at 21:25, m.van_iter...@lumc.nl wrote: > > Hi all, > > I should have given a better explanation of my problem. Here it is. > > I extracted from my code the bit that gives the error. Place this in a file > called test.c > > #include > #include > #include > #include >

Re: [Rd] ALLOCATE in a FORTRAN subroutine

2016-03-07 Thread Berend Hasselman
> On 7 Mar 2016, at 16:45, MAURICE Jean - externe > wrote: > > Hi Martyn, > > Many thanks for your answer. If I make it short : > we can, once we know how to do it, 'drive' R from within FORTRAN for example > to do a > Myarray = seq(0, mydimension) > in R

Re: [Rd] Return options used to configure R

2016-01-22 Thread Berend Hasselman
> On 22 Jan 2016, at 14:07, Tom Quarendon wrote: > > I did have a search, but searching for "configure" just brought up loads of > results for how to configure R. > I'm sure it is in the manual, once you know where to look for it and if you > know all the manuals

Re: [Rd] Expected error with help.search in R 3.2.0

2015-06-14 Thread Berend Hasselman
On 14-06-2015, at 06:47, David Winsemius dwinsem...@comcast.net wrote: Using the Mavericks/Yosemite version of R 3.2.0, I see this: utils::help.search(linear models) Error in help(db[i, topic], package = db[i, Package], lib.loc = lib, : 'topic' should be a name, length-one character

Re: [Rd] Problem with shared library and lapack under windows

2015-06-03 Thread Berend Hasselman
On 03-06-2015, at 09:48, bstr nicola.lunar...@hotmail.it wrote: Hi all, I have a C function, say Cfun, that calls Lapack's DGEMM routine and I need to create a shared library to use Cfun inside R. The C file is the following #includestdio.h #includeR.h #includeR_ext/Lapack.h

Re: [Rd] Building R package: “Found 'rand', possibly from 'rand' (C)” NOTE when checking package

2014-11-02 Thread Berend Hasselman
On 02-11-2014, at 12:20, January Weiner january.wei...@gmail.com wrote: I am building a package that makes a simple visualization. A part of the code is in C++, and utilizes the functions srand() and rand() for purposes not related to statistics (introducing random noise in the

Re: [Rd] Replace isnan and lgamma in Fortran subroutine in R package

2014-09-22 Thread Berend Hasselman
On 23-09-2014, at 00:33, Wang, Zhu zw...@connecticutchildrens.org wrote: Hello, I submitted a package which used Fortran functions isnan and lgamma. However, I was told that: isnan and lgamma are not Fortran 95 functions. I was asked to write 'cross-platform portable code' and so

Re: [Rd] help.start() web page contains a bad link

2014-09-18 Thread Berend Hasselman
On 18-09-2014, at 19:48, Davison, Jerry jdavi...@fhcrc.org wrote: Hi, At my work, the web page opened with the R command help.start() has a link User Manuals. Activating it gives this response: Error in vignettes[i, PDF] : subscript out of bounds Fixed in R 3.1.1 patched. Berend

[Rd] Typo in doc/html/about.html

2014-08-31 Thread Berend Hasselman
There is a typo in the file path-to-R-source/doc/html/about.html: In the line with The two languages are implemented quite differently, but bear enough superficial resemblence that users should be able to switch between the two with relative ease.” resemblence should be resemblance. Berend

Re: [Rd] dubious behaviour of match.arg() with nested functions.

2014-08-25 Thread Berend Hasselman
On 25-08-2014, at 16:27, Joris Meys jorism...@gmail.com wrote: Dear all, I initially ran into this problem while rebuilding a package dependent on nleqslv. I got the following error: Error in match.arg(global) : 'arg' must be of length 1 This didn't occur in previous versions of

[Rd] Problem running checks after building R-patched

2014-05-07 Thread Berend Hasselman
I am compiling the latest R-patched (Revision: 65533) Ubuntu Lucid (10.04). Building succeeds but make check stops with an error. The output in the terminal from make check: Testing examples for package ‘base’ Testing examples for package ‘tools’ Error: testing 'tools' failed Execution halted

Re: [Rd] Problem running checks after building R-patched

2014-05-07 Thread Berend Hasselman
On 07-05-2014, at 11:23, Martin Maechler maech...@stat.math.ethz.ch wrote: Berend Hasselman b...@xs4all.nl on Wed, 7 May 2014 09:24:46 +0200 writes: I am compiling the latest R-patched (Revision: 65533) Ubuntu Lucid (10.04). Building succeeds but make check stops with an error

Re: [Rd] Fortran BLAS giving bad results

2014-01-12 Thread Berend Hasselman
On 12-01-2014, at 08:26, Berwin A Turlach berwin.turl...@gmail.com wrote: G'day Emmanuel, On Sat, 11 Jan 2014 14:08:41 -0800 Emmanuel Sharef esha...@gmail.com wrote: Example: this program creates two double vectors, takes the dot product with ddot, and prints the result: test.f:

[Rd] Subversion log no longer being updated daily

2013-10-20 Thread Berend Hasselman
The subversion log for 2013 (http://developer.r-project.org/R_svnlog_2013) on the R developer page hasn't been updated since September 29. I would appreciate the daily updates returning. Berend Hasselman __ R-devel@r-project.org mailing list https

Re: [Rd] Subversion log no longer being updated daily

2013-10-20 Thread Berend Hasselman
On 21-10-2013, at 03:38, Simon Urbanek simon.urba...@r-project.org wrote: On Oct 20, 2013, at 2:00 AM, Berend Hasselman wrote: The subversion log for 2013 (http://developer.r-project.org/R_svnlog_2013) on the R developer page hasn't been updated since September 29. I would appreciate

Re: [Rd] Using long long types in C++

2013-09-20 Thread Berend Hasselman
On 20-09-2013, at 03:47, Eric Malitz eric.mal...@gmail.com wrote: I've been trying desperately to unsubscribe from this. Not that I don't like R; but I only wanted help and then ended up on this email list. I've put in more than one request to unsubscribe.

[Rd] Redundant text in help page for eigen

2013-08-04 Thread Berend Hasselman
I noticed that there is some redundant text in eigen.Rd (both the patched and the devel version). whereas appears to be a leftover of previous versions. \source{ By default \code{eigen} uses the LAPACK routines \code{DSYEVR}, \code{DGEEV}, \code{ZHEEV} and \code{ZGEEV} whereas LAPACK

Re: [Rd] eigen(symmetric=TRUE) for complex matrices

2013-06-19 Thread Berend Hasselman
On 19-06-2013, at 10:24, peter dalgaard pda...@gmail.com wrote: On Jun 18, 2013, at 21:49 , peter dalgaard wrote: On Jun 18, 2013, at 21:23 , Berend Hasselman wrote: So it seems that the blocked algorithm is the cause of the error and that using the (possibly slow) unblocked

Re: [Rd] eigen(symmetric=TRUE) for complex matrices

2013-06-19 Thread Berend Hasselman
On 19-06-2013, at 14:17, peter dalgaard pda...@gmail.com wrote: Thanks. I think I have it nailed down now. The culprit was indeed in our reference BLAS (I had only checked the LAPACK code), cmplxblas.f to be specific. Revision 53001 had a number of IF statements being commented out,

Re: [Rd] eigen(symmetric=TRUE) for complex matrices

2013-06-18 Thread Berend Hasselman
On 18-06-2013, at 09:57, peter dalgaard pda...@gmail.com wrote: On Jun 18, 2013, at 03:30 , robin hankin wrote: R-3.0.1 rev 62743, binary downloaded from CRAN just now; macosx 10.8.3 Hello, eigen(symmetric=TRUE) behaves strangely when given complex matrices. The following two

Re: [Rd] eigen(symmetric=TRUE) for complex matrices

2013-06-18 Thread Berend Hasselman
On 18-06-2013, at 13:23, peter dalgaard pda...@gmail.com wrote: On some further digging, on the Lion machine, the problem seems absent from builds against the veclib framework. I strongly suspect that the issue is the same as PR#14964, which also affects Hermitian matrices of dimension

Re: [Rd] RFC: a safe uniroot() function for future R

2013-06-03 Thread Berend Hasselman
On 31-05-2013, at 10:34, Martin Maechler maech...@stat.math.ethz.ch wrote: ….. From the current feedbacks, I'd come to propose / further discuss the following issues: 1) the goal is to remain with one function uniroot() 2) Instead of the 'Sig' = sign(f'(x_0)) {not quite, but typically}

Re: [Rd] Error Message while Package creation

2013-04-24 Thread Berend Hasselman
On 25-04-2013, at 07:21, Crish.. krishnaiah...@gmail.com wrote: Hello Guys, I wanted to build a new R package from the R code. I installed all the required software and made all the path settings. When i tried running, cmd RCMD check SamplePackageName while Checking R code for

[Rd] R CMD check in R-3.0.0 gives warnings

2013-03-22 Thread Berend Hasselman
I am running R CMD check on my package nleqslv with R-3.0.0 beta (2013-03-33 r62364) on Mac OS X 10.6.8 In contrast with R-2.15.3 R CMD check now issues a note for - Mercurial version control files .hgignore, .hgtags and directory .hg. These are however included in .hidden_file_exclusions. -

Re: [Rd] R CMD check in R-3.0.0 gives warnings

2013-03-22 Thread Berend Hasselman
On 22-03-2013, at 21:26, Dirk Eddelbuettel e...@debian.org wrote: On 22 March 2013 at 21:03, Berend Hasselman wrote: | I am running R CMD check on my package nleqslv with R-3.0.0 beta (2013-03-33 r62364) on Mac OS X 10.6.8 | | In contrast with R-2.15.3 R CMD check now issues a note

[Rd] qr.qy and qr.qty give an error message when y is integer and LAPACK=TRUE

2012-12-03 Thread Berend Hasselman
With this example set.seed(123) A - matrix(runif(40), nrow = 8) y - 1:nrow(A) A.laqr - qr(A, LAPACK=TRUE) both qr.qy(A.laqr,y) and qr.qty(A.laqr,y) give the respective error messages Error in qr.qy(A.laqr, y) : 'b' must be a numeric matrix Error in qr.qty(A.laqr, y) : 'b' must be a

Re: [Rd] qr.qy and qr.qty give an error message when y is integer and LAPACK=TRUE

2012-12-03 Thread Berend Hasselman
On 03-12-2012, at 16:17, Martin Maechler wrote: Berend Hasselman b...@xs4all.nl on Mon, 3 Dec 2012 15:25:21 +0100 writes: With this example set.seed(123) A - matrix(runif(40), nrow = 8) y - 1:nrow(A) A.laqr - qr(A, LAPACK=TRUE) both qr.qy(A.laqr,y) and qr.qty(A.laqr,y) give

Re: [Rd] include dll in R-package

2012-08-29 Thread Berend Hasselman
On 29-08-2012, at 05:31, LIYING HUANG wrote: Thanks a lot for those examples, is there any example with Fortran source codes which could depend on an external Fortran DLL? I wouldn't know. Berend __ R-devel@r-project.org mailing list

Re: [Rd] include dll in R-package

2012-08-28 Thread Berend Hasselman
On 28-08-2012, at 01:29, LIYING HUANG wrote: I am quite new in R, I looked at R manual- how to build R Package, still not very clear. Yes, it would be very helpful if I could download a package having Fortran source codes to look at, Do you know any package built with Fortran source

Re: [Rd] Hidden files in source packages

2012-08-27 Thread Berend Hasselman
On 27-08-2012, at 09:46, Prof Brian Ripley wrote: R-devel has been warning for some time about hidden files (in the Unix sense, starting with a period) in source packages. We could get R CMD build and the CRAN incoming scripts to remove these *if* we knew that they were never needed.

Re: [Rd] How does .Fortran dqrls work?

2012-04-27 Thread Berend Hasselman
On 27-04-2012, at 14:56, David L Lorenz wrote: Of course, what you could do is Google dqrls and get the source and documentation. That is because it is in the publically available linpack. If it were not publically available that would not work. Theoretically, all FORTRAN or C code in R

Re: [Rd] Task View on Numerical Analysis and Differential Equations

2012-03-08 Thread Berend Hasselman
On 08-03-2012, at 12:16, Hans W Borchers wrote: I am wondering if it would be time to have a new Task View, this time for the subject of Numerical Analysis and Differential Equations. The list of packages possibly appearing in such a task view is already quite long and could, for example,

Re: [Rd] Calling FORTRAN function from R issue?

2012-03-06 Thread Berend Hasselman
On 06-03-2012, at 01:21, Dominick Samperi wrote: Hello, I am trying to call the BLAS Level1 function zdotc from R via a .C call like this: #include R.h #include R_ext/BLAS.h void testzdotc() { Rcomplex zx[3], zy[3], ret_val; zx[0].r = 1.0; zx[0].i = 0.0; zx[1].r = 2.0;

Re: [Rd] Calling FORTRAN function from R issue?

2012-03-06 Thread Berend Hasselman
On 06-03-2012, at 14:37, Berwin A Turlach wrote: G'day Berend, On Tue, 6 Mar 2012 13:06:34 +0100 Berend Hasselman b...@xs4all.nl wrote: [... big snip ...] But I would really like to hear from an Rexpert why you shouldn't/can't use external here in the Fortran. Probably less

Re: [Rd] Calling FORTRAN function from R issue?

2012-03-06 Thread Berend Hasselman
On 06-03-2012, at 15:17, Prof Brian Ripley wrote: [..] used to indicate that the function/variable/symbol is defined in another compilation unit. In FORTRAN77, external is used to tell the compiler that you are passing a function to another function/subroutine. At least that is my

Re: [Rd] Calling FORTRAN function from R issue?

2012-03-06 Thread Berend Hasselman
On 06-03-2012, at 15:46, Berend Hasselman wrote: Thus, perhaps strangely, if there is only a external double complex zdotc declaration in your subroutine, the compiler doesn't know that a call The only 'strangely' thing is that is accepted: AFAICS is it not valid according

Re: [Rd] Jazzing up the Task Views index page

2012-02-21 Thread Berend Hasselman
On 21-02-2012, at 13:58, Barry Rowlingson wrote: A little while ago here we had a short discussion about Task Views - I think ignited by someone saying 'how many times do I have to say have you read the Optimisation Task View??' and I poured some fuel on that fire by saying Task Views was a