Displaying 2 results from an estimated 2 matches for "convolve1".
Did you mean:
convolve
2004 Aug 04
1
load shared object
...;
for (i = 0; i < *na; i++)
for (j = 0; i < *nb; i++)
ab[i + j] += a[i] * b [j];
}
-------------------------------------------------------------------
I generated shared object with
R CMD SHLIB prova.c
i run R and so
> dyn.load("prova.so", local = TRUE, now = TRUE)
>convolve1<-function(a,b).C("convolve",as.double(a),as.integer(length(a)),as.double(b),as.integer(length(b)),ab = double(length(a) + length(b) - 1)$ab)
> a<-1:10
> b<-a
typing convolve1(a,b) i get a Segmentation fault.
Can anyone tell me what's the problem
Regards
--
Federic...
2010 Mar 11
2
Problem with rcmd SHLIB
...s hasn't happened. I have never compiled a .c file this way on this computer and there definitely aren't any .dll files as compiling hasn't ever actually worked.
Any ideas about why this is happening?
Thank you all in advance for the help and any feedback,
Best,
Denise
C code:
void convolve1(double *a, int *na,
double *b, int *nb, double *ab)
{
int i, j, nab = *na + *nb -
1;
for (i = 0; i < nab; i++) ab[i] = 0.0;
for (i = 0; i < *na; i++)
for (j = 0; j < *nb; j++)
ab[i + j] += a[i] + b[j];
}
[[alternative HTML version deleted]]