<?xml version="1.0" encoding="UTF-8"?>
<rdf:RDF xmlns:rdf="http://www.w3.org/1999/02/22-rdf-syntax-ns#" xmlns="http://purl.org/rss/1.0/" xmlns:taxo="http://purl.org/rss/1.0/modules/taxonomy/" xmlns:dc="http://purl.org/dc/elements/1.1/" xmlns:syn="http://purl.org/rss/1.0/modules/syndication/" xmlns:admin="http://webns.net/mvcb/">
  <channel rdf:about="http://blog.gmane.org/gmane.comp.lang.r.rcpp">
    <title>gmane.comp.lang.r.rcpp</title>
    <link>http://blog.gmane.org/gmane.comp.lang.r.rcpp</link>
    <description/>
    <syn:updatePeriod>hourly</syn:updatePeriod>
    <syn:updateFrequency>1</syn:updateFrequency>
    <syn:updateBase>1901-01-01T00:00+00:00</syn:updateBase>
    <items>
      <rdf:Seq>
        <rdf:li rdf:resource="http://comments.gmane.org/gmane.comp.lang.r.rcpp/3480"/>
        <rdf:li rdf:resource="http://comments.gmane.org/gmane.comp.lang.r.rcpp/3477"/>
        <rdf:li rdf:resource="http://comments.gmane.org/gmane.comp.lang.r.rcpp/3476"/>
        <rdf:li rdf:resource="http://comments.gmane.org/gmane.comp.lang.r.rcpp/3473"/>
        <rdf:li rdf:resource="http://comments.gmane.org/gmane.comp.lang.r.rcpp/3469"/>
        <rdf:li rdf:resource="http://comments.gmane.org/gmane.comp.lang.r.rcpp/3463"/>
        <rdf:li rdf:resource="http://comments.gmane.org/gmane.comp.lang.r.rcpp/3462"/>
        <rdf:li rdf:resource="http://comments.gmane.org/gmane.comp.lang.r.rcpp/3461"/>
        <rdf:li rdf:resource="http://comments.gmane.org/gmane.comp.lang.r.rcpp/3453"/>
        <rdf:li rdf:resource="http://comments.gmane.org/gmane.comp.lang.r.rcpp/3451"/>
        <rdf:li rdf:resource="http://comments.gmane.org/gmane.comp.lang.r.rcpp/3450"/>
        <rdf:li rdf:resource="http://comments.gmane.org/gmane.comp.lang.r.rcpp/3434"/>
        <rdf:li rdf:resource="http://comments.gmane.org/gmane.comp.lang.r.rcpp/3429"/>
        <rdf:li rdf:resource="http://comments.gmane.org/gmane.comp.lang.r.rcpp/3426"/>
        <rdf:li rdf:resource="http://comments.gmane.org/gmane.comp.lang.r.rcpp/3418"/>
        <rdf:li rdf:resource="http://comments.gmane.org/gmane.comp.lang.r.rcpp/3417"/>
        <rdf:li rdf:resource="http://comments.gmane.org/gmane.comp.lang.r.rcpp/3414"/>
        <rdf:li rdf:resource="http://comments.gmane.org/gmane.comp.lang.r.rcpp/3408"/>
        <rdf:li rdf:resource="http://comments.gmane.org/gmane.comp.lang.r.rcpp/3399"/>
        <rdf:li rdf:resource="http://comments.gmane.org/gmane.comp.lang.r.rcpp/3394"/>
      </rdf:Seq>
    </items>
    <image rdf:resource="http://gmane.org/img/gmane-25t.png"/>
    <textinput rdf:resource=""/>
  </channel>
  <image rdf:about="http://gmane.org/img/gmane-25t.png">
    <title>Gmane</title>
    <url>http://gmane.org/img/gmane-25t.png</url>
    <link>http://gmane.org</link>
  </image>
  <item rdf:about="http://comments.gmane.org/gmane.comp.lang.r.rcpp/3480">
    <title>Successful install of rcppbugs on Mac OS X 10.7</title>
    <link>http://comments.gmane.org/gmane.comp.lang.r.rcpp/3480</link>
    <description>&lt;pre&gt;Hi all,

Thanks for your help (Whit especially) on various things. 
After a fair bit of effort I got rccpbugs installed on my 
Mac 10.7 in R.app.  Here's my setup:

 &amp;gt; sessionInfo()
R version 2.14.1 (2011-12-22)
Platform: x86_64-apple-darwin9.8.0/x86_64 (64-bit)

locale:
[1] 
en_US.UTF-8/en_US.UTF-8/en_US.UTF-8/C/en_US.UTF-8/en_US.UTF-8

attached base packages:
[1] stats     grDevices utils     datasets  graphics 
methods   base

other attached packages:
[1] rcppbugs_0.1.0        RcppArmadillo_0.3.0.2 Rcpp_0.9.10 
           inline_0.3.8

loaded via a namespace (and not attached):
[1] compiler_2.14.1 tools_2.14.1





The basic steps:

1. Install dependencies
install.packages("Rcpp")
install.packages("inline")

2. (I updated Xcode to 3.2 and installed the Command Line 
Tools, I doubt the details of this matter though.)

3. The default compiler on Mac OS X 10.7 is gcc4.2. 
However, rcppbugs needs gcc4.6.  I got gcc4.6 to install by 
following the directions here:

http://solarianprogrammer.com/2011/12/01/compiling-gcc-4-6-2-on-mac-osx-lion/

If you want to try gcc4.7, the instructions are here, but 
Whit recommends against it for now:

http://solarianprogrammer.com/2012/02/20/living-on-the-edge-building-gcc-4-7-on-mac-osx-lion/

In my case, I installed gcc46 and the 3 dependencies in 
(root)/my_gcc rather than $HOME/my_gcc.  After installing 
the dependencies, I configured and maked the gcc46 install 
as follows:

In Terminal (not R):
========================
cd /Users/nickm/Downloads/z_installed_good/gcc47/
   502  ls
   503  gunzip -c mpc-0.9.tar.gz | tar xopf -
   504  gunzip -c mpfr-3.1.0.tar.gz | tar xopf -
   505  gunzip -c gmp-5.0.5.tar.gz | tar xopf -
   506  gunzip -c gmp-5.0.5.tar.bz2 | tar xopf -
   507  tar jxf gmp-5.0.5.tar.bz2
   508  ls
   509  cd gmp*
   510  mkdir build
   511  cd build
   514  ../configure --prefix=/my_gcc
   515  make
   516  make install
   517  cd ..
   518  cd ..
   519  cd mpfr*
   520  mkdir build
   521  cd build
   522  ../configure --prefix=/my_gcc --with-gmp=/my_gcc
   523  pwd
   524  make
   525  make install
   526  cd ..
   527  cd ..
   528  cd mpc*
   529  mkdir build
   530  cd build
   532  ../configure --prefix=/my_gcc --with-gmp=/my_gcc 
--with-mpfr=/my_gcc
   533  make
   534  make install
   535  cd ..
   536  cd ..
   537  ls
   548  cd /Users/nickm/Downloads/z_installed_good/gcc46/
   549  ls
   550  gunzip -c gcc-4.6.3.tar.gz | tar xopf -
   560  cd gcc*
   561  ls
   562  mkdir build
   563  cd build
   564  ls
   565  ../configure --prefix=/my_gcc 
--enable-checking-release --with-gmp=/my_gcc 
--with-mpfr=/my_gcc --enable-languages=c,c++,fortran 
--program-suffix=46
   566  make -j 4
   567  ls
   568  cd bin
   569  make install
   570  history
========================



4. Now we have gcc 4.6.3 installed as /my_gcc/gcc46, and 
also g++46 (R uses g++ by default), but R CMD INSTALL 
doesn't know where to find it.  Solution:

4a. First we make gcc46 the default gcc:

# g++

# Change symbolic linkage:
cd /usr/bin
rm g++; ln -s /my_gcc/bin/g++46 /usr/bin/g++


(To turn it back later, we can do this)

# Change it back
cd /usr/bin
rm g++; ln -s /usr/bin/llvm-g++-4.2 /usr/bin/g++



4b. Now when we run R CMD INSTALL, it uses the correct g++, 
but for whatever reason, with gcc 4.6 the "-arch x86_64" 
flag is not recognized, so this throws an error when you 
attempt to install.

The default settings for the command-line R CMD INSTALL (and 
R CMD SHLIB) commands are stored in something like 
$R_HOME/etc/Makeconf.  You can figure it out exactly with 
R.home:

# Return the R Home Directory
# 
http://stat.ethz.ch/R-manual/R-patched/library/base/html/Rhome.html

In R:

R.home(component="home")

# "/Library/Frameworks/R.framework/Resources"
#
# Find the Makeconf file (default Make settings)
# cd /Library/Frameworks/R.framework/Resources/etc/x86_64/
#

In my case, the Makeconf file was at:

/Library/Frameworks/R.framework/Resources/etc/x86_64/Makeconf



4c. The variables specifying the compiler are:
CXX
SHLIB_CXXLD

They can be changed from their defaults by editing Makeconf:

/Library/Frameworks/R.framework/Resources/etc/x86_64/Makeconf

Or, more easily/properly by creating a Makevars file in 
$HOME/.R/Makevars

# The Makevars file should be stored at:
# $HOME/.R/Makevars

I did the latter.


5. The Makevars file:

$Home/.R/Makevars
/Users/nickm/.R/Makevars
==============================
# THIS IS THE MANUALLY-CREATED Makevars file WHICH LETS YOU 
CUSTOMIZE
# R CMD INSTALL and R CMD SHLIB compiler flags more easily 
than you
# would by modifying the Makeconf default file directly.
#
# (On this machine, Makeconf default file is at:
# /Library/Frameworks/R.framework/Resources/etc/x86_64/Makeconf
# )
#
# The Makevars file should be stored at:
# $HOME/.R/Makevars
#
#
# default for R 2.14 on Mac OS X 10.7 is to use gcc --&amp;gt; gcc4.2
# but we want to use gcc4.6, which doesn't use the -arch 
(architecture) tags
#
# So, edit that environment variable for R CMD INSTALL and R 
CMD SHLIB
#
# CXX - the compiler for each code file
#CXX=g++ -arch x86_64
CXX=g++ -std=c++0x

# SHLIB_CXXLD - maybe this is the linker? - YEP
#SHLIB_CXXLD = g++ -arch x86_64
SHLIB_CXXLD = g++ -std=c++0x
==============================



6. Now we are ready for rcppbugs. Download and unzip the 
source from here:

http://cran.r-project.org/web/packages/rcppbugs/index.html


7. In R:

===================
# Install from source, after changing compiler to g++46 and 
modifying Makevars:
packagepath = 
"/Users/nickm/Desktop/__projects/__BayArea/_detection_probability/_RcppBUGS/rcppbugs"

libpath = "/Library/Frameworks/R.framework/Resources/library/"

install.packages(c(packagepath), libpath, NULL, 
type='source', INSTALL_opts=c("--no-multiarch"))

cmd = paste("R CMD INSTALL --preclean --no-multiarch 
--library=", libpath, " ", packagepath, sep="")

system(cmd)
===================


The --no-multiarch flag was needed because otherwise R on 
Mac OS X attempts to also compile for PPC or i386 
architecture or something, and I didn't want to figure that out.



8. Test code:

====================================
?run.model

# Example code from run.model

NR &amp;lt;- 1e2L
NC &amp;lt;- 2L
y &amp;lt;- matrix(rnorm(NR,1) + 10,nr=NR,nc=1L)
X &amp;lt;- matrix(nr=NR,nc=NC)
X[,1] &amp;lt;- 1
X[,2] &amp;lt;- y + rnorm(NR)/2 - 10

## RCppBugs Model
b &amp;lt;- mcmc.normal(rnorm(NC),mu=0,tau=0.0001)
tau.y &amp;lt;- mcmc.gamma(sd(as.vector(y)),alpha=0.1,beta=0.1)
y.hat &amp;lt;- linear(X,b)
y.lik &amp;lt;- mcmc.normal(y,mu=y.hat,tau=tau.y,observed=TRUE)
m &amp;lt;- create.model(b, tau.y, y.hat, y.lik)


runtime &amp;lt;- system.time(ans &amp;lt;- run.model(m, iterations=1e2L, 
burn=1e2L, adapt=1e3L, thin=10L))
print(get.ar(ans))

print(apply(ans[["b"]],2,mean))
====================================

Done!

Nick



PS:

STUFF THAT DIDN'T WORK, BUT WHICH MIGHT BE HANDY TO GOOGLE 
FOR OTHERS WHO HIT MY ERROR MESSAGES:



ERRORS TRYING TO COMPILE cppbugs code (the precursor of 
rcppbugs) with the wrong compilers etc.; many of these are 
the product of attempting to compile with g++4.2, although I 
never got g++4.6 or 4.7 to work either, could be the -std 
flag was wrong or something.  I got similar error messages 
with rcppbugs early on before I switched compilers.

============
(very long, see next message)
============



LEFT OUT THE --no-multiarch FLAG
=========================
install.packages(c(packagepath), 
"/Library/Frameworks/R.framework/Resources/library/", NULL, 
type='source')
* installing *source* package ‘rcppbugs’ ...
files src/Makevars, src/Makevars.win, 
src/cppbugs/cppbugs/mcmc.bernoulli.hpp, 
src/cppbugs/cppbugs/mcmc.beta.hpp, 
src/cppbugs/cppbugs/mcmc.binomial.hpp, 
src/cppbugs/cppbugs/mcmc.gamma.hpp, 
src/cppbugs/cppbugs/mcmc.model.hpp, 
src/cppbugs/cppbugs/mcmc.multivariate.normal.hpp, 
src/cppbugs/cppbugs/mcmc.normal.hpp, 
src/cppbugs/cppbugs/mcmc.stochastic.hpp, 
src/cppbugs/cppbugs/mcmc.uniform.hpp, src/r.mcmc.model.h 
have the wrong MD5 checksums
** libs
*** arch - i386
g++ -std=c++0x 
-I/Library/Frameworks/R.framework/Resources/include 
-I/Library/Frameworks/R.framework/Resources/include/i386 
-I/usr/local/include 
-I"/Library/Frameworks/R.framework/Versions/2.14/Resources/library/Rcpp/include" 
-I"/Library/Frameworks/R.framework/Versions/2.14/Resources/library/RcppArmadillo/include" 
  -I/opt/local/include -I./cppbugs  -fPIC  -g -O2 -c 
interface.cpp -o interface.o
g++ -std=c++0x 
-I/Library/Frameworks/R.framework/Resources/include 
-I/Library/Frameworks/R.framework/Resources/include/i386 
-I/usr/local/include 
-I"/Library/Frameworks/R.framework/Versions/2.14/Resources/library/Rcpp/include" 
-I"/Library/Frameworks/R.framework/Versions/2.14/Resources/library/RcppArmadillo/include" 
  -I/opt/local/include -I./cppbugs  -fPIC  -g -O2 -c 
raw.address.cpp -o raw.address.o
g++ -arch i386 -dynamiclib -Wl,-headerpad_max_install_names 
-undefined dynamic_lookup -single_module -multiply_defined 
suppress -L/usr/local/lib -o rcppbugs.so helpers.o 
interface.o raw.address.o 
/Library/Frameworks/R.framework/Versions/2.14/Resources/library/Rcpp/lib/i386/libRcpp.a 
-L/Library/Frameworks/R.framework/Resources/lib/i386 
-lRlapack 
-L/Library/Frameworks/R.framework/Resources/lib/i386 -lRblas 
-lgfortran -F/Library/Frameworks/R.framework/.. -framework R 
-Wl,-framework -Wl,CoreFoundation
g++: error: i386: No such file or directory
g++: error: unrecognized option ‘-arch’
make: *** [rcppbugs.so] Error 1
ERROR: compilation failed for package ‘rcppbugs’
* removing 
‘/Library/Frameworks/R.framework/Versions/2.14/Resources/library/rcppbugs’
Warning message:
In install.packages(c(packagepath), 
"/Library/Frameworks/R.framework/Resources/library/",  :
   installation of package 
‘/Users/nickm/Desktop/__projects/__BayArea/_detection_probability/_RcppBUGS/rcppbugs’ 
had non-zero exit status
=========================



CXX CHANGED, BUT NOT SHLIB_CXXLD:
====================
system(cmd)
* installing *source* package ‘rcppbugs’ ...
files src/Makevars, src/Makevars.win, 
src/cppbugs/cppbugs/mcmc.bernoulli.hpp, 
src/cppbugs/cppbugs/mcmc.beta.hpp, 
src/cppbugs/cppbugs/mcmc.binomial.hpp, 
src/cppbugs/cppbugs/mcmc.gamma.hpp, 
src/cppbugs/cppbugs/mcmc.model.hpp, 
src/cppbugs/cppbugs/mcmc.multivariate.normal.hpp, 
src/cppbugs/cppbugs/mcmc.normal.hpp, 
src/cppbugs/cppbugs/mcmc.stochastic.hpp, 
src/cppbugs/cppbugs/mcmc.uniform.hpp, src/r.mcmc.model.h 
have the wrong MD5 checksums
** libs
*** arch - x86_64
g++ -std=c++0x 
-I/Library/Frameworks/R.framework/Resources/include 
-I/Library/Frameworks/R.framework/Resources/include/x86_64 
-I/usr/local/include 
-I"/Library/Frameworks/R.framework/Versions/2.14/Resources/library/Rcpp/include" 
-I"/Library/Frameworks/R.framework/Versions/2.14/Resources/library/RcppArmadillo/include" 
  -I/opt/local/include -I./cppbugs  -fPIC  -g -O2 -c 
helpers.cpp -o helpers.o
g++ -std=c++0x 
-I/Library/Frameworks/R.framework/Resources/include 
-I/Library/Frameworks/R.framework/Resources/include/x86_64 
-I/usr/local/include 
-I"/Library/Frameworks/R.framework/Versions/2.14/Resources/library/Rcpp/include" 
-I"/Library/Frameworks/R.framework/Versions/2.14/Resources/library/RcppArmadillo/include" 
  -I/opt/local/include -I./cppbugs  -fPIC  -g -O2 -c 
interface.cpp -o interface.o
g++ -std=c++0x 
-I/Library/Frameworks/R.framework/Resources/include 
-I/Library/Frameworks/R.framework/Resources/include/x86_64 
-I/usr/local/include 
-I"/Library/Frameworks/R.framework/Versions/2.14/Resources/library/Rcpp/include" 
-I"/Library/Frameworks/R.framework/Versions/2.14/Resources/library/RcppArmadillo/include" 
  -I/opt/local/include -I./cppbugs  -fPIC  -g -O2 -c 
raw.address.cpp -o raw.address.o
g++ -arch x86_64 -dynamiclib 
-Wl,-headerpad_max_install_names -undefined dynamic_lookup 
-single_module -multiply_defined suppress -L/usr/local/lib 
-o rcppbugs.so helpers.o interface.o raw.address.o 
/Library/Frameworks/R.framework/Versions/2.14/Resources/library/Rcpp/lib/x86_64/libRcpp.a 
-L/Library/Frameworks/R.framework/Resources/lib/x86_64 
-lRlapack 
-L/Library/Frameworks/R.framework/Resources/lib/x86_64 
-lRblas -lgfortran -F/Library/Frameworks/R.framework/.. 
-framework R -Wl,-framework -Wl,CoreFoundation
g++: error: x86_64: No such file or directory
g++: error: unrecognized option ‘-arch’
make: *** [rcppbugs.so] Error 1
ERROR: compilation failed for package ‘rcppbugs’
* removing 
‘/Library/Frameworks/R.framework/Versions/2.14/Resources/library/rcppbugs’
====================















&lt;/pre&gt;</description>
    <dc:creator>Nick Matzke</dc:creator>
    <dc:date>2012-05-25T05:34:04</dc:date>
  </item>
  <item rdf:about="http://comments.gmane.org/gmane.comp.lang.r.rcpp/3477">
    <title>Specifying compiler to use within Rcpp</title>
    <link>http://comments.gmane.org/gmane.comp.lang.r.rcpp/3477</link>
    <description>&lt;pre&gt;Hi,

I've got Mac OS X 10.7, which still uses gcc4.2.  I can 
install a separate copy of a newer gcc (e.g. 4.7), but is 
there a way to make Rcpp (and inline) use it while compiling?

I suppose I could use a symbolic link to make gcc refer to 
gcc4.7 everywhere on my system, but that seems like an 
inflexible solution.

Any help appreciated.  Cheers!
Nick



&lt;/pre&gt;</description>
    <dc:creator>Nick Matzke</dc:creator>
    <dc:date>2012-05-24T23:34:53</dc:date>
  </item>
  <item rdf:about="http://comments.gmane.org/gmane.comp.lang.r.rcpp/3476">
    <title>Rcpp modules documentation</title>
    <link>http://comments.gmane.org/gmane.comp.lang.r.rcpp/3476</link>
    <description>&lt;pre&gt;
There had been a number of posts over the last few weeks (months?) where
folks were struggling with getting Rcpp modules going based on the examples
in the vignette.  

I just spent a few hours cleaning things up.  The gist of it is

  -- this always worked, but I often forgot to point out that loading
     a module is different when you use inline to compile/load on the fly,
     and when you use a package;

  -- both uses were in fact documented in the vignette;

  -- both uses were in fact used in the unit tests too;

but it was a little hard to get to.  Now with the cleanup:: 

  -- the unit test for Rcpp modules actually had three different modules which
     I commented a bit more, and also moved to the package created by

        Rcpp.package.skeleton("somePackageName, module=TRUE)

     to provide more direct examples

  -- I moved some things from the 'evaluate but do not show' mode of Sweave
     into full view, so the vignette should be a tad more helpful as well.


So in short, "on the fly" and via inline's cxxfunction, one can do 

     inc &amp;lt;- '
     using namespace Rcpp;
     
     double norm( double x, double y ) {
         return sqrt( x*x + y*y );
     }
     
     RCPP_MODULE(mod) {
         function( "norm", &amp;amp;norm );
     }
     '
     library(inline)
     fx &amp;lt;- cxxfunction(, plugin="Rcpp", include=inc)
     
     mod &amp;lt;- Module( "mod", getDynLib(fx) )
     mod$norm( 3, 4 )

     
where the key is to pass the object created by cxxfunction() to Module() via
the getDynLib() function.  Free functions such as 'norm' are then accessible
as member functions of the object created by Module().

In a package, things are different.  We now declare the modules we want in
DESCRIPTION, and these can be loaded for us on startup -- the
skeleton-generated package shows how.  Free functions (such as norm above)
appear directly in the namespace of the package -- so it would be norm(3,4).

For "normal" use of Rcpp modules where classes are created we have

  -- via cxxfunction the following three-step:

        mod_vec &amp;lt;- Module( "mod_vec", getDynLib(fx_vec), mustStart = TRUE )
        vec &amp;lt;- mod_vec$vec
        v &amp;lt;- new( vec )

     which a) instantiated the module via Module(), b) gets the class from
     the modules and c) call the constructor via new()

  -- via a properly-created package it is just 

        v &amp;lt;- new( vec )

     as module is instantiated at package load.

All this is in SVN on R-Forge; the Rcpp package revision is now 0.9.10.5.

And with this we should be reasonably close to a 0.9.11 release.  There is a
bit more which John Chambers contributed not so long ago --- and which is
quite exciting as it builds on this and permits extending C++ classes on fly
from the R side with new member functions --- which I should document for
both a new release and the upcoming Rcpp tutorial at useR.

Hope this helps,  Dirk

&lt;/pre&gt;</description>
    <dc:creator>Dirk Eddelbuettel</dc:creator>
    <dc:date>2012-05-24T19:44:23</dc:date>
  </item>
  <item rdf:about="http://comments.gmane.org/gmane.comp.lang.r.rcpp/3473">
    <title>What is the best way of handling default arguments.</title>
    <link>http://comments.gmane.org/gmane.comp.lang.r.rcpp/3473</link>
    <description>&lt;pre&gt;Rcpp List,

Is there a recommended way to handle default arguments for
constructors?  I have a class that I have created and exposed through
Rcpp Modules.   I now found that I need to expose a tuning parameter
and need to modify my constructors.   The standard way would be to
include just a default argument, but I didn't think that Rcpp could
handle default arguments in constructors.    Am I wrong?  Any
recommendations?

Thanks,
Andrew
&lt;/pre&gt;</description>
    <dc:creator>Andrew Redd</dc:creator>
    <dc:date>2012-05-24T18:34:20</dc:date>
  </item>
  <item rdf:about="http://comments.gmane.org/gmane.comp.lang.r.rcpp/3469">
    <title>Another rcpp package for examples</title>
    <link>http://comments.gmane.org/gmane.comp.lang.r.rcpp/3469</link>
    <description>&lt;pre&gt;Folks,

May I thank the Rcpp community for providing such a useful package.

For your records, may I let you know that the farming systems model
APSIM (www.apsim.info) is using Rcpp/RInside as a wrapper around the R
language; allowing snippets of R code to interact with apsim
simulations. http://www.apsim.info/Wiki/RComponent.ashx has a brief
outline.

Source code is available from
http://apsrunet.apsim.info/svn/apsim/trunk/Model/RLink/. There is
particular nastiness involved on windows platforms as the model is
built with MSVC, yet calls GCC code (ie Rcpp) via extern "C".

Thanks again,
Yours,
PdeV
&lt;/pre&gt;</description>
    <dc:creator>Peter deVoil</dc:creator>
    <dc:date>2012-05-23T06:09:57</dc:date>
  </item>
  <item rdf:about="http://comments.gmane.org/gmane.comp.lang.r.rcpp/3463">
    <title>Problem with RInside "hello world" example</title>
    <link>http://comments.gmane.org/gmane.comp.lang.r.rcpp/3463</link>
    <description>&lt;pre&gt;Greetings.  I'm trying to go through some of the examples in the notes from
Dirk's Rcpp Masterclass of 28 April 2011.  (I didn't take the class.  I just
found the notes on the Internet.  Please let me know if my use of them
violates some law or protocol.  In case it makes any difference, I'm not
making any money from this project.)

I've run into a problem with the RInside "hello world" example.  I can not
get it to compile on my system.  The first of the many error messages is:

    undefined reference to `RInside::RInside(int, char const* const*, bool)

I've appended the details.  I get the same error if I omit the reference to
the c++0x standard.  What am I missing?

Thanks,

&lt;/pre&gt;</description>
    <dc:creator>Michael Hannon</dc:creator>
    <dc:date>2012-05-22T07:29:43</dc:date>
  </item>
  <item rdf:about="http://comments.gmane.org/gmane.comp.lang.r.rcpp/3462">
    <title>ANN: RcppArmadillo 0.3.2.0</title>
    <link>http://comments.gmane.org/gmane.comp.lang.r.rcpp/3462</link>
    <description>&lt;pre&gt;
Conrad released a new stable version 3.2.0 of Armadillo which I wrapped into
RcppArmadillo 0.3.2.0. This version is now on CRAN.  

RcppArmadillo pre-releases do appear on R-Forge, and I did test the most
recent pre-release on a number of CRAN packages depending on RcppArmadillo to
ensure that everything still builds as usual.

The NEWS entries since 0.3.0.3 are below, summarizing the changes for the new
major release:

0.3.2.0  2012-05-21

    o   Upgraded to Armadillo release 3.2.0 "Creamfields"

      * faster eigen decomposition via "divide and conquer" algorithm
      * faster transpose of vectors and compound expressions
      * faster handling of diagonal views
      * faster handling of tiny fixed size vectors (≤ 4 elements)
      * added unique(), for finding unique elements of a matrix

0.3.1.94  2012-05-15

    o   Upgraded to Armadillo release 3.1.94 "v3.2 beta 2"

      * added unique(), for finding unique elements of a matrix
      * faster eigen decomposition via "divide and conquer" algorithm
      * faster transpose of vectors and compound expressions
      * faster handling of tiny fixed size vectors (≤ 4 elements)

0.3.1.92  2012-05-10

    o   Upgraded to Armadillo release 3.1.92 "v3.2 beta 2"

      * added unique(), for finding unique elements of a matrix
      * faster eigen decomposition via optional use of "divide and
        conquer" by eig_sym() 
      * faster transpose of vectors and compound expressions

Regards, Dirk

&lt;/pre&gt;</description>
    <dc:creator>Dirk Eddelbuettel</dc:creator>
    <dc:date>2012-05-21T17:28:21</dc:date>
  </item>
  <item rdf:about="http://comments.gmane.org/gmane.comp.lang.r.rcpp/3461">
    <title>Memory problem when compiling Rcpp/RcppEigen/lme4 withclang++</title>
    <link>http://comments.gmane.org/gmane.comp.lang.r.rcpp/3461</link>
    <description>&lt;pre&gt;I have been running into yet another memory problem in testing the
development version of lme4.  After doing the usual valgrind,
gctorture, gdb, etc. dance I found that the problem was originating in
the destructor of an Eigen object that included some cholmod
structures.  The problem was that the particular place where it was
failing is not a place where it should have gotten to.  (It should
only have called cholmod_free_factor and it was failing in
cholmod_free_dense.  Both of these are routines that are exposed
through the funky R_GetCCallable function in
RcppEigen/inst/include/RcppEigenStubs.h).  The problem went away when
I switched to g++.  For the time being I would recommend caution if
you choose to use clang++ to compile code linking to RcppEigen.
&lt;/pre&gt;</description>
    <dc:creator>Douglas Bates</dc:creator>
    <dc:date>2012-05-16T19:31:57</dc:date>
  </item>
  <item rdf:about="http://comments.gmane.org/gmane.comp.lang.r.rcpp/3453">
    <title>Rostream.h header</title>
    <link>http://comments.gmane.org/gmane.comp.lang.r.rcpp/3453</link>
    <description>&lt;pre&gt;Dear Rcpp developers,

ATM to define the Rcpp::Rostream I have to fix the iostream/Rostream.h
header directly and add

#include "Rstreambuf.h"

before its declarations.

Including "Rstreambuf.h" in my source file before "Rstreambuf.h" doesn't
help,
it seems the headers are processed in a way that Rostream declaration comes
before Rstreambuf
(due to RcppCommon.h that is included by Rstreambuf.h and not by
Rostream.h).

Is it possible to fix Rostream.h in the mainline or there's another proper
way to include it?

Thank you,
   Alexey
_______________________________________________
Rcpp-devel mailing list
Rcpp-devel-Z+qqJ2/841dDXCDGMXqaGq2UG9VpUWMKQH7oEaQurus&amp;lt; at &amp;gt;public.gmane.org
https://lists.r-forge.r-project.org/cgi-bin/mailman/listinfo/rcpp-devel&lt;/pre&gt;</description>
    <dc:creator>Alexey Stukalov</dc:creator>
    <dc:date>2012-05-12T17:03:39</dc:date>
  </item>
  <item rdf:about="http://comments.gmane.org/gmane.comp.lang.r.rcpp/3451">
    <title>translate an R vectorized loop with three logicalconditions to C++</title>
    <link>http://comments.gmane.org/gmane.comp.lang.r.rcpp/3451</link>
    <description>&lt;pre&gt;I am new to this list, so I hope this is the right place to ask this 
question. I am trying to translate the R vectorized loop below to C++ in 
order to speed up my calculations:

Let:
 &amp;gt; n1
  [1] 1 1 2 2 2 3 3 4 4 4 5 5 5 5 6 6 6 7 7 8 8 8 9 9
 &amp;gt; n2
  [1] 2 4 1 3 5 2 6 1 5 7 2 4 6 8 3 5 9 4 8 5 7 9 6 8
 &amp;gt; w1w1
  [1] 0.2500000 0.2500000 0.1111111 0.1111111 0.1111111 0.2500000 0.2500000
  [8] 0.1111111 0.1111111 0.1111111 0.0625000 0.0625000 0.0625000 0.0625000
[15] 0.1111111 0.1111111 0.1111111 0.2500000 0.2500000 0.1111111 0.1111111
[22] 0.1111111 0.2500000 0.2500000

My vectorized loop is:

     tWSWS.k &amp;lt;- lapply(c(1:length(n1)), function(.n1){
       lapply(c(1:length(n2)), function(.n2){
         if(.n1!=.n2){
          w1w1[n1==.n1 &amp;amp; n2==.n2]
        }})})

result=sum(unlist(tWSWS.k))

Could you help me with this translation or at least point me out to some 
reference/example?

Thanks!

Nelson

&lt;/pre&gt;</description>
    <dc:creator>Nelson Villoria</dc:creator>
    <dc:date>2012-05-11T13:06:20</dc:date>
  </item>
  <item rdf:about="http://comments.gmane.org/gmane.comp.lang.r.rcpp/3450">
    <title>RcppArmadillo 0.3.1.92 on R-Forge</title>
    <link>http://comments.gmane.org/gmane.comp.lang.r.rcpp/3450</link>
    <description>&lt;pre&gt;
Conrad never rests, and has a first Armadillo test release 3.1.92 out en
route to a new Armadillo version 3.2.0.

I have wrapped this into RcppArmadillo 0.3.1.92. As the CRAN maintainers are
trying to throttle uploads down a little, I will not push it to CRAN.  

But for those who are interested in trying the newest version, you should get
it (once R-Forge builds tarballs from it, say tomorrow) via

  install.packages("RcppArmadillo", repos="http://R-Forge.R-project.org")

and you can of course also always do an 'svn up' to fetch it.

Cheers, Dirk

&lt;/pre&gt;</description>
    <dc:creator>Dirk Eddelbuettel</dc:creator>
    <dc:date>2012-05-10T13:45:32</dc:date>
  </item>
  <item rdf:about="http://comments.gmane.org/gmane.comp.lang.r.rcpp/3434">
    <title>type information about elements in Rcpp::List</title>
    <link>http://comments.gmane.org/gmane.comp.lang.r.rcpp/3434</link>
    <description>&lt;pre&gt;Hi,

Thank Dirk first for replying to my previous questions so fast.

Another question:

Suppose I have a function in CPP as

void cppfun(Rcpp::List lst) {
    ......
}

Then I would like to call this cppfun in R code as say
cppfun(list(a=a, b=b, c=c, ...)), in which
a, b, c could be of different types and their type might be different as
this
function gets called another time.  So I would like to know the type of a,
b, c
in the CPP code.  Could someone help me out or point to me some other
approaches?  Thanks.

Best,
Jiqiang
_______________________________________________
Rcpp-devel mailing list
Rcpp-devel-Z+qqJ2/841dDXCDGMXqaGq2UG9VpUWMKQH7oEaQurus&amp;lt; at &amp;gt;public.gmane.org
https://lists.r-forge.r-project.org/cgi-bin/mailman/listinfo/rcpp-devel&lt;/pre&gt;</description>
    <dc:creator>Jiqiang Guo</dc:creator>
    <dc:date>2012-05-09T03:17:12</dc:date>
  </item>
  <item rdf:about="http://comments.gmane.org/gmane.comp.lang.r.rcpp/3429">
    <title>help packaging Rcpp modules</title>
    <link>http://comments.gmane.org/gmane.comp.lang.r.rcpp/3429</link>
    <description>&lt;pre&gt;I have followed the Rcpp developer's recommendation that a package
greatly simplifies using RCPP_MODULE wrappering. Unfortunately, I'm
having difficulty building and checking even a simple package
containing an Rcpp module. I have read previous posts on this topic
but I did not find anything helpful. I must be overlooking something
very simple, please help.

The package check fails with this error:
** testing if installed package can be loaded
Error : .onLoad failed in loadNamespace() for 'mod', details:
   call: value[[3L]](cond)
   error: failed to load module mod from package mod
no binding for "norm"

The package skeleton was created with Rcpp.package.skeleton() to which
I added a C++ source file and then edited files according to the
'Read-and-delete-me' file.

Here are my build and check steps:

$ R CMD build mod
* checking for file `mod/DESCRIPTION' ... OK
* preparing `mod':
* checking DESCRIPTION meta-information ... OK
* cleaning src
* checking for LF line-endings in source and make files
* checking for empty or unneeded directories
* building `mod_1.0.tar.gz'

$ R CMD check mod
* using log directory '/home/simone/R/Rcpp/module/mod.Rcheck'
* using R version 2.13.1 (2011-07-08)
* using platform: x86_64-pc-linux-gnu (64-bit)
* using session charset: UTF-8
* checking for file 'mod/DESCRIPTION' ... OK
* checking extension type ... Package
* this is package 'mod' version '1.0'
* checking package name space information ... OK
* checking package dependencies ... OK
* checking if this is a source package ... OK
* checking for executable files ... OK
* checking whether package 'mod' can be installed ... ERROR
Installation failed.

The package skeleton was created with Rcpp.package.skeleton().

Here is the module directory structure:
$ /bin/ls -R mod
mod:
DESCRIPTION  man  NAMESPACE  R  Read-and-delete-me  src

mod/man:
mod-package.Rd

mod/R:
zzz.R

mod/src:
Makevars  Makevars.win  rcpp_module.cpp

Here are the key files:

$ cat mod/NAMESPACE
useDynLib(mod)
exportPattern("^[[:alpha:]]+")
import( Rcpp )

$ cat mod/R/zzz.R

.onLoad &amp;lt;- function(libname, pkgname) {
     require("methods", character=TRUE, quietly=FALSE)
     loadRcppModules()
}

$ cat mod/src/rcpp_module.cpp
#include &amp;lt;math.h&amp;gt;
#include &amp;lt;Rcpp.h&amp;gt;

double norm( double x, double y ) {
   return sqrt( x*x + y*y );
}

RCPP_MODULE(mod) {
   using namespace Rcpp;
   function( "norm", &amp;amp;norm );
}
&lt;/pre&gt;</description>
    <dc:creator>James Simone</dc:creator>
    <dc:date>2012-05-08T22:51:44</dc:date>
  </item>
  <item rdf:about="http://comments.gmane.org/gmane.comp.lang.r.rcpp/3426">
    <title>Compilation error using Rcpp::as&lt;Eigen::MatrixXd&gt;</title>
    <link>http://comments.gmane.org/gmane.comp.lang.r.rcpp/3426</link>
    <description>&lt;pre&gt;Hi all,

I've been happily using the RcppEigen package for a couple of
projects, but now I'm running into problems converting a matrix from R
into an Eigen::MatrixXd. Converting an R matrix to an
Eigen::Map&amp;lt;Eigen::MatrixXd&amp;gt; works fine, but I would like to (deep)copy
the values from R to a C++ Eigen::MatrixXd object. From the definition
for the Exporter for Eigen::Matrix&amp;lt;T, Eigen::Dynamic, Eigen::Dynamic&amp;gt;
in RcppEigen/inst/include/RcppEigenWrap.h, it looks like
Rcpp::as&amp;lt;Eigen::MatrixXd&amp;gt; could be used, but when compiling some
example code (see below) I get an error (see below). Compiling the
same code with an arma::mat or with Eigen::Map&amp;lt;Eigen::MatrixXd&amp;gt; does
not result in any errors.

Does anyone have an idea what is causing this?

Many thanks in advance and best wishes,
Jelmer


R version 2.15.0 (2012-03-30)
Platform: i386-pc-mingw32/i386 (32-bit)

locale:
[1] LC_COLLATE=English_United Kingdom.1252  LC_CTYPE=English_United
Kingdom.1252    LC_MONETARY=English_United Kingdom.1252 LC_NUMERIC=C
[5] LC_TIME=English_United Kingdom.1252

attached base packages:
[1] stats     graphics  grDevices utils     datasets  methods   base

other attached packages:
[1] inline_0.3.8          RcppArmadillo_0.3.0.3 RcppEigen_0.2.0
Rcpp_0.9.10

loaded via a namespace (and not attached):
[1] grid_2.15.0    lattice_0.20-6 Matrix_1.0-6   tools_2.15.0



The error I get, is:

In file included from c:/tools/R/library/RcppEigen/include/Eigen/Core:282:0,
                 from c:/tools/R/library/RcppEigen/include/Eigen/Dense:1,
                 from
c:/tools/R/library/RcppEigen/include/RcppEigenForward.h:29,
                 from c:/tools/R/library/RcppEigen/include/RcppEigen.h:25,
                 from file160c52054c0.cpp:3:
c:/tools/R/library/RcppEigen/include/Eigen/src/Core/DenseCoeffsBase.h:
In member function 'Eigen::DenseCoeffsBase&amp;lt;Derived, 1&amp;gt;::Scalar&amp;amp;
Eigen::DenseCoeffsBase&amp;lt;Derived,
1&amp;gt;::operator[](Eigen::DenseCoeffsBase&amp;lt;Derived, 1&amp;gt;::Index) [with
Derived = Eigen::Matrix&amp;lt;double, -0x00000000000000001,
-0x00000000000000001&amp;gt;, Eigen::DenseCoeffsBase&amp;lt;Derived, 1&amp;gt;::Scalar =
double, Eigen::DenseCoeffsBase&amp;lt;Derived, 1&amp;gt;::Index = int]':
c:/tools/R/library/Rcpp/include/Rcpp/internal/export.h:89:3:
instantiated from 'void Rcpp::internal::export_indexing__impl(SEXP,
T&amp;amp;, Rcpp::traits::false_type) [with T = Eigen::Matrix&amp;lt;double,
-0x00000000000000001, -0x00000000000000001&amp;gt;, value_type = double, SEXP
= SEXPREC*, Rcpp::traits::false_type =
Rcpp::traits::integral_constant&amp;lt;bool, false&amp;gt;]'
c:/tools/R/library/Rcpp/include/Rcpp/internal/export.h:109:6:
instantiated from 'void
Rcpp::internal::export_indexing__dispatch(SEXP, T&amp;amp;,
Rcpp::traits::r_type_primitive_tag) [with T = Eigen::Matrix&amp;lt;double,
-0x00000000000000001, -0x00000000000000001&amp;gt;, value_type = double, SEXP
= SEXPREC*]'
c:/tools/R/library/Rcpp/include/Rcpp/internal/export.h:127:6:
instantiated from 'void Rcpp::internal::export_indexing(SEXP, T&amp;amp;)
[with T = Eigen::Matrix&amp;lt;double, -0x00000000000000001,
-0x00000000000000001&amp;gt;, value_type = double, SEXP = SEXPREC*]'
c:/tools/R/library/Rcpp/include/Rcpp/traits/Exporter.h:86:17:
instantiated from 'T Rcpp::traits::MatrixExporter&amp;lt;T,
value_type&amp;gt;::get() [with T = Eigen::Matrix&amp;lt;double,
-0x00000000000000001, -0x00000000000000001&amp;gt;, value_type = double]'
c:/tools/R/library/Rcpp/include/Rcpp/as.h:53:33:   instantiated from
'T Rcpp::internal::as(SEXP, Rcpp::traits::r_type_generic_tag) [with T
= Eigen::Matrix&amp;lt;double, -0x00000000000000001, -0x00000000000000001&amp;gt;,
SEXP = SEXPREC*]'
c:/tools/R/library/Rcpp/include/Rcpp/as.h:75:89:   instantiated from
'T Rcpp::as(SEXP) [with T = Eigen::Matrix&amp;lt;double,
-0x00000000000000001, -0x00000000000000001&amp;gt;, SEXP = SEXPREC*]'
file160c52054c0.cpp:31:40:   instantiated from here
c:/tools/R/library/RcppEigen/include/Eigen/src/Core/DenseCoeffsBase.h:388:7:
error: 'THE_BRACKET_OPERATOR_IS_ONLY_FOR_VECTORS__USE_THE_PARENTHESIS_OPERATOR_INSTEAD'
is not a member of 'Eigen::internal::static_assertion&amp;lt;false&amp;gt;'
make: *** [file160c52054c0.o] Error 1

ERROR(s) during compilation: source code errors or compiler
configuration errors!


The code I used for the example is:

library('RcppEigen')
library('RcppArmadillo')
library('inline')

# Define C++ some function that uses a matrix as input.
# MatrixType will be defined using a typedef in includes,
# when compiling the function below.
# MatrixType will take on values
#   * arma::mat
#   * Eigen::MatrixXd
#   * Eigen::Map&amp;lt;Eigen::MatrixXd&amp;gt;
printMatrix_code &amp;lt;- '
MatrixType _A( Rcpp::as&amp;lt;MatrixType&amp;gt;( A ) );

Rcpp::Rcout &amp;lt;&amp;lt; "_A: " &amp;lt;&amp;lt; std::endl &amp;lt;&amp;lt; _A &amp;lt;&amp;lt; std::endl;

return R_NilValue;
'

# Define some matrix A
set.seed( 3141 )
A &amp;lt;- matrix( rnorm( 10 ), nrow=5, ncol=2 )
A

# Compile using MatrixType = arma::mat
# (WORKS)
try( {
printArmaMatrix &amp;lt;- cxxfunction(
    signature(A="matrix"),
    printMatrix_code,
    plugin="RcppArmadillo",
    includes = 'typedef arma::mat MatrixType;',
    verbose=TRUE )

printArmaMatrix( A )
} )

# Compile using MatrixType = Eigen::MatrixXd
# (FAILS)
try( {
printEigenMatrix &amp;lt;- cxxfunction(
    signature(A="matrix"),
    printMatrix_code,
    plugin="RcppEigen",
    includes = 'typedef Eigen::MatrixXd MatrixType;',
    verbose=TRUE )

printEigenMatrix( A )
} )

# Compile using MatrixType = Eigen::Map&amp;lt;Eigen::MatrixXd&amp;gt;
# (WORKS)
try( {
printEigenMappedMatrix &amp;lt;- cxxfunction(
    signature(A="matrix"),
    printMatrix_code,
    plugin="RcppEigen",
    includes = 'typedef Eigen::Map&amp;lt;Eigen::MatrixXd&amp;gt; MatrixType;',
    verbose=TRUE )

printEigenMappedMatrix( A )
} )
&lt;/pre&gt;</description>
    <dc:creator>Jelmer Ypma</dc:creator>
    <dc:date>2012-05-08T15:45:34</dc:date>
  </item>
  <item rdf:about="http://comments.gmane.org/gmane.comp.lang.r.rcpp/3418">
    <title>Compiling Rcpp on windows platforms</title>
    <link>http://comments.gmane.org/gmane.comp.lang.r.rcpp/3418</link>
    <description>&lt;pre&gt;Dear list,

I've noticed a small thing when compiling a .cpp file on windows. Following the Rcpp FAQ document I do

C:\Documents\teaching\2012-ASC\presentations\callingC&amp;gt;Rscript -e "Rcpp:::SHLIB('matprod5.cpp')"
------------------------------------
  Sørens .Rprofile in c:/Documents
------------------------------------
Working directory is:  C:/Documents/teaching/2012-ASC/presentations/callingC
Calling .First() in .Rprofile
exiting .First()
g++ -m64 -shared -s -static-libgcc -o matprod5.dll tmp.def matprod5.o ------------------------------------ S▒rens .Rprofile in c:/Documents -------------------------
----------- Working directory is: C:/Documents/teaching/2012-ASC/presentations/callingC Calling .First() in .Rprofile exiting .First() C:/programs/R/current/library/
Rcpp/lib/x64/libRcpp.aCalling .Last() in .Rprofile -Ld:/RCompile/CRANpkg/extralibs64/local/lib/x64 -Ld:/RCompile/CRANpkg/extralibs64/local/lib -LC:/programs/R/curren
t/bin/x64 -lR
g++.exe: error: S?rens: Invalid argument
g++.exe: error: .Rprofile: No such file or directory
g++.exe: error: in: No such file or directory
... bla bla bla ...

This is due to a .First() function etc. in my .Rprofile. I then try to use --vanilla with a similar result

C:\Documents\teaching\2012-ASC\presentations\callingC&amp;gt;Rscript --vanilla -e "Rcpp:::SHLIB('matprod5.cpp')"
g++ -m64 -shared -s -static-libgcc -o matprod5.dll tmp.def matprod5.o ------------------------------------ S▒rens .Rprofile in c:/Documents -------------------------
----------- Working directory is: C:/Documents/teaching/2012-ASC/presentations/callingC Calling .First() in .Rprofile exiting .First() C:/programs/R/current/library/
Rcpp/lib/x64/libRcpp.aCalling .Last() in .Rprofile -Ld:/RCompile/CRANpkg/extralibs64/local/lib/x64 -Ld:/RCompile/CRANpkg/extralibs64/local/lib -LC:/programs/R/curren
t/bin/x64 -lR
g++.exe: error: S?rens: Invalid argument
g++.exe: error: .Rprofile: No such file or directory
g++.exe: error: in: No such file or directory
....

I would have thought that the --vanilla option would make things work. Am I overlooking something or is that a bug??
(If I remove the .First() function etc. from my .Rprofile then everything works fine. )

The other option mentioned in the FAQ is to do:
R --vanilla CMD SHLIB matprod5.cpp

- and that works fine (it doesn't if I omit --vanilla). This works because I have created a Makevars file with the lines:

PKG_LIBS=`Rscript -e "Rcpp:::LdFlags()"`
PKG_CXXFLAGS=`Rscript -e "Rcpp:::CxxFlags()"`

According to the FAQ, each line should start with 'export' but that is a *nix command, not a windows command. Perhaps it would be worthwhile mentioning this in the faq.

Best regards
Søren


_______________________________________________
Rcpp-devel mailing list
Rcpp-devel&amp;lt; at &amp;gt;lists.r-forge.r-project.org
https://lists.r-forge.r-project.org/cgi-bin/mailman/listinfo/rcpp-devel&lt;/pre&gt;</description>
    <dc:creator>Søren Højsgaard</dc:creator>
    <dc:date>2012-05-07T23:25:26</dc:date>
  </item>
  <item rdf:about="http://comments.gmane.org/gmane.comp.lang.r.rcpp/3417">
    <title>examples on Extending Rcpp::as</title>
    <link>http://comments.gmane.org/gmane.comp.lang.r.rcpp/3417</link>
    <description>&lt;pre&gt;Hi,

From
http://cran.r-project.org/web/packages/Rcpp/vignettes/Rcpp-extending.pdf,
we know that we could extend as.  I would like to create an user-defined
class
instance from an SEXP (say a list in R).  Where could I find more examples
on
this usage?

Thanks,
Jiqiang
_______________________________________________
Rcpp-devel mailing list
Rcpp-devel-Z+qqJ2/841dDXCDGMXqaGq2UG9VpUWMKQH7oEaQurus&amp;lt; at &amp;gt;public.gmane.org
https://lists.r-forge.r-project.org/cgi-bin/mailman/listinfo/rcpp-devel&lt;/pre&gt;</description>
    <dc:creator>Jiqiang Guo</dc:creator>
    <dc:date>2012-05-07T22:23:39</dc:date>
  </item>
  <item rdf:about="http://comments.gmane.org/gmane.comp.lang.r.rcpp/3414">
    <title>qtdensity example build problem</title>
    <link>http://comments.gmane.org/gmane.comp.lang.r.rcpp/3414</link>
    <description>&lt;pre&gt;I'm trying to build the qtdensity example which comes with RInside, using Qt Creator and the qtdensity.pro file included, but my build fails because g++ can't find libRInside.a. Running Rscript on command line shows that RInside:::LdFlags() does not return the full path, as it is doing for Rcpp, hence the error:

-I/Library/Frameworks/R.framework/Versions/2.15/Resources/library/Rcpp/include

/Library/Frameworks/R.framework/Versions/2.15/Resources/library/Rcpp/lib/x86_64/libRcpp.a

-I/Library/Frameworks/R.framework/Versions/2.15/Resources/library/RInside/include

/libRInside.a

(RInside 0.2.6, OS 10.6.8). Have I missed something obvious here? The only thing I can think of is that it's an architecture issue, as there is no .../RInside/lib/x86_64/libRInside.a file.

Thanks.
jc (Melbourne)



_______________________________________________
Rcpp-devel mailing list
Rcpp-devel-Z+qqJ2/841dDXCDGMXqaGq2UG9VpUWMKQH7oEaQurus&amp;lt; at &amp;gt;public.gmane.org
https://lists.r-forge.r-project.org/cgi-bin/mailman/listinfo/rcpp-devel&lt;/pre&gt;</description>
    <dc:creator>Jarny Choi</dc:creator>
    <dc:date>2012-05-07T13:26:39</dc:date>
  </item>
  <item rdf:about="http://comments.gmane.org/gmane.comp.lang.r.rcpp/3408">
    <title>RcppArmadillo solve function, dyn.load error</title>
    <link>http://comments.gmane.org/gmane.comp.lang.r.rcpp/3408</link>
    <description>&lt;pre&gt;Hi all,

I'm a student at the University of Washington and my course project this
spring involves rewriting the 'svmpath' R package into C++ using Rcpp and
RccpArmadillo.  Everything runs beautifully until I try to include the
function below:

vec solveKstar(mat Kstar){
  vec onestar = ones&amp;lt;vec&amp;gt;(Kstar.n_cols);

onestar[0]=0;

  vec
solution;

  solution=solve(trimatu(Kstar),onestar);
  return solution;
}

If I run R CMD INSTALL on my package removing the call to 'solve'
everything runs fine, but if I included the call to 'solve' then the R CMD
INSTALL input is


// all the typical output

* installing to library ‘/net/home/aynlc3/Rlib’
* installing *source* package ‘aynSVMpath’ ...
** libs
g++ -I/usr/share/R/include -DNDEBUG
-I"/net/home/aynlc3/Rlib/Rcpp/include"
-I"/net/home/aynlc3/Rlib/RcppArmadillo/include"   -fpic  -O3 -pipe  -g  -c
aynSVMpath.cpp -o aynSVMpath.o
g++ -I/usr/share/R/include -DNDEBUG
-I"/net/home/aynlc3/Rlib/Rcpp/include"
-I"/net/home/aynlc3/Rlib/RcppArmadillo/include"   -fpic  -O3 -pipe  -g  -c
svmHelpers.cpp -o svmHelpers.o
g++ -shared -o aynSVMpath.so aynSVMpath.o initializations.o svmHelpers.o
usetFunctions.o -L/net/home/aynlc3/Rlib/Rcpp/lib -lRcpp
-Wl,-rpath,/net/home/aynlc3/Rlib/Rcpp/lib -L/usr/lib/R/lib -lR
installing to /net/home/aynlc3/Rlib/aynSVMpath/libs
** R
** preparing package for lazy loading
** help
*** installing help indices
** building package indices
** testing if installed package can be loaded

           // then

Error in dyn.load(file, DLLpath = DLLpath, ...) :
  unable to load shared object
'/net/home/aynlc3/Rlib/aynSVMpath/libs/aynSVMpath.so':
  /net/home/aynlc3/Rlib/aynSVMpath/libs/aynSVMpath.so: undefined symbol:
dtrtrs_


If I change 3rd and 4th lines of the 'solveKstar' function to:

  vec
solution;

  solution=solve(Kstar,onestar);    // removing the call to 'trimatu'

the R CMD INSTALL output has the same typical output above, but with the
following change to the error

Error in dyn.load(file, DLLpath = DLLpath, ...) :
  unable to load shared object
'/net/home/aynlc3/Rlib/aynSVMpath/libs/aynSVMpath.so':
  /net/home/aynlc3/Rlib/aynSVMpath/libs/aynSVMpath.so: undefined symbol:
dgels_


The symbols 'dtrtrs_' and 'dgels_' are not part of my code;  from digging
online, I believe these are coming from the lapack library, but I'm not
sure how to proceed with that knowledge.  Does anyone have any advice?

 Also, if relevant, I'm running R 2.15.0, Rcpp_0.9.10 and
RcppArmadillo_0.3.0.2 on mosix.

Many thanks,

Ayn
_______________________________________________
Rcpp-devel mailing list
Rcpp-devel-Z+qqJ2/841dDXCDGMXqaGq2UG9VpUWMKQH7oEaQurus&amp;lt; at &amp;gt;public.gmane.org
https://lists.r-forge.r-project.org/cgi-bin/mailman/listinfo/rcpp-devel&lt;/pre&gt;</description>
    <dc:creator>Ayn Leslie-Cook</dc:creator>
    <dc:date>2012-05-06T21:38:58</dc:date>
  </item>
  <item rdf:about="http://comments.gmane.org/gmane.comp.lang.r.rcpp/3399">
    <title>segfault for simple Rcpp module</title>
    <link>http://comments.gmane.org/gmane.comp.lang.r.rcpp/3399</link>
    <description>&lt;pre&gt;I was learning Rcpp and got the following problem in a basic example.
I have searched online and knew someone have the same problem before,
but did not find a good answer for this.

Simply put, I am running the following script:

rm -rf rcppapp1
R -q -e "library(Rcpp); Rcpp.package.skeleton(name = 'rcppapp1', module =
TRUE);sessionInfo()"
R CMD build rcppapp1
R CMD INSTALL rcppapp1
R -q -e "require(Rcpp);require('rcppapp1');m1&amp;lt;-Module('yada',
'rcppapp1');m1\$hello()"


But I could not run the hello function defined in the model yada.
Here is the output:

+ rm -rf rcppapp1
+ R -q -e 'library(Rcpp); Rcpp.package.skeleton(name = '\''rcppapp1'\'',
module = TRUE);sessionInfo()'
TRUE);sessionInfo()
Creating directories ...
Creating DESCRIPTION ...
Creating NAMESPACE ...
Creating Read-and-delete-me ...
Saving functions and data ...
Making help files ...
Done.
Further steps are described in './rcppapp1/Read-and-delete-me'.

Adding Rcpp settings
 &amp;gt;&amp;gt; added RcppModules: yada
 &amp;gt;&amp;gt; added Depends: Rcpp
 &amp;gt;&amp;gt; added LinkingTo: Rcpp
 &amp;gt;&amp;gt; added useDynLib directive to NAMESPACE
 &amp;gt;&amp;gt; added Makevars file with Rcpp settings
 &amp;gt;&amp;gt; added Makevars.win file with Rcpp settings
 &amp;gt;&amp;gt; added example header file using Rcpp classes
 &amp;gt;&amp;gt; added example src file using Rcpp classes
 &amp;gt;&amp;gt; added example R file calling the C++ example
 &amp;gt;&amp;gt; added Rd file for rcpp_hello_world
 &amp;gt;&amp;gt; copied the example module
R version 2.15.0 (2012-03-30)
Platform: x86_64-pc-linux-gnu (64-bit)

locale:
 [1] LC_CTYPE=en_US.UTF-8       LC_NUMERIC=C
 [3] LC_TIME=en_US.UTF-8        LC_COLLATE=en_US.UTF-8
 [5] LC_MONETARY=en_US.UTF-8    LC_MESSAGES=en_US.UTF-8
 [7] LC_PAPER=C                 LC_NAME=C
 [9] LC_ADDRESS=C               LC_TELEPHONE=C
[11] LC_MEASUREMENT=en_US.UTF-8 LC_IDENTIFICATION=C

attached base packages:
[1] stats     graphics  grDevices utils     datasets  methods   base

other attached packages:
[1] Rcpp_0.9.10
+ R CMD build rcppapp1
* checking for file ‘rcppapp1/DESCRIPTION’ ... OK
* preparing ‘rcppapp1’:
* checking DESCRIPTION meta-information ... OK
* cleaning src
* checking for LF line-endings in source and make files
* checking for empty or unneeded directories
* building ‘rcppapp1_1.0.tar.gz’

+ R CMD INSTALL rcppapp1
* installing to library ‘/usr/local/lib/R/site-library’
* installing *source* package ‘rcppapp1’ ...
** libs
g++ -I/usr/share/R/include -DNDEBUG
-I"/usr/local/lib/R/site-library/Rcpp/include"   -fpic  -O3 -pipe  -g  -c
rcpp_hello_world.cpp -o rcpp_hello_world.o
g++ -I/usr/share/R/include -DNDEBUG
-I"/usr/local/lib/R/site-library/Rcpp/include"   -fpic  -O3 -pipe  -g  -c
rcpp_module.cpp -o rcpp_module.o
g++ -shared -o rcppapp1.so rcpp_hello_world.o rcpp_module.o
-L/usr/local/lib/R/site-library/Rcpp/lib -lRcpp
-Wl,-rpath,/usr/local/lib/R/site-library/Rcpp/lib -L/usr/lib/R/lib -lR
installing to /usr/local/lib/R/site-library/rcppapp1/libs
** R
** preparing package for lazy loading
** help
Warning:
/home/jq/Desktop/bitbucket/yabbrep/myrstan/rcppapp1/man/rcppapp1-package.Rd:31:
All text must be in a section
Warning:
/home/jq/Desktop/bitbucket/yabbrep/myrstan/rcppapp1/man/rcppapp1-package.Rd:32:
All text must be in a section
*** installing help indices
** building package indices
** testing if installed package can be loaded

* DONE (rcppapp1)
+ R -q -e 'require(Rcpp);require('\''rcppapp1'\'');m1&amp;lt;-Module('\''yada'\'',
'\''rcppapp1'\'');m1$hello()'
'rcppapp1');m1$hello()
Loading required package: Rcpp
Loading required package: rcppapp1

 *** caught segfault ***
address 0x90, cause 'memory not mapped'

Traceback:
 1: .Call(symbol)
 2: Module(module, mustStart = TRUE)
 3: .getModulePointer(x)
 4: m1$hello
aborting ...


Thanks!
J
_______________________________________________
Rcpp-devel mailing list
Rcpp-devel-Z+qqJ2/841dDXCDGMXqaGq2UG9VpUWMKQH7oEaQurus&amp;lt; at &amp;gt;public.gmane.org
https://lists.r-forge.r-project.org/cgi-bin/mailman/listinfo/rcpp-devel&lt;/pre&gt;</description>
    <dc:creator>Jiqiang Guo</dc:creator>
    <dc:date>2012-05-05T04:51:09</dc:date>
  </item>
  <item rdf:about="http://comments.gmane.org/gmane.comp.lang.r.rcpp/3394">
    <title>PKG_CXXFLAGS of Makevar</title>
    <link>http://comments.gmane.org/gmane.comp.lang.r.rcpp/3394</link>
    <description>&lt;pre&gt;Hi,

I am using a Makevar file for Rcpp package. It's from [
Rcpp.package.skeleton( ) ] command.

I added something for GSL.

GSL_CFLAGS = `gsl-config --cflags`
GSL_LIBS   = `gsl-config --libs`

PKG_CXXFLAGS= `${R_HOME}/bin/Rscript -e "Rcpp:::CxxFlags()"` $(GSL_CFLAGS)
PKG_LIBS = `$(R_HOME)/bin/Rscript -e "Rcpp:::LdFlags()"` $(GSL_LIBS)



Then, PKG_LIBS is working well. But PKG_CXXFLAGS is not working well.



g++ -I/usr/share/R/include -DNDEBUG
-I"/usr/local/lib/R/site-library/Rcpp/include" * `/usr/lib64/R/bin/Rscript
-e "Rcpp:::CxxFlags()"` `gsl-config --cflags` *-fpic  -O3 -pipe  -g  -c
rcpp_hello_world.cpp -o rcpp_hello_world.o

g++ -shared -o RcppTest.so rcpp_hello_world.o
*-L/usr/local/lib/R/site-library/Rcpp/lib
-lRcpp -Wl,-rpath,/usr/local/lib/R/site-library/Rcpp/lib* *-L/usr/lib -lgsl
-lgslcblas -lm *-L/usr/lib64/R/lib -lR


Why are these different? Am I using wrong?

Thank you,
Seung
_______________________________________________
Rcpp-devel mailing list
Rcpp-devel-Z+qqJ2/841dDXCDGMXqaGq2UG9VpUWMKQH7oEaQurus&amp;lt; at &amp;gt;public.gmane.org
https://lists.r-forge.r-project.org/cgi-bin/mailman/listinfo/rcpp-devel&lt;/pre&gt;</description>
    <dc:creator>Seungki Kim</dc:creator>
    <dc:date>2012-05-03T14:52:58</dc:date>
  </item>
  <item rdf:about="http://comments.gmane.org/gmane.comp.lang.r.rcpp/3391">
    <title>Eigen vs Arma -- was: Re: Ceres nonlinear leastsquares solver</title>
    <link>http://comments.gmane.org/gmane.comp.lang.r.rcpp/3391</link>
    <description>&lt;pre&gt;Doug,

Apologies for my question, it's a little off topic from your original
post (hence the modified subject).

I've integrated Armadillo into the new mcmc packages I've been
developing without giving much thought to Eigen.

Unfortunately, the benchmarks page on the Armadillo site doesn't
provide an Eigen benchmark: http://arma.sourceforge.net/speed.html

Likewise, for the Eigen benchmark page:
http://eigen.tuxfamily.org/index.php?title=Benchmark

In your experience, do you find it to be faster than Armadillo?  Have
you done any benchmarking? If so, can you share the results (or the
code)?

Thanks,
Whit


On Wed, May 2, 2012 at 12:33 PM, Douglas Bates &amp;lt;bates&amp;lt; at &amp;gt;stat.wisc.edu&amp;gt; wrote:
_______________________________________________
Rcpp-devel mailing list
Rcpp-devel&amp;lt; at &amp;gt;lists.r-forge.r-project.org
https://lists.r-forge.r-project.org/cgi-bin/mailman/listinfo/rcpp-devel&lt;/pre&gt;</description>
    <dc:creator>Whit Armstrong</dc:creator>
    <dc:date>2012-05-03T12:20:32</dc:date>
  </item>
  <textinput rdf:about="http://search.gmane.org/?group=$group=gmane.comp.lang.r.rcpp">
    <title>Search Engine</title>
    <description>Search the mailing list at Gmane</description>
    <name>query</name>
    <link>http://search.gmane.org/?group=$group=gmane.comp.lang.r.rcpp</link>
  </textinput>
</rdf:RDF>

