On Sun, Feb 24, 2013 at 6:33 AM, Simon Zehnder wrote:
> 1 arma::mat repS = arma::repmat(S, 1, K);
> 2 arma::mat compM = arma::ones(S.n_rows, K);
> 3 arma::rowvec par_post(K);
> 4
> 5 for(unsigned int k = 0; k < K; ++k) {
> 6 compM.col(k) = compM.col(k) * (k + 1);
> 7 }
Hi everyone,
In Armadillo 3.800 I've added .imbue(), allowing a matrix to be filled
using a functor or C++11 lambda expression. This allows the use of the
Mersenne twister random number engine built into C++11. For example:
std::mt19937 engine;
std::uniform_real_distribution distr(0.0, 1.0);
ar
> #include
> which is not expressive enough. I think we should go for something like boost
> where we have to do
> #include
> but that would require a directory
> (inst)/include/RcppArmadillo/RcppArmadillo/extensions/sample.h
>
> which reads silly. Hm.
> Better suggestio
There's an even simpler way when using Armadillo, so that no loop is required:
http://arma.sourceforge.net/docs.html#each_colrow
For example:
mat X(4,5);
rowvec r(5);
X.each_row() = r;
(btw, in general it's more efficient to access matrices as columns
rather than rows).
On Wed, Mar 27, 2013
On Fri, Apr 12, 2013 at 11:12 AM, Dale Smith 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_
On Wed, Apr 17, 2013 at 10:24 PM, F.Tusell wrote:
> SEXP Prod1(SEXP M_) {
> const mat M = as(M_) ;
> mat prodM = M ;
> prodM = trans(M) * M ;
> return(wrap(prodM)) ;
> }
Why are you making a copy of M (as prodM) before doing the multiplication ?
Why not just directly do "mat prodM = M.t(