[Rcpp-devel] issues with discussion board + help

Dirk Eddelbuettel edd at debian.org
Mon Jun 7 05:01:18 CEST 2010


Vinh,

On 7 June 2010 at 12:19, Conrad Sanderson wrote:
| Hi Vinh,
| 
| To answer your questions:
| 
| I don't control the software that SourceForge runs on its website
| (including Armadillo's discussion board, so I cannot diagnose your
| problem.  However, I have encountered a similar problem on another
| site, and it's usually solved by closing Firefox completely (including
| all download windows) and restarting it.  If that doesn't work,
| perhaps you can create a specific account on SF and try with that.  As
| a last resort, please contact SF admin.
| 
| As for using Armadillo with R, I cannot directly help you with that.
| I haven't developed the RcppArmadillo wrapper, so I don't know what
| the issue might be.  Perhaps you can try the wrapper's developers,
| listed below.  However, if you replicate the problem in pure C++ code,
| I'll be able to diagnose if the problem lies within Armadillo itself.

We would be happy to look at your issue if you provide a simple,
self-contained, reproducible piece of code along with information about which
versions of Rcpp and RcppArmadillo you are using to the rcpp-devel list which
I am CCing now..

Dirk
| 
| For RcppArmadillo:
| 
| Romain Francois <romain at r-enthusiasts.com>
| Dirk Eddelbuettel <edd at debian.org>
| Douglas Bates <bates at stat.wisc.edu>
| "Romain, Dirk and Doug" <RcppArmadillo-authors at r-enthusiasts.com>
| 
| 
| With regards,
| Conrad
| 
| 
| On 7 June 2010 11:37, Vinh Nguyen <vinhdizzo at gmail.com> wrote:
| > Hi Conrad,
| >
| > I mean to post this up on the armadillo board, but after signing into
| > SF with openID my browser (3 of them) would not let me continue.  Here
| > is what firefox gives:
| > The page isn't redirecting properly
| > Firefox has detected that the server is redirecting the request for
| > this address in a way that will never complete.
| >    *   This problem can sometimes be caused by disabling or refusing to accept
| >          cookies.
| >
| > Anyways, this is what I wanted to ask.  I'm using Armadillo with R
| > through Rcpp.  I'll give you bits of my example first to see if I'm
| > doing anything wrong logically.  I have the following declared with
| > values from R objects:
| >  arma::colvec S0(nObs) ;
| >  arma::mat S1(nObs, nParam) ;
| >  arma::cube S2(nObs, nParam, nParam) ;
| >  arma::cube S12(nObs, nParam, nParam) ;
| >  // Armadillo representations of objects (for multiplication)
| >  arma::mat ZArma(Z.begin(), nObs, nParam, true) ;
| >  arma::colvec betaArma(beta.begin(), nParam, true) ;
| >  arma::colvec zbeta = ZArma * betaArma ;
| >  arma::mat AtRiskMatrixArma(AtRiskMatrix.begin(), nObs, nObs, true) ;
| >  arma::mat weightMatrixArma(weightMatrix.begin(), nObs, nObs, true) ;
| >  //arma::colvec TOADD(nParam) ;
| >  arma::mat TOADD(nParam, 1) ;
| >  TOADD.fill(0.5) ; // initial
| >
| > The following code gives me an error when I execute:
| >    S0 = (AtRiskMatrixArma % weightMatrixArma) * exp(zbeta) ;
| >    for(j=0; j<nParam; j++){
| >      S1.col(j) = (AtRiskMatrixArma % weightMatrixArma) * (exp(zbeta)
| > % ZArma.col(j)) ;
| >      for(k=0; k<nParam; k++){
| >        S2.subcube(0,j,k, nObs-1,j,k) = (AtRiskMatrixArma %
| > weightMatrixArma) * (exp(zbeta) % (ZArma.col(j) % ZArma.col(k)) ) ;
| >      }
| >    }
| >    for(j=0; j<nParam; j++){
| >      for(k=0; k<nParam; k++){
| >        S12.subcube(0,j,k, nObs-1,j,k) = S1.col(j) % S1.col(k) ;
| >      }
| >    }
| >
| > Basically, I'm trying to fill in S1, S2, etc, with computations from
| > other submatrices.  I get this error:
| >
| > R(1438,0x7fff708f8be0) malloc: *** error for object 0x100a0f008:
| > incorrect checksum for freed object - object was probably modified
| > after being freed.
| > *** set a breakpoint in malloc_error_break to debug
| >
| > I'm positive it's with this part of my code as my original code does
| > many loops instead of the matrix multiplication.  Now, I just want to
| > reduce it by using matrix algebra instead of loops.  Am I doing
| > anything logically wrong that I think objects are being destroyed?

-- 
  Regards, Dirk


More information about the Rcpp-devel mailing list