Displaying 1 result from an estimated 1 matches for "kosum".
Did you mean:
osum
2001 Feb 23
1
using the .C interface to call compiled C code
Dear People,
I have been trying to learn how to use the .C interface. A friend gave me
a toy example, and I have been playing with it. It is
(C code)
#ifdef USING_R
typedef int Sint;
#else
typedef long Sint;
#endif
void kosum(double *a, double *b, Sint *na)
{
int i, j, nab;
double temp;
nab=*na;
temp=0.0;
for(i=0;i < nab; i++)
{
temp=temp+a[i];
}
*b=temp;
}
And the calling code in R is
test1<-
function(a, b)
{
.C("kosum",
as.double(a),
b =...