Feature request: RVector and RMatrix types like RcppParallel with examples
I love the package and am thinking of switching my package detrendr to use it rather than RcppParallel but the parallel-safe types RVector and RMatrix that it provides are handy so I'm not going to. RcppThread is also missing parallelReduce.
I know I could probably import both but I don't want to do that; would be great to drop the TBB dependency that comes with RcppParallel. That package already has extensive docs which make it nicer to use also. I could help a little with the docs but I'm not qualified to add RVector and RMatrix.
I prefer RcppThread because the amount of boilerplate needed to use it is a lot less.
Even if you don't have time to help with this, congrats on a really cool package.
Hi! From briefly browsing over the detrendr code, I don't really see what you need RVector and RMatrix for that std::vector<double> wouldn't achieve just as easily? Their parallel-safety is no different, it's just that NumericVector etc are particularly unsafe.
As I understand it, RVector and RMatrix can be constructed from NumericVector etc without making a copy (and then used to set values therein) whereas converting to/from std::vector necessitates a copy. Is this not correct?
That is correct, copying data is just rarely a speed bottleneck, although that might be different for your package. You can of course just copy&paste the RVector and RMatrix headers in your project and use it from there. I could do that also in RcppThread, but that has consequences for licensing since RcppParallel is under GPL and RcppThread under MIT. I'll think about it though.
I'm working with huge arrays so I try to avoid copying if I can but you may well be right that the copying is a small part of the time taken.
I hadn't thought about the licensing thing. I know it doesn't strictly satisfy the licensing thing but if it were me, I would open a PR to add RVector and RMatrix and tag the maintainer of RcppParallel asking for permission to have them even though the licenses don't match.
Thanks for taking the time to respond to me and thanks again for a great package.
Such a PR would be welcome. Thanks!