[Rcpp-devel] [rcpp-devel] arma::mat constructor vs Rcpp::as and interaction with .insert_col

Dale Smith dtsmith at mindspring.com
Fri Apr 12 13:34:45 CEST 2013


I did indeed read about the constructor but misinterpreted the statement - my bad. Your suggestion is a good one to try so I will benchmark my RESET test code with the various suggestions, including join as Dirk suggested.

Thanks,
Dale

Sent from my iPhone

On Apr 11, 2013, at 11:28 PM, Conrad S <conradsand.arma at gmail.com> wrote:

> On Fri, Apr 12, 2013 at 11:12 AM, Dale Smith <dtsmith at mindspring.com> wrote:
>> 
>> fastLm(y, mat) # error is "error: Mat::init(): mismatch between size of auxiliary memory and requested size"
> 
> There is a further option within the Mat constructor, which when used
> should prevent this error.
> 
> Specifically, we have:
> mat(aux_mem*, n_rows, n_cols, copy_aux_mem = true, strict = true)
> 
> If you set strict to false, eg.
> mat X(pointer, 4, 5, false, false);
> 
> the following comes into play:
> 
> "The strict variable comes into effect only if copy_aux_mem is set to
> false (ie. the matrix is directly using auxiliary memory). If strict
> is set to true, the matrix will be bound to the auxiliary memory for
> its lifetime; the number of elements in the matrix can't be changed
> (directly or indirectly). If strict is set to false, the matrix will
> not be bound to the auxiliary memory for its lifetime, ie., the size
> of the matrix can be changed. If the requested number of elements is
> different to the size of the auxiliary memory, new memory will be
> allocated and the auxiliary memory will no longer be used."
> 
> the above text is from:
> http://arma.sourceforge.net/docs.html#adv_constructors_mat


More information about the Rcpp-devel mailing list