# [Rcpp-devel] Regression in conversion from NumericVector to ComplexVector?

Dirk Eddelbuettel edd at debian.org
Sat Dec 18 16:55:58 CET 2010

```Christian,

Just to follow up some more:  I just played with a few lines of Armadillo
code and it seems pretty clear.  To create a complex matrix, you need two
standard ones. So no implicit conversions.

Now, on a strictly personal level: I haven't had a use case for complex
numbers since the last time it came up in graduate school, so I am unlikely
to push this cart very far for you.

If you need something the code currently doesn't do, please do document the
failure with a working example from, say, Arma and Romain and I will look
into it.   If there is something we already do -- but do NOT test for, please
let us know by submitting patches to the unit tests.

Cheers, Dirk

int main(void) {

arma::mat a(3, 3), b(3, 3); 		// two matrices to create cx_mat from
a.fill(1.0);
b.fill(-1.0);
arma::cx_mat tmpc(a, b);
arma::mat tmpd(3, 3);
tmpd.fill(2.0);
tmpc = tmpc + tmpd;			// test 1
std::cout << tmpc;

//arma::cx_mat tt(tmpd);		// test 2 -- fails as copy assignment or ctor from single mat
//std::cout << tt;

return 0;
}

edd at max:~\$ g++ -Wall -pedantic -o /tmp/xianArma /tmp/xianArma.cpp
edd at max:~\$ /tmp/xianArma
(+3.000e+00,-1.000e+00)    (+3.000e+00,-1.000e+00)    (+3.000e+00,-1.000e+00)
(+3.000e+00,-1.000e+00)    (+3.000e+00,-1.000e+00)    (+3.000e+00,-1.000e+00)
(+3.000e+00,-1.000e+00)    (+3.000e+00,-1.000e+00)    (+3.000e+00,-1.000e+00)
edd at max:~\$

--
Dirk Eddelbuettel | edd at debian.org | http://dirk.eddelbuettel.com
```