diff --git a/nonclass.cc b/nonclass.cc index 94130a1..1804cec 100644 --- a/nonclass.cc +++ b/nonclass.cc @@ -1523,6 +1523,24 @@ double trace2(const NRMat &a, const NRMat &b, bool trb) return sum; } +// LV +complex trace2(const NRMat > &a, const NRMat > &b, bool adjb) +{ + if (adjb && (a.nrows() != b.nrows() || a.ncols() != b.ncols()) || + !adjb && (a.nrows() != b.ncols() || a.ncols() != b.nrows())) + laerror("incompatible Mats in trace2()"); + + complex dot; + if (adjb) { cblas_zdotc_sub(a.nrows()*a.ncols(), b, 1, a, 1, &dot); return dot; } + + complex sum = complex(0.,0.); + for (int i=0; i &a, const NRSMat &b, const bool diagscaled)