diff --git a/mat.h b/mat.h index 1e0ff9b..56dd33b 100644 --- a/mat.h +++ b/mat.h @@ -322,7 +322,7 @@ public: //! transpose this matrix and return the result by value const NRMat transpose(bool conj = false) const; //! conjugate this matrix and return the result by value - const NRMat conjugate() const; + const NRMat conjugate() const {NRMat r(*this); r.conjugateme(); return r;}; //! extract specified submatrix const NRMat submatrix(const int fromrow, const int torow, const int fromcol, const int tocol) const; @@ -1258,6 +1258,19 @@ NRMat > complexify(const NRMat &rhs) { return r; } +//this is general for any type, complexmatrix() uses blas for doubles +template +NRMat > complexify(const NRMat &rhsr, const NRMat &rhsi) { + NOT_GPU(rhsr); + NOT_GPU(rhsi); + if(rhsr.nrows()!=rhsi.nrows() || rhsr.ncols()!=rhsi.ncols()) laerror("inconsistent dimensions in complexify"); + NRMat > r(rhsr.nrows(), rhsr.ncols(), rhsr.getlocation()); + for(register int i=0; i(rhsr(i,j),rhsi(i,j)); + } + return r; +} + /***************************************************************************//** * output operator * @param[in,out] s output stream