From mathieu.ribatet at epfl.ch  Fri May  9 11:45:53 2008
From: mathieu.ribatet at epfl.ch (Mathieu Ribatet)
Date: Fri, 09 May 2008 11:45:53 +0200
Subject: [Rd] Have you ever experienced this problem with REAL in a C code
Message-ID: <48241D51.4060903@epfl.ch>

    Dear all,

I'm currently experiencing big troubles with my C code called by .Call 
in a R function.

I know this may not be the right place for such things but these errors 
are driving me crazy. And I hope other people may have already 
experienced these problems so that they could give me good suggestions.
Sorry if I'm completely out of topic.

Well let's go...

I'm writing a MCMC algo for Bayesian analysis. The MCMC part is written 
in C but call R objects (e.g. output and arguments are SEXP). The C is 
called by a wrapper R function through .Call. The posterior density is 
computed using a R code that calls 2 different codes: one for the prior 
distribution and one for the likelihood. The prior distribution is fully 
written in R while the likelihood is computed using a C code. Both of 
these codes are (seem to be) ok and *always* return numeric - and no 
special values as Inf, NA,...

When I'm running my codes (enclosed you'll find the C code), I get one 
of the following error - *when error occurs*:

Error in gibbs(1000, init, prior.p, "whitmat", data = ms1, coord = 
locations,  :
  REAL() can only be applied to a 'numeric', not a 'raw'

or

Error in gibbs(1000, init, prior.p, "whitmat", data = ms1, coord = 
locations,  :
  REAL() can only be applied to a 'numeric', not a 'list'

or

Error in gibbs(1000, init, prior.p, "whitmat", data = ms1, coord = 
locations,  :
  REAL() can only be applied to a 'numeric', not an 'integer'

The problem is that REAL seems not to be applied to a list (I've got no 
list objects), and not to an integer too.
I checked for wrong allocation memory, infinite values but found nothing...

Any suggestions for possible reasons would be definitively appreciated.
Again, if this mail has no reason to be in this list; sorry and forget it.
Best,
Mathieu

-- 
Institute of Mathematics
Ecole Polytechnique F?d?rale de Lausanne
STAT-IMA-FSB-EPFL, Station 8
CH-1015 Lausanne   Switzerland
http://stat.epfl.ch/
Tel: + 41 (0)21 693 7907



[Rd] Have you ever experienced this problem with REAL in a C code
Mathieu Ribatet