Hello again,

"And had you posted reproducible examples we could have told you that days
ago."

That it is true. But I think I learned more about Rcpp this way.
Also, I definitely learned more about how inline works than had I followed
more instructions.
Moreover, having seen the sheer amount of stupid mistakes I had made in my
first attempts, as I subsequently worked through them, I can't really say I
regret not inflicting all of them on you.

Thank you for that example, Dirk. That is exactly what I aspire to, Whit,
nice code.

This is a really useful facility. I have something I can start using, and
there is loads of room for me to build something really solid with packages
or whatever.

Good stuff lads.

Thanks again.

Simon


On Wed, Oct 12, 2011 at 3:32 PM, Dirk Eddelbuettel <e...@debian.org> wrote:

>
> On 12 October 2011 at 14:51, Simon Fuller wrote:
> | Hello,
> |
> | We cross-posted. Yes, you're right. I misunderstood the use of includes -
>
> And had you posted reproducible examples we could have told you that days
> ago.
>
> Have a look at the recent post by Whit Armstrong about his updated CppBugs
> example -- that does just that: mix with other classes.
>
> Dirk
>
> | global -  that is a good way of thinking about it.
> |
> | Thanks for everything.
> |
> | Simon
> |
> | On Wed, Oct 12, 2011 at 2:06 PM, Darren Cook <dar...@dcook.org> wrote:
> |
> |     > pertain to packages. So I will post the relevant code here, and the
> full
> |     > output from verbose=TRUE below it:
> |
> |     I think the verbose output was missing from your email (?).
> |
> |     > linktest<-cxxfunction( signature( vec = "numeric", len = "integer"
> ),
> |     paste(
> |     > readLines(
> |     >
> "/home/simon/College/PackageOne/src/BZip/LinkTestWrap.cpp"),collapse = "\
> |     n"
> |     > ) , plugin = "Rcpp",verbose=TRUE )
> |     > ...
> |
> |     > 2. LinkTestWrap.cpp: Rcpp Wrapping Function (for use by inline)
> |     > #include <Rcpp.h>
> |     > #include <vector>
> |     > #include "/home/simon/College/PackageOne/src/BZip/LinkTest.h"
> |     >
> |     >     using std::vector;
> |     >
> |     >     vector<int> input_vector( as< vector<int> >( vec ) );
> |     >     int length = as<int> ( len );
> |     >
> |     >     int res = sumvec( input_vector );
> |     >
> |     >     return Rcpp::wrap( res );
> |
> |     Does this mean you have three #include statements inside your
> function
> |     body? The cxxfunction has an includes parameter where you should put
> |     them. I think of "includes" as meaning "global stuff". So you could
> put
> |     your "using std::vector" line in there too (that is just a style
> |     difference, though).
> |
> |     Also, IIRC, plugin="Rcpp" implies the #include <Rcpp.h>, so you
> should
> |     be able to drop that.
> |
> |     Darren
> |
> |     --
> |     Darren Cook, Software Researcher/Developer
> |
> |     http://dcook.org/work/ (About me and my work)
> |     http://dcook.org/blogs.html (My blogs and articles)
> |     _______________________________________________
> |     Rcpp-devel mailing list
> |     Rcpp-devel@lists.r-forge.r-project.org
> |
> https://lists.r-forge.r-project.org/cgi-bin/mailman/listinfo/rcpp-devel
> |
> |
> |
> | ----------------------------------------------------------------------
> | _______________________________________________
> | Rcpp-devel mailing list
> | Rcpp-devel@lists.r-forge.r-project.org
> | https://lists.r-forge.r-project.org/cgi-bin/mailman/listinfo/rcpp-devel
> --
> "Outside of a dog, a book is a man's best friend. Inside of a dog, it is
> too
> dark to read." -- Groucho Marx
>
_______________________________________________
Rcpp-devel mailing list
Rcpp-devel@lists.r-forge.r-project.org
https://lists.r-forge.r-project.org/cgi-bin/mailman/listinfo/rcpp-devel

Reply via email to