/******************************************************************************* * * TRIQS: a Toolbox for Research in Interacting Quantum Systems * * Copyright (C) 2014 by O. Parcollet * * TRIQS is free software: you can redistribute it and/or modify it under the * terms of the GNU General Public License as published by the Free Software * Foundation, either version 3 of the License, or (at your option) any later * version. * * TRIQS is distributed in the hope that it will be useful, but WITHOUT ANY * WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS * FOR A PARTICULAR PURPOSE. See the GNU General Public License for more * details. * * You should have received a copy of the GNU General Public License along with * TRIQS. If not, see . * ******************************************************************************/ #pragma once #include "./product.hpp" #include "./meshes/matsubara_freq.hpp" namespace triqs { namespace gfs { DEAD CODE struct matrix_operations {}; // in this version, we store all frequencies, to be able to write matrix operation simply. // memory usage is x2 too large in principle. // short cut. Here only the change compare to default multi var implementation using imfreq_x2 = cartesian_product; // reimplement a simpler constructor, which enforces that the 2 meshes are equal. template struct gf_mesh : mesh_product { using B = mesh_product; gf_mesh() = default; gf_mesh(matsubara_freq_mesh const& m) : B{m, m} {} //gf_mesh(matsubara_freq_mesh const & m1, matsubara_freq_mesh const& m2) : B{m1,m2} {} //needed for curry. DO NOT document. template gf_mesh(T&&... x) : B{matsubara_freq_mesh(std::forward(x)...), matsubara_freq_mesh(std::forward(x)...)} {} }; // The default target for this mesh template <> struct gf_default_target { using type = tensor_valued<4>; }; namespace gfs_implementation { /// --------------------------- data access --------------------------------- struct imfreq_x2_indices_mixer { template static auto invoke(MI const& m, TI const& t) { return std::make_tuple(std::get<0>(m), std::get<0>(t), std::get<1>(t), std::get<1>(m), std::get<2>(t), std::get<3>(t)); } }; template <> struct data_proxy, void> : data_proxy_array_index_mixer, 2, 4, imfreq_x2_indices_mixer> { //template auto operator()(S& data, Tu const& tu) const { // return data(std::get<0>(tu), arrays::range(), std::get<1>(tu), arrays::range(), std::get<2>(tu), arrays::range()); // } }; /* // Change the ordering of the indices in the array to allow matrix operations template struct data_proxy, Opt> : data_proxy_array_common, 6> { template static utility::mini_vector join_shape(S1 const& s1, S2 const& s2) { return {int(s1[0]), s2[0], int(s1[1]), s2[1]}; // TODO : clean this size_t.... } template AUTO_DECL operator()(S& data, Tu const& tu) const RETURN(make_matrix_view(data(std::get<0>(tu), arrays::range(), std::get<1>(tu), arrays::range()))); }; */ } // gfs_implementation /// --------------------------- inverse --------------------------------- // the generic inverse is fine. We only need to redo the invert_in_place. template void invert_in_place(gf_view g) { auto arr = make_matrix_view(group_indices_view(g.data(), {0, 1, 2}, {3, 4, 5})); // a view of the array properly regrouped arr = inverse(arr); // inverse as a big matrix (nu,n) x (nu', n') // no singularity } } }