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

Conrad S conradsand.arma at gmail.com
Fri Apr 12 05:28:30 CEST 2013


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