Re: [R] the use of the .C function

2007-10-13 Thread Charles C. Berry
On Sat, 13 Oct 2007, Bernardo Lagos Alvarez wrote: > Hi all, > > here others doubts, when load and running the function > > void gdot(double *x,double *y,int *n,double *output){ > int i; > *output=0; > for (i=0;i<*n;i++){ > *output+=x[i]*y[i]; > } > } > > > as following > > /examplesC$ R CMD SHLIB

Re: [R] the use of the .C function

2007-10-13 Thread Katharine Mullen
Let me also comment that you are trying to interface to a function ported to C++ from the Cephes library, which is in C. You have not explained why you are trying to interface to the function (is this an exercise, or do you suspect a problem with digamma()?), but if you just want access to it as i

Re: [R] the use of the .C function

2007-10-13 Thread Duncan Temple Lang
-BEGIN PGP SIGNED MESSAGE- Hash: SHA1 The code is C++ and so is compiled using the C++ compiler, not the C compiler. This is because the name of the file is .cpp (and you include iostream.h, but don't seem to make any use of it.) As a result, the names of the routines are "mangled" and s

[R] the use of the .C function

2007-10-13 Thread Bernardo Lagos Alvarez
Hi all, here others doubts, when load and running the function void gdot(double *x,double *y,int *n,double *output){ int i; *output=0; for (i=0;i<*n;i++){ *output+=x[i]*y[i]; } } as following /examplesC$ R CMD SHLIB xby.c gcc -std=gnu99 -I/usr/share/R/include -I/usr/share/R/include -fpic

[R] the use of the .C function

2007-10-13 Thread Bernardo Lagos Alvarez
Dear All, could someone please shed some light on the use of the .C or .Fortran function: I am trying load and running on R the following function // psi.cpp -- psi function for real arguments. // Algorithms and coefficient values from "Computation of Special // Functions", Zhang a