Hi Darren,
Thank you so much for taking time to write the illustrative example. That
makes perfect sense.
I had the feeling that being explicit might be a better choice when projects
get bigger. So far my codes are mainly for numerical studies in my research
and are generally short, but I do want
> Can I ask for specific reasons why people prefer explicit? Any potential
> danger for not being explicit?
Hello Zhongyi,
It is hard to show in a toy example; in fact "using namespace" is best
for code examples where you want to get an idea across and not cloud it
with too much other code.
But
On 31 August 2011 at 12:43, Zhongyi Yuan wrote:
|
|
| On Wed, Aug 31, 2011 at 11:20 AM, Dirk Eddelbuettel wrote:
|
|
| It is just for convenience -- this allows you to write shorter programs
for
| inline, but it does not prevent you from being explicit and using the
| Rcpp::
|
On Wed, Aug 31, 2011 at 11:20 AM, Dirk Eddelbuettel wrote:
>
> It is just for convenience -- this allows you to write shorter programs for
> inline, but it does not prevent you from being explicit and using the
> Rcpp::
> prefix. I tend to most of the time too because I prefer that style.
>
Tha
On 31 August 2011 at 10:59, Zhongyi Yuan wrote:
| The quick reference is quite helpful. Most of the time, I use 'inline' to
| create R functions and I think 'inline' includes Rcpp.h which specifies the
| namespace Rcpp.
It is just for convenience -- this allows you to write shorter programs for
i
Thanks for the reply, Xian.
The quick reference is quite helpful. Most of the time, I use 'inline' to
create R functions and I think 'inline' includes Rcpp.h which specifies the
namespace Rcpp.
Very often I will need Armadillo and will be "using namespace arma;". Maybe
I should keep using arma:: t
Hello Darren,
Thank you for your answer. It becomes much clearer to me now.
In particular, I really appreciate your "P.S.". Quite useful for beginners
like me.
Best,
Zhongyi
On Wed, Aug 31, 2011 at 1:40 AM, Darren Cook wrote:
> > NumericVector x = as(x_); ( Btw, this is exactly the same
> as
>
On Wed, Aug 31, 2011 at 3:00 AM,
wrote:
>
> Rcpp::NumericVector x = as(x_);
> std::vector x = as< std::vector >(x_);
Nice clarification of what's going on under the hood, Darren.
For the first case, the above is synonymous with:
Rcpp::NumericVector x(x_);
If you want a deep copy, you can use:
> NumericVector x = as(x_); ( Btw, this is exactly the same as
> NumericVector x(x_), both resulting in a shallow copy, isn't it? ) produces
> a shallow copy, while
> vector x = as< vector >(x_); produces a deep copy.
>
> Is it because for NumvericVector the as() function returns the address of
>
Hello everyone,
I am testing my code and find something that I hope someone can conform for
me. Thanks in advance. It seems to me that
NumericVector x = as(x_); ( Btw, this is exactly the same as
NumericVector x(x_), both resulting in a shallow copy, isn't it? ) produces
a shallow copy, while
vec
10 matches
Mail list logo