[Rcpp-devel] Fwd: problem with rmultinom function

s niani riahinaini at gmail.com
Tue May 31 14:44:20 CEST 2011


---------- Forwarded message ----------
From: s niani <riahinaini at gmail.com>
Date: Mon, May 30, 2011 at 9:20 AM
Subject: problem with rmultinom function
To: rcpp-devel at lists.r-forge.r-project.org


Hi,
I sent this message a couple of days ago, but I haven't heard anything yet.
I think you didnt receive it, that's why I send it again.

I have a strange problem that I spent several days trying to fix it, but
unfortunately I wasn't able to catch it. I'm running the rcpp code for 3000
iterations(running the same code for 3000 times) on different datasets. but
for some datasets, in the final iterations (like 2667 th iteration) the code
stops running and it jumps out of the R environment. and if I run the same
code (without any changes) on the same dataset(still without any changes)
the problem might never happen and it goes to the last iteration without any
problem(or the problem may occur in another iteration). and the interesting
part is that error code is different each time, I got error codes like:

what():  invalid partial string match
what():  'prob' is missing
what():  unused argument(s) (<environment>)
and etc...
I'm pretty sure that problem occurs in the line of code that I am using
rmultinom function, but I included the necessary function
Function rmultinom = stats["rmultinom"];

to be more clear I wrote a simple function and I attached it in this email.
in this code I didn't read any dataset, I just used some variables to define
the size of structures that I need to get from dataset. if you run the code
with these values for P, K, unum,qnum, the error occurs in the first 10
iterations, but If you change the values of those parameters to smaller
values, the error may never happen.
I tried to used an cpp implementation for rmultinom, it works but the
program would be as slow as R version.


do you have any idea why this problem occur? or did anybody ever have the
same problem or can give me some tips to fix it?

ps: all datasets are generated through the sampe process(with a single
simulation code)

Thanks
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.r-forge.r-project.org/pipermail/rcpp-devel/attachments/20110531/c5cd1773/attachment.htm>
-------------- next part --------------
A non-text attachment was scrubbed...
Name: SamplingCode.cpp
Type: text/x-c++src
Size: 1339 bytes
Desc: not available
URL: <http://lists.r-forge.r-project.org/pipermail/rcpp-devel/attachments/20110531/c5cd1773/attachment.cpp>
-------------- next part --------------
A non-text attachment was scrubbed...
Name: SamplingCode.h
Type: text/x-chdr
Size: 694 bytes
Desc: not available
URL: <http://lists.r-forge.r-project.org/pipermail/rcpp-devel/attachments/20110531/c5cd1773/attachment.h>


More information about the Rcpp-devel mailing list