Hi,
Instead of doing that:
const int vtype = traits::r_sexptype_traits::rtype;
SEXP shape_sxp = Rf_allocVector(vtype, shape.size());
Perhaps your rxarray object could hold an IntegerVector. Also not quite sure
why you use the first line at all, which does not depend on T, so vtype is
always
ared identifier 'output'
> output.begin() + begin,
> ^
> 2 errors generated.
> make: *** [par_example.o] Error 1
>
>
> Hope this is as easily solved as the before error.
>
> Cheers, Franz
>
>
>
>
>> On 31 May 2017, at 12:26, Romain Francois &l
You can add this somewhere on top of your cpp file
// [[Rcpp::depends(RcppParallel)]]
Romain
> Le 31 mai 2017 à 12:22, f.k...@mailbox.org a écrit :
>
> Hi all,
>
> I am very new to Rcpp and I wrote a function which I now want to parallelize.
> The function is working fine, and is much faster
Hello,
Functions in sugar only apply to vectors.
For a single value, you’d have to use the dnorm function in the R:: namespace:
// [[Rcpp::export]]
double test6(double x){
double y = R::dnorm(x,5.0,2.0,true);
return y;
}
> test6(3)
[1] -2.112086
> dnorm(3, mean = 5, sd = 2, log = TRUE)
| Hi Kaspar and Dirk,
> |
> | It is indeed cumulative. Previously (presumably when that gallery page was
> | written) it was not cumulative, but Romain Francois changed the behavior of
> the
> | step() function several years ago, in this commit:
> https
I’d be interesting to see what this more C++idomatic version would perform
nanCount = std::count_if( x.begin(), x.end(), ISNAN ) ;
Because despite all the inlining efforts that has been put in the
implementation of NumericVector, its operator[] might not perform as well as
using [] on a
You need
LinkingTo: Rcpp
As per the current documentation.
Romain
Envoyé de mon iPhone
Le 29 juil. 2015 à 17:19, jsmith5...@yahoo.com jsmith5...@yahoo.com a
écrit :
Hi,
Is there a way to automatically specify the location of the Rcpp include
directory (for Rcpp.h) in Makevars?
Or just use a std::vectordouble for sg. That should do it.
Romain
Envoyé de mon iPhone
Le 14 juil. 2015 à 13:21, JJ Allaire jj.alla...@gmail.com a écrit :
The examples in the RcppParallel documentation assume that access to
vectors and matrixes are *aligned* (i.e. fall into neat buckets
I would definitely second that. This eliminates a whole class of hard to deal
with issues.
Even Rcpp IMO should really just be header only.
Romain
Envoyé de mon iPhone
Le 7 avr. 2015 à 20:51, JJ Allaire jj.alla...@gmail.com a écrit :
I think that header-only packages (where possible)
Envoyé de mon iPhone
Le 18 févr. 2015 à 17:31, JJ Allaire jj.alla...@gmail.com a écrit :
We *can* call Rf_error from C++ code, but when we do it bypasses all
C++ destructors on the stack, so we don't do it so as not leak memory
and otherwise have deterministic behavior around
That is similar to a path i've followed in Rcpp11/Rcpp14.
What's really missing in R is api access to strings, e.g testing for equality
of two CHARSXP, comparing them, ...
This causes all sorts of problems with dplyr.
Romain
Le 16 déc. 2014 à 06:00, Jeroen Ooms jeroen.o...@stat.ucla.edu a
Envoyé de mon iPhone
Le 3 déc. 2014 à 17:59, Gabor Grothendieck ggrothendi...@gmail.com a écrit :
1. This returns a matrix rather than a vector:
-- start of file teste.cpp ---
#include RcppArmadillo.h
// [[Rcpp::depends(RcppArmadillo)]]
using namespace arma;
using namespace Rcpp;
This is probably related to this:
template int RTYPE
struct r_vector_const_iterator {
typedef typename storage_typeRTYPE::type* type ;
};
There should be a const there somewhere.
FWIW, more modern implementations of R/C++ are more safe on that issue:
Le 27 nov. 2014 à 13:22, Søren Højsgaard sor...@math.aau.dk a écrit :
Dear all,
By accident I noticed that indexing with x(i) and x[i] gives remarkable
difference in computing time. For example:
library(Rcpp)
cppFunction('
IntegerVector insert1 (int n){
IntegerVector z(n);
for
This has nothing to do with NA. It's just about the size difference. sugar does
not make attempt at recycling. Your responsibility.
Romain
Le 22 nov. 2014 à 11:48, Søren Højsgaard sor...@math.aau.dk a écrit :
Dear all,
Came across this:
#include Rcpp.h
using namespace Rcpp;
You get UB if the first is bigger than the second.
Envoyé de mon iPhone
Le 22 nov. 2014 à 14:30, Søren Højsgaard sor...@math.aau.dk a écrit :
OK; thanks! Shall I read this such as the behaviour is undefined?
Søren
|-Original Message-
|From: Romain Francois [mailto:rom...@r
a and b are the same object:
a - seq(1, 0.1, -0.1)
b - a
pryr::address( a )
[1] 0x7f9504534948
pryr::address( b )
[1] 0x7f9504534948
So clone is what you need here.
Implementing copy on write for that kind of example is possible, but would
require a lot of additional code, i.e. the
...@gmail.com a écrit :
Thanks a lot!
Does that mean we should never modify an argument passed from R to cpp?
On Wed, Oct 22, 2014 at 8:24 AM, Romain Francois rom...@r-enthusiasts.com
mailto:rom...@r-enthusiasts.com wrote:
a and b are the same object:
a - seq(1, 0.1, -0.1)
b - a
pryr
Le 20 oct. 2014 à 21:54, Dirk Eddelbuettel e...@debian.org a écrit :
Hi Gustaf,
On 20 October 2014 at 15:17, Gustaf Granath wrote:
| Im trying to use some C++ functions in R. However, these functions are
| build around unsigned char* variables (1D array). I have for example a
|
Hi,
that's not going to fly.
A CharacterVector holds strings of arbitrary lengths, well technically it holds
other R objects (SEXP) that hold pointers to strings.
A RawVector holds unsigned char.
Can you add some meat to your example, e.g. what you'd expect to go in, etc ...
Romain
Le
Envoyé de mon iPhone
Le 5 oct. 2014 à 07:51, Jeffrey Wong jeff.ct.w...@gmail.com a écrit :
I am trying to use RcppParallel to do a fast grid search. The idea is to
construct a matrix using R's expand.grid, then for each row of that matrix,
x, call f(x). For simplicity the function f
If you want to have a private conversation with Dirk, just email him directly:
e...@debian.org
Now since this is all in the open, let me participate to this.
Le 29 sept. 2014 à 22:42, Jonathon Love j...@thon.cc a écrit :
-BEGIN PGP SIGNED MESSAGE-
Hash: SHA512
hey dirk,
i was
This is once again something with which the RCPP_EXPOSED_CLASS macro can help
with. Try adding
RCPP_EXPOSED_CLASS(A)
before you declare class A and simply use this signature for the method.
void DoSomethingWithInstanceOfA(const A )
Also, you can have both of these classes in the same
Le 10 sept. 2014 à 14:22, Gregory Jefferis jeffe...@mrc-lmb.cam.ac.uk a écrit
:
Gregory Jefferis
On 10 Sep 2014, at 10:39, Romain Francois rom...@r-enthusiasts.com wrote:
RCPP_EXPOSED_CLASS(A)
before you declare class A and simply use this signature for the method.
void
Le 1 sept. 2014 à 11:48, Dr Gregory Jefferis jeffe...@mrc-lmb.cam.ac.uk a
écrit :
Hello,
I have a more or less complete Rcpp(Eigen) dependent package that exposes a
pair of C++ classes to R using RcppModules;the C++ classes (which implement k
nearest neighbour search trees) differ only
Le 20 août 2014 à 20:57, Gregor Kastner gregor.kast...@wu.ac.at a écrit :
JJ Yes, RNGScope isn't safe by itself. You can use it via attributes (and we
JJ make sure to use it correctly) or you could use this pattern e.g. if you
JJ are planning to return a NumericVector:
JJ
JJ NumericVector
Le 21 août 2014 à 11:47, Gregor Kastner gregor.kast...@wu.ac.at a écrit :
On Thu, 21 Aug 2014 11:34:23 +0200
Romain Francois rom...@r-enthusiasts.com wrote:
GK Yep, sorry for the misuse of language. And I do understand going back to
GK GetRNGstate() and PutRNGstate() is a bit old school
are using attributes then this isn't a concern, if you are not
then you need the return value SEXP on the stack prior to RNGScope.
On Thursday, August 21, 2014, Romain Francois rom...@r-enthusiasts.com
wrote:
Ah interesting. PutRNGstate does indeed allocate so might trigger GC.
https://github.com
This is likely to be a bug in Rcpp, don't go bother clang about it:)
Perhaps you can try to remove the bool cast and run the test suite. If
everything works, then it either means that there are no tests for the
particular case or that the overload is useless.
You probably have to consider what
***
Number of test functions: 439
Number of errors: 0
Number of failures: 0
Sorry, due to a restrictive firewall on my dev computer, I cannot access
github from it. A mail will have to suffice for now.
Ciao,
Christian
On 29.07.2014 10:44, Romain Francois
Lookup in Rcpp::List is linear on something that is quite cheap (comparing
pointers, because strings in R are cached).
Lookup in std::map is logarithmic on whatever it means to compare the keys (so
in your case comparing strings).
on top of that, copying the data across is linear in the best
Le 18 juin 2014 à 23:54, Tim Keitt tke...@utexas.edu a écrit :
I'd like to raise a condition other than error or warning. Is that possible
using the Rcpp api? I assume this can be done via R internals, but I'd prefer
not to call error() directly (or is that the recommendation?).
THK
Le 19 juin 2014 à 00:15, Tim Keitt tke...@utexas.edu a écrit :
On Wed, Jun 18, 2014 at 5:07 PM, Romain Francois rom...@r-enthusiasts.com
wrote:
Le 18 juin 2014 à 23:54, Tim Keitt tke...@utexas.edu a écrit :
I'd like to raise a condition other than error or warning. Is that possible
Le 19 juin 2014 à 00:30, Tim Keitt tke...@utexas.edu a écrit :
On Wed, Jun 18, 2014 at 5:22 PM, Romain Francois rom...@r-enthusiasts.com
wrote:
Le 19 juin 2014 à 00:15, Tim Keitt tke...@utexas.edu a écrit :
On Wed, Jun 18, 2014 at 5:07 PM, Romain Francois rom...@r-enthusiasts.com
Le 19 juin 2014 à 01:02, Tim Keitt tke...@utexas.edu a écrit :
On Wed, Jun 18, 2014 at 5:37 PM, Romain Francois rom...@r-enthusiasts.com
wrote:
Le 19 juin 2014 à 00:30, Tim Keitt tke...@utexas.edu a écrit :
On Wed, Jun 18, 2014 at 5:22 PM, Romain Francois rom...@r-enthusiasts.com
Le 19 juin 2014 à 03:05, Dirk Eddelbuettel e...@debian.org a écrit :
On 18 June 2014 at 19:40, Tim Keitt wrote:
|
|
|
| On Wed, Jun 18, 2014 at 6:26 PM, Dirk Eddelbuettel e...@debian.org wrote:
|
|
| Tim,
|
| Step back for a second and recognise that everything happens
This looks like a protection issue.
For whomever this makes sense to: From the code that wraps such object, i would
investigate the call to setAttrib.
Perhaps we are supposed to get the result of it and protect it.
So i would tend to use an Armor instead of a Shield.
Romain
Le 28 mai
(now with some links):
Le 28 mai 2014 à 16:31, John Mous john.mo...@gmail.com a écrit :
The object really is just built as part of the return statement. i.e. the
lines from my prior e-mail exist as-is in the full code,
Sure. What happens is that Rcpp::export generates something that calls
On Wed, May 28, 2014 at 3:44 PM, Romain Francois rom...@r-enthusiasts.com
wrote:
(now with some links):
Le 28 mai 2014 à 16:31, John Mous john.mo...@gmail.com a écrit :
The object really is just built as part of the return statement. i.e. the
lines from my prior e-mail exist as-is in the full
Le 6 mai 2014 à 08:45, Florian Burkart florian.burk...@gmail.com a écrit :
Hi everyone (and Dirk),
Second attempt on corrected email list.
I have been trying to extend Rcpp with my own wrap and as templates.
Two issues:
1) I need to explicitly call wrap. Is that expected?
So for
Le 6 mai 2014 à 09:35, Florian Burkart florian.burk...@gmail.com a écrit :
Hi,
I have been creating lists of lists with
return Rcpp::List::create(Rcpp::Named(vec) = someVector,
Rcpp::Named(lst) = someList,
Rcpp::Named(vec2) =
I've tested and it seems to work as intended. Is this fix you were conceiving
of or is there something more we should be doing?
J.J.
On Wed, Apr 30, 2014 at 9:19 AM, Romain Francois rom...@r-enthusiasts.com
wrote:
The plugin as implemented now is not portable. The easiest way to make
Hi,
If you can assume c++11, you might bot need openmp, as you can just use
standard support for threads, etc ...
Although the compiler suite used on windows (if you care about that) does not
support c++11 threads. This might be available later.
Romain
Le 28 avr. 2014 à 12:51, Matteo
Hello,
I’ll keep it short here. Rcpp11 3.1.0 was released on CRAN today. An
announcement email has been sent to both r-packages and the new R and C++
mailing list. https://groups.google.com/forum/#!forum/r-and-cpp
Best Regards,
Romain
___
Le 8 avr. 2014 à 13:28, stat quant mail.statqu...@gmail.com a écrit :
Hi,
Will that be ok to ask Rcpp questions to on this list too?
Definitely. Anything R and C++ related.
On 8 Apr 2014 09:56, Romain François rom...@r-enthusiasts.com wrote:
Hello,
I have created a new mailing list
Le 28 févr. 2014 à 11:52, Gregor Kastner gregor.kast...@wu.ac.at a écrit :
Hi Hideyoshi,
Is there a way I can just call that function in Rcpp rather than having to
install new libraries or create my own? (I presume that there is probably a
“C_do_fmin.c” file somewhere that I can use?)
Le 17 févr. 2014 à 12:17, Alessandro Mammana mamm...@molgen.mpg.de a écrit :
Dear all,
I am trying to write an Rcpp function that accepts optionally a
vector, but I cannot figure out what default value I should give to
it.
First I tried the following:
// [[Rcpp::export]]
int
Le 12 févr. 2014 à 13:36, Alessandro Mammana mamm...@molgen.mpg.de a écrit :
Ah wait, my bad (as always T.T), I found a much simpler explanation:
colset - sample(3e7-nr, 1e7)
storage.mode(colset)
[1] integer
storage.mode(colset-1)
[1] double
So when I was unwrapping colset I allocated
Hi Antonio,
This is about how R evaluation works. Might not just be what you think it is.
When you use Rcpp and therefore .Call things are evaluated fairly early, at
least earlier than what would happen with R, etc … you can reproduce what R
does by using promises. For example this work in
The problem is likely to be that it was assumed that List derives from RObject.
It used to, it does not anymore.
Classes from the api now use a policy based design. See andrei alexandrescu's
modern c++ book for the why and the how of policy based design.
.
Envoyé de mon iPhone
Le 3 févr.
)
--
On Mon, Feb 3, 2014 at 9:12 PM, Romain Francois rom...@r-enthusiasts.com
wrote:
The problem is likely to be that it was assumed that List derives from
RObject.
It used to, it does not anymore.
Classes from the api now use a policy based design
Hello,
This stands out
double U;
for(int i=0; in; i++){
for(int j=0; jn; j++){
U = U + A_kl(i,j) * B_kl(i,j)/n/n ;
}
}
U = sqrt(U);
U is not initialized. so all bets are on. Anything can happen. Same holds for
aa and bb.
Also, in terms of how you
Le 18 janv. 2014 à 06:10, Davor Cubranic cubra...@stat.ubc.ca a écrit :
Running compileAttributes with “verbose = TRUE” was very informative:
$ Rscript -e 'Rcpp::compileAttributes(., TRUE)'
Exports from /Users/davor/projects/Davor/myPackage/src/rcpp_hello_world.cpp:
List
Hi,
If you wrap your std::vectorRawVector you get a list of raw vectors, and this
does not do deep copies of the RawVector.
If you want a RawMatrix, you have to make copies as all the matrix data is
contiguous in memory.
Perhaps you can change things around, first create the matrix and
Hello,
You can use .factory instead of .constructor in that case.
Romain
Le 9 janv. 2014 à 03:16, Tim Keitt tke...@utexas.edu a écrit :
I did a little experiment with RCPP_MODULE trying to wrap a class from
another library. The class in question has a protected default constructor
and
of my functions exported to the package. How
would the factory be called from R? I sort of understood that exporting in
packages was automatic. Do I have to manually create the module in R?
THK
On Thu, Jan 9, 2014 at 4:40 AM, Romain Francois rom...@r-enthusiasts.com
wrote:
Hello
, 2014 at 11:31 AM, Romain Francois rom...@r-enthusiasts.com
wrote:
Hi,
The module docs is probably the one in the worst shape. I think the current
recommendation is to have this in one of your .R files:
loadModule( yourmodule, TRUE )
which triggers a load action for when the package
Hello,
wrap is for converting an object of arbitrary class to an R object. It deduces
what to do based on the class of what you pass it. So you usually don’t specify
the template parameter. So you’d usually just write :
return wrap(a);
If you wanted to be explicit, then you would use:
Hello,
This is fixed in Rcpp implementations I maintain: Rcpp11 and Rcpp98 and tested
for in Rcpp-test.
https://github.com/romainfrancois/Rcpp11/blob/master/src/attributes.cpp#L1195
https://github.com/romainfrancois/Rcpp98/blob/master/src/attributes.cpp#L1228
Trivial to port the fix to Rcpp.
Thanks.
In any case, for things like this the best thing to do is to not trust what
anyone says and actually benchmark with realistic data.
Romain
Le 31 déc. 2013 à 16:29, Hadley Wickham h.wick...@gmail.com a écrit :
I believe you are mistaken. sorting is an expensive O( N log(N) )
Hi,
If both these functions will end up in the same package, then I’d suggest to
put both files in the src directory and use devtools::load_all on your package
root directory.
Dirk’s recommendation is relevant bar is in its own package and calls foo from
another package. Might not be what
Le 29 déc. 2013 à 12:50, Asis Hallab asis.hal...@gmail.com a écrit :
Dear Rcpp experst,
I hope everyone has had a pleasant Xmas.
I am just wondering what would be the recommended and most efficient way to
check, if a Rcpp Vector contains a given element?
If I am not mistaken the C++
in a
| JSS paper?
We could add a 'Suggests: RcppEigenFastLm' (or whichever name we end up with).
It would help with a thing or too -- didn't you even discover a slight
NAMESPACE issue on the R side recently?
On 3 December 2013 at 08:47, Romain Francois wrote:
| without them, we (you) could
,
kind of like look how I can do fastLm with this one. This has been
useful in training sessions for example.
But now presumably, I'll get replies in the this has been there for
years department.
Romain
--
Romain Francois
Professional R Enthusiast
+33(0) 6 28 91 30 30
on OS X 10.9 with R 3.0.2 and Rcpp 0.10.6.
Does anyone know how to fix this?
Best,
--
Hao Ye
h...@ucsd.edu
--
Romain Francois
Professional R Enthusiast
+33(0) 6 28 91 30 30
___
Rcpp-devel mailing list
Rcpp-devel@lists.r-forge.r-project.org
https
?
This seems more like Rcpp issues. However I'll propose a few changes to
RcppEigen so that it uses attributes. I'll make a branch and send a pull
request so that you can validate it.
--
Romain Francois
Professional R Enthusiast
+33(0) 6 28 91 30 30
void forward_exception_to_r( const std::exception ex){
^
Do these all look like issues that I should address in RcppEigen?
--
Romain Francois
Professional R Enthusiast
+33(0) 6 28 91 30 30
___
Rcpp-devel mailing list
Rcpp-devel@lists.r
--
Romain Francois
Professional R Enthusiast
+33(0) 6 28 91 30 30
___
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
, etc ...
Hard to say without seeing the code.
Romain
--
Romain Francois
Professional R Enthusiast
+33(0) 6 28 91 30 30
___
Rcpp-devel mailing list
Rcpp-devel@lists.r-forge.r-project.org
https://lists.r-forge.r-project.org/cgi-bin/mailman/listinfo/rcpp
-project.org/cgi-bin/mailman/listinfo/rcpp-devel
--
Romain Francois
Professional R Enthusiast
+33(0) 6 28 91 30 30
___
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
-bin/mailman/listinfo/rcpp-devel
--
Romain Francois
Professional R Enthusiast
+33(0) 6 28 91 30 30
___
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
happens when I call
compileAttributes. Is there anywhere a linking involved with Rcpp.so or
Rcpp.dylib?
Best
Simon
On 02 Nov 2013, at 09:57, Romain Francois rom...@r-enthusiasts.com wrote:
Le 02/11/2013 09:35, Simon Zehnder a écrit :
First, I didn’t. But for getting some output
of Rcpp's code
bloat.
I will try to find a solution that does not involve releasing a new Rcpp
as 0.10.6 was just released.
Romain
--
Romain Francois
Professional R Enthusiast
+33(0) 6 28 91 30 30
___
Rcpp-devel mailing list
Rcpp-devel@lists.r-forge.r
it is
worth considering using // [[Rcpp::export]] and code generation given by
compileAttributes instead of modules.
Romain
--
Romain Francois
Professional R Enthusiast
+33(0) 6 28 91 30 30
___
Rcpp-devel mailing list
Rcpp-devel@lists.r-forge.r-project.org
Le 31/10/2013 17:36, Dirk Eddelbuettel a écrit :
On 31 October 2013 at 17:15, Romain Francois wrote:
| Le 31/10/2013 15:59, baptiste auguie a écrit :
| OS X 10.9 (aka Mavericks) has a new C++ compiler, clang++ with libcxx
| headers/runtime. Your package fails to compile with that compiler
, add_1NumericVector);
Thanks!
-Kevin
--
Romain Francois
Professional R Enthusiast
+33(0) 6 28 91 30 30
___
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
necessary before I re-write my R code ;o)
--
Romain Francois
Professional R Enthusiast
+33(0) 6 28 91 30 30
___
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
Just a warning that this code creates a NumericVector of length 1 initialised
with 0.
1 is not a NumericVector so the compiler looks for a conversion, the one that
is found is the ctor for NumericVector that takes an int.
Romain
Le 28 oct. 2013 à 17:05, Hadley Wickham h.wick...@gmail.com a
Ushey a écrit :
Hi Romain, Dirk,
I'd be willing to contribute an Rcpp Gallery post and some tests if
this were added to Rcpp; I think it would be quite useful.
-Kevin
On Wed, Oct 23, 2013 at 6:31 AM, Dirk Eddelbuettel e...@debian.org wrote:
On 23 October 2013 at 14:31, Romain Francois wrote:
| Le
pass down an NumericVector ? The reason is that given
Rcpp's design, copy semantics of NumericVector are cheap (no data copy).
Which leads back to hte original question: what does Play want to do
with this vector ?
Romain
--
Romain Francois
Professional R Enthusiast
+33(0) 6 28 91 30 30
...@debian.org |
http://dirk.eddelbuettel.com
--
Romain Francois
Professional R Enthusiast
+33(0) 6 28 91 30 30
___
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
, so maybe the next someone struggles with this they
may find. If someone is itching to fix this, we will gladly take patches.
Dirk
--
Dirk Eddelbuettel | e...@debian.org | http://dirk.eddelbuettel.com
--
Romain Francois
Professional R Enthusiast
+33(0) 6 28 91 30 30
on mailing list and SO, but could
be generally useufl for Rcpp users.
Do people want to see this in Rcpp.
This is orthogonal to everything else, so the risk is minimum. This is a
template class, so the cost is null if the class is not used.
Romain
--
Romain Francois
Professional R Enthusiast
+33(0) 6
in this thread.
FYI, in Rcpp11, create has been reimplemented to take advantage of
variadic templates (from C++11), so this limitation disappears.
Romain
--
Romain Francois
Professional R Enthusiast
+33(0) 6 28 91 30 30
___
Rcpp-devel mailing list
Rcpp
Le 23/10/2013 13:47, Dirk Eddelbuettel a écrit :
On 21 October 2013 at 14:32, Romain Francois wrote:
| Hello,
|
| Another thing I have developped in dplyr but might be generally useful
| is the ListOf class. See
| https://github.com/hadley/dplyr/blob/master/inst/include/tools/ListOf.h
Hello,
Try putting your declarations into a RItools.h file in inst/include/ or
src/ in your package, i.e. have this in RItools.h
typedef double (*testStat)(NumericVector, NumericVector);
and add:
PKG_CPPFLAGS += -I../inst/include/
to your Makevars and Makevars.win.
Romain
--
Romain Francois
Rcpp-devel@lists.r-forge.r-project.org
https://lists.r-forge.r-project.org/cgi-bin/mailman/listinfo/rcpp-devel
--
Romain Francois
Professional R Enthusiast
+33(0) 6 28 91 30 30
___
Rcpp-devel mailing list
Rcpp-devel@lists.r-forge.r-project.org
https
Le 15/10/13 10:46, Martyn Plummer a écrit :
On Mon, 2013-10-14 at 22:24 +0200, Romain Francois wrote:
Le 14/10/13 21:47, Mark Fredrickson a écrit :
Thank you to Romain and Dirk. I've seen some C++ rank implementations,
and I'll probably copy one of those.
Lastly, not a milligram of Rcpp
the client package needs is to use
LinkingTo to pull in headers from inst/include.
Romain
--
Romain Francois
Professional R Enthusiast
+33(0) 6 28 91 30 30
___
Rcpp-devel mailing list
Rcpp-devel@lists.r-forge.r-project.org
https://lists.r-forge.r
!
___
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
--
Chief Scientist, RStudio
http://had.co.nz/
--
Romain Francois
Professional R Enthusiast
+33(0) 6 28 91 30 30
do something like this;
// [[Rcpp::export]]
double sumFirstRowSTL(NumericMatrix mat){
return std::accumulate(mat(0,_).begin(), mat(0,_).end(), 0.0);
}
Romain
--
Romain Francois
Professional R Enthusiast
+33(0) 6 28 91 30 30
___
Rcpp-devel
from R's unexported Defn.h, you can get the function pointer for
the internal rank. see this gist:
https://gist.github.com/romainfrancois/6981372
However, if you do this in a package, there is a good chance R CMD check
will moan about it because you use R_FunTab.
Romain
--
Romain Francois
, so I'm not too concerned about
these too much yet.
In any case, for things like that, please use the issue tracker:
https://github.com/romainfrancois/Rcpp11/issues?state=open
--
Romain Francois
Professional R Enthusiast
+33(0) 6 28 91 30 30
___
Rcpp
in the
.h and .cpp of Rcpp. That is that many macro calls we could get rid of.
Romain
--
Romain Francois
Professional R Enthusiast
+33(0) 6 28 91 30 30
___
Rcpp-devel mailing list
Rcpp-devel@lists.r-forge.r-project.org
https://lists.r-forge.r-project.org
Le 11/10/13 13:26, Dirk Eddelbuettel a écrit :
Romain,
On 11 October 2013 at 13:03, Romain Francois wrote:
| Anyway, I'd like to propose adding Shield, Armor and Shleter to Rcpp.
Sure.
| This is a non disruptive proposal as the template classes I propose
| don't interract with the rest
I will give some concretes next week. For now, i just wanted to hint:
- mean is a mammoth. Try applying mean_ :
mean_ - function(.) .Internal(mean(.))
- by using x(r,_) you are allocating memory at each loop iteration, when we can
use just one vector, since all rows are by definition of the
.
That, as best as I can tell, seems to be the way to avoid the clashes seen in
Romain's first email in this thread.
Some more questions re some possible future use below
On 10 October 2013 at 05:15, Romain Francois wrote:
| I don't particularly love macros. I much prefer templates. For example
Le 10/10/13 17:36, Dirk Eddelbuettel a écrit :
On 10 October 2013 at 17:15, Romain Francois wrote:
| They are quite useful for debugging too:
|
| #if RCPP_DEBUG_LEVEL 0
| #define RCPP_DEBUG( fmt, ... ) Rprintf( %20s:%4d fmt \n
| , short_file_name(__FILE__), __LINE__, ##__VA_ARGS__
Le 10/10/13 18:16, Dirk Eddelbuettel a écrit :
On 10 October 2013 at 18:02, Romain Francois wrote:
| To give some context, I'm taking about using R's linking mechanism. I'm
| talking about generating automatically the code that:
| - registers a function with R_RegisterCCallable
| - grabs
--
Romain Francois
Professional R Enthusiast
+33(0) 6 28 91 30 30
___
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
1 - 100 of 498 matches
Mail list logo