In another thread Noah wrote "I wasn't asking a C++ question...I thought
there might have been a problem with Rcpp". No intention to pick on Noah
here, but I thought it was a good chance to suggest a simple
troubleshooting technique.
The technique is simple, but not so simple that it cannot have i
> You know nothing about my application, size or data, or other transformation
> on the data.
Well, that's because you didn't tell me (us) anything about any of the
above. I was simply commenting on the code that you posted, which was
all that I could see, not being a mind-reader myself.
> To ma
I wasn't asking a C++ question.
Due to a type at 2am, (My fault), I thought there might have been a problem
with Rcpp.
If you notice, I sent a redaction almost immediately after, asking everyone to
ignore my previous e-mail.
--
Noah Silverman
UCLA Department of Statistics
8117 Math Sciences B
Maybe I can give a slightly more elegant solution from Boost... (fingers
crossed...)
In this manner, the ugly for-loop is removed...
For the toy-example, I would suggest the following:
std::vector data;
data.reserve(20); // extreamly important (maximize cache effect)
std::copy(boost::countin
Xian,
Your comment is ridiculous.
You know nothing about my application, size or data, or other transformation on
the data.
I can assure you that using Rcpp speeds up my process by a factor of at least
100. I don't know how you measure things, but in my world, that is a VERY
appropriate
> I think this is the current prize-winner of inappropriate use of Rcpp...
> How about using R to sort your vector?!
There is also the fact that the array is being created ready-sorted :-).
I assumed this was an artificially simplified example from real code. Or
a learning toy.
> This isn't reall
I think this is the current prize-winner of inappropriate use of Rcpp...
How about using R to sort your vector?!
This isn't really an Rcpp question, but since you asked, .push_back()
is a great way to slow yourself down.
hth :)
-xian
On Thu, Sep 22, 2011 at 3:00 AM,
wrote:
>
> body="
>
> std::sort(data.front(), data.back());
front() and back() return references to the first and last items. I.e.
they return doubles, not iterators. I think what you wanted was:
std::sort(data.begin(),data.end());
Darren
--
Darren Cook, Software Researcher/Developer
http://dcook
Hi,
I don't have access to a computer with R atm so I can't try. But the
includes="#include , #include , #include .
#include "
looks fishy to me. First of all, note the dot before the last "include"
instead of a comma. Secondly: wouldn't you need something like the below?
includes=c("#include ","#i
Hi,
I have a vector of doubles that I want to sort.
Using Rcpp and inline. When attempting to create the function, I receive an
error. Does anybody have any suggestions?
===
Test <- cxxfunction(
signature(),
plugin="Rcpp", includes="#include , #include , #incl
10 matches
Mail list logo