10 template <
typename T> T vec_bdm_vec(vector<T>
const &psi1, std::vector<matrix<T>>
const &M, vector<T>
const &psi2) {
13 for (
int bl = 0; bl < M.size(); ++bl) {
14 int d = M[bl].shape()[0];
15 if (d != M[bl].shape()[1]) TRIQS_RUNTIME_ERROR <<
"vec_bdm_vec: the matrix of block " << bl <<
" is not square !";
17 for (
int a = 0; a < d; ++a) {
19 for (
int b = 0; b < d; ++b) tmp += M[bl](a, b) * psi2(block_start + b);
20 r += triqs::utility::conj(psi1(block_start + a)) * tmp;
28 template <
typename T> T dot_product(matrix<T>
const &a, matrix<T>
const &b) {
30 int dim1 = a.shape()[0], dim2 = a.shape()[1];
31 if ((dim1 != b.shape()[1]) || (dim2 != b.shape()[0])) TRIQS_RUNTIME_ERROR <<
"dot_product of matrices : size mismatch";
32 for (
int i = 0; i < dim1; ++i)
33 for (
int j = 0; j < dim2; ++j) r += triqs::utility::conj(a(i, j)) * b(j, i);