diff --git a/nonclass.h b/nonclass.h index 24f5503..52b8a4a 100644 --- a/nonclass.h +++ b/nonclass.h @@ -9,8 +9,15 @@ //MISC export template -const NRSMat twoside_transform(const NRSMat &S, const NRMat &C) //calculate C^dagger S C +const NRSMat twoside_transform(const NRSMat &S, const NRMat &C, bool transp=0) //calculate C^dagger S C { +if(transp) + { + NRMat tmp = C * S; + NRMat result(C.rows(),C.nrows()); + result.gemm((T)0,tmp,'n',C,'t',(T)1); + return NRSMat(result); + } NRMat tmp = S * C; NRMat result(C.ncols(),C.ncols()); result.gemm((T)0,C,'t',tmp,'n',(T)1); @@ -18,16 +25,6 @@ return NRSMat(result); } -export template -const NRSMat twoside_transform_t(const NRSMat &S, const NRMat &C) //calculate C S C^dagger -{ -NRMat tmp = C * S; -NRMat result(C.rows(),C.nrows()); -result.gemm((T)0,tmp,'n',C,'t',(T)1); -return NRSMat(result); -} - - export template