diff --git a/nonclass.cc b/nonclass.cc index 3258049..563f58d 100644 --- a/nonclass.cc +++ b/nonclass.cc @@ -1407,6 +1407,78 @@ const NRMat imagpart > >(const NRMat< std::c return result; } +template<> +const NRSMat realpart > >(const NRSMat< std::complex > &a) +{ + NRSMat result(a.nrows()); + +#ifdef CUDALA + if(a.location == cpu){ +#endif + cblas_dcopy(a.nrows()*(a.ncols()+1)/2, (const double *)(&a(0,0)), 2, result, 1); +#ifdef CUDALA + }else{ + laerror("not implemented for cuda yet"); + } +#endif + return result; +} + +template<> +const NRSMat imagpart > >(const NRSMat< std::complex > &a) +{ + NRSMat result(a.nrows()); + +#ifdef CUDALA + if(a.location == cpu){ +#endif + + cblas_dcopy(a.nrows()*(a.ncols()+1)/2, (const double *)(&a(0,0))+1, 2, result, 1); +#ifdef CUDALA + }else{ + laerror("not implemented for cuda yet"); + } +#endif + return result; +} + +template<> +const NRVec realpart > >(const NRVec< std::complex > &a) +{ + NRVec result(a.size()); + +#ifdef CUDALA + if(a.location == cpu){ +#endif + cblas_dcopy(a.size(), (const double *)&a[0], 2, result, 1); +#ifdef CUDALA + }else{ + laerror("not implemented for cuda yet"); + } +#endif + return result; +} + +template<> +const NRVec imagpart > >(const NRVec< std::complex > &a) +{ + NRVec result(a.size()); + +#ifdef CUDALA + if(a.location == cpu){ +#endif + + cblas_dcopy(a.size(), (const double *)&a[0]+1, 2, result, 1); +#ifdef CUDALA + }else{ + laerror("not implemented for cuda yet"); + } +#endif + return result; +} + + + template<> const NRMat< std::complex > realmatrix > (const NRMat &a) {