[Rd] dynamic array output by .C

2005-04-14 Thread Tib
Greetings,

I am building a stochastic simulation model in a C++ shared library
for R. My model will generate a random number of new observations and
also delete some old observations, however, the numbers cannot be
predicted before the computation engine runs. For simplicity, I am
trying to control my programming at the second stage (pure C++ for R).
It seems .C accepts fixed size of arrays as input (also ouput), can I
modify size of array for deleting old and adding new observations in
.C?
Thanks in advance.
-- 
I am Tib, not Rob.

__
R-devel@stat.math.ethz.ch mailing list
https://stat.ethz.ch/mailman/listinfo/r-devel


Re: [Rd] dynamic array output by .C

2005-04-14 Thread Tib
HI,
from the examples of Writing R Extensions,  I see one still has to
declare the size of arrays by NEW_NUMERIC(n) or
allocVector(REALSXP,n), how can I extend arrays?

I know this question is a little specific, but it would be a lot
helpful if anyone can give me a  quick question. Thanks


On 4/14/05, Prof Brian Ripley <[EMAIL PROTECTED]> wrote:
> On Thu, 14 Apr 2005, Tib wrote:
> 
> > Greetings,
> >
> > I am building a stochastic simulation model in a C++ shared library
> > for R. My model will generate a random number of new observations and
> > also delete some old observations, however, the numbers cannot be
> > predicted before the computation engine runs. For simplicity, I am
> > trying to control my programming at the second stage (pure C++ for R).
> > It seems .C accepts fixed size of arrays as input (also ouput), can I
> > modify size of array for deleting old and adding new observations in
> > .C?
> 
> No, but .Call can.
> 
> --
> Brian D. Ripley,  [EMAIL PROTECTED]
> Professor of Applied Statistics,  http://www.stats.ox.ac.uk/~ripley/
> University of Oxford, Tel:  +44 1865 272861 (self)
> 1 South Parks Road,     +44 1865 272866 (PA)
> Oxford OX1 3TG, UKFax:  +44 1865 272595
> 


-- 
I am Tib, not Rob.

__
R-devel@stat.math.ethz.ch mailing list
https://stat.ethz.ch/mailman/listinfo/r-devel


[Rd] could not open libRmath.so

2005-06-02 Thread Tib
Hi
I got a very tricky problem when I tried to compile a C++ program
which links to libRmath.so. The program itself had no problem, I can
compile and run in my own linux machine where I compiled libRmath.so
file and copied it to system directory (/usr/local/lib).

Now I want to compile my program at another linux box where I don't
have root privilege. That machine only has binary version of R, so I
built R from source in my own directory:
/Users/tib/R
And I also compiled libRmath.so, copied it to /Users/tib/R/bin/

Now I use this to compile my program
g++ engine.cpp -o engine -lm -lRmath -I/Users/tib/R/lib/R/include/
-L/Users/tib/R/bin/
it did not report any error, however as I executed the program
./engine
it reported:
./engine: error while loading shared libraries: libRmath.so: cannot
open shared object file: No such file or directory

Why did it report this error but compile through? Is this because the
binary R installed system wide affected the compilation? Or did I miss
anything?

Thanks,

tib


-- 
I am Tib, not Rob.

__
R-devel@stat.math.ethz.ch mailing list
https://stat.ethz.ch/mailman/listinfo/r-devel