Skip to content
Prev 2374 / 10988 Next

[Rcpp-devel] trans() changed in latest RcppArmadillo

Sorry, I had too many spaces in the vectors. The conclusion is the same though.

library(inline)
require( RcppArmadillo )
	
## let's calculate this product
c(-1-1i, 1-1i) %*% c(1i, -1i)
 ## 0-2i

## trans() with v0.2.19
fx <- cxxfunction( signature() , '
 arma::cx_colvec A = "(-1,-1) (+1,-1);", B = "(+0,1) (+0,-1);" ;
		arma::cx_colvec res = trans(A) * B;

		return wrap( res ) ;
	', plugin = "RcppArmadillo" )

fx()
## 0-2i

## strans() with v0.2.21
fx <- cxxfunction( signature() , '
 arma::cx_colvec A = "(-1,-1) (+1,-1);", B = "(+0,1) (+0,-1);" ;
		arma::cx_colvec res = strans(A) * B;
		return wrap( res ) ;
	', plugin = "RcppArmadillo" )

fx()
## 1-1i
On 31 May 2011 11:42, baptiste auguie <baptiste.auguie at googlemail.com> wrote: