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

2012-03-06 Thread Dominick Samperi
On Tue, Mar 6, 2012 at 9:17 AM, Prof Brian Ripley wrote: > On 06/03/2012 13:37, Berwin A Turlach wrote: >> >> G'day Berend, >> >> On Tue, 6 Mar 2012 13:06:34 +0100 >> Berend Hasselman  wrote: >> >> [... big snip ...] >> >>> But I would really like to hear from an Rexpert why you >>> shouldn't/can'

Re: [Rd] Julia

2012-03-06 Thread Dominick Samperi
On Tue, Mar 6, 2012 at 11:44 AM, William Dunlap wrote: > S (and its derivatives and successors) promises that functions > will not change their arguments, so in an expression like >   val <- func(arg) > you know that arg will not be changed.  You can > do that by having func copy arg before doing

Re: [Rd] Julia

2012-03-06 Thread William Dunlap
S (and its derivatives and successors) promises that functions will not change their arguments, so in an expression like val <- func(arg) you know that arg will not be changed. You can do that by having func copy arg before doing anything, but that uses space and time that you want to conserve.

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 >>

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

2012-03-06 Thread Prof Brian Ripley
On 06/03/2012 06:28, Berwin A Turlach wrote: G'day Dominick, On Mon, 5 Mar 2012 19:21:01 -0500 Dominick Samperi wrote: ... This is consistent with the interface prototype for the BLAS routine zdotc contained in/include/R_ext/BLAS.h, namely, BLAS_extern Rcomplex F77_NAME(zdotc)(Rcomple

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

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

2012-03-06 Thread Prof Brian Ripley
On 06/03/2012 13:37, Berwin A Turlach wrote: G'day Berend, On Tue, 6 Mar 2012 13:06:34 +0100 Berend Hasselman 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 a question for an Rexpert but for

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 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 a questi

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

2012-03-06 Thread Berwin A Turlach
G'day Berend, On Tue, 6 Mar 2012 13:06:34 +0100 Berend Hasselman 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 a question for an Rexpert but for a Fortran expert If you insert "implicit

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

2012-03-06 Thread Berend Hasselman
On 06-03-2012, at 12:56, Berwin A Turlach wrote: > G'day Berend, > > [..] >> I tried calling zdotc through an intermediate Fortran routine hoping >> it would solve your problem. > [...] >> Above C routine changed to > [...] >> The fortran subroutine is >> >> >> subroutine callzdotc(retv

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

2012-03-06 Thread Berwin A Turlach
G'day Berend, On Tue, 6 Mar 2012 11:19:07 +0100 Berend Hasselman wrote: > On 06-03-2012, at 01:21, Dominick Samperi wrote: [...] > >zx[0].r = 1.0; zx[0].i = 0.0; > >zx[1].r = 2.0; zx[0].i = 0.0; > >zx[2].r = 3.0; zx[0].i = 0.0; Just noticing that it is always zx[0].i, same with the

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; >

Re: [Rd] Julia

2012-03-06 Thread oliver
On Tue, Mar 06, 2012 at 12:35:32AM +, William Dunlap wrote: [...] > I find R's (& S+'s & S's) copy-on-write-if-not-copying-would-be-discoverable- > by-the-uer machanism for giving the allusion of pass-by-value a good way > to structure the contract between the function writer and the function u

Re: [Rd] Julia

2012-03-06 Thread oliver
On Mon, Mar 05, 2012 at 07:33:10PM -0500, Duncan Murdoch wrote: > On 12-03-05 6:58 PM, Hervé Pagès wrote: > >Hi Oliver, > > > >On 03/05/2012 09:08 AM, oliver wrote: > >>On Mon, Mar 05, 2012 at 03:53:28PM +, William Dunlap wrote: > >>>I haven't used Julia yet, but from my quick reading > >>>of t

Re: [Rd] Julia

2012-03-06 Thread oliver
On Mon, Mar 05, 2012 at 04:54:05PM -0800, Nicholas Crookston wrote: > There are many experts on this topic. I'll keep this short. > > Newer Fortran Languages allow for call by value, but call by reference > is the typical and historically, the only approach (there was a time > when you could chan