Loading cmake/dca_config.cmake +13 −2 Original line number Diff line number Diff line Loading @@ -68,7 +68,8 @@ else() endif() # Lattice type set(DCA_LATTICE "square" CACHE STRING "Lattice type, options are: bilayer | square | triangular.") set(DCA_LATTICE "square" CACHE STRING "Lattice type, options are: bilayer | square | triangular | twoband_chain | singleband_chain .") set_property(CACHE DCA_LATTICE PROPERTY STRINGS bilayer square triangular) if (DCA_LATTICE STREQUAL "bilayer") Loading @@ -86,8 +87,18 @@ elseif (DCA_LATTICE STREQUAL "triangular") set(DCA_LATTICE_INCLUDE "dca/phys/models/analytic_hamiltonians/triangular_lattice.hpp") elseif (DCA_LATTICE STREQUAL "twoband_chain") set(DCA_LATTICE_TYPE dca::phys::models::twoband_chain<dca::phys::domains::no_symmetry<1>>) set(DCA_LATTICE_INCLUDE "dca/phys/models/analytic_hamiltonians/twoband_chain.hpp") elseif (DCA_LATTICE STREQUAL "singleband_chain") set(DCA_LATTICE_TYPE dca::phys::models::singleband_chain<dca::phys::domains::no_symmetry<1>>) set(DCA_LATTICE_INCLUDE "dca/phys/models/analytic_hamiltonians/singleband_chain.hpp") else() message(FATAL_ERROR "Please set DCA_LATTICE to a valid option: bilayer | square | triangular.") message(FATAL_ERROR "Please set DCA_LATTICE to a valid option: bilayer | square | triangular | twoband_chain | singleband_chain .") endif() # Model type Loading include/dca/function/util/real_complex_conversion.hpp +1 −1 Original line number Diff line number Diff line Loading @@ -42,7 +42,7 @@ auto real(const function<std::complex<Scalartype>, Dmn>& f, const bool check_ima function<Scalartype, Dmn> f_real; for (int i = 0; i < f_real.size(); ++i) { if (check_imaginary && std::abs(f(i).imag()) > 10 * std::numeric_limits<Scalartype>::epsilon()) if (check_imaginary && std::abs(f(i).imag()) > 500 * std::numeric_limits<Scalartype>::epsilon()) throw(std::logic_error("The function is not purely real.")); f_real(i) = f(i).real(); Loading include/dca/linalg/matrixop.hpp +13 −0 Original line number Diff line number Diff line Loading @@ -11,6 +11,7 @@ // This file provides the matrix interface for the following matrix operations: // - copyCol, copyRow, copyCols, copyRows // - difference // - real // - insertCol, insertRow (for CPU matrices only) // - inverse // - removeCol, removeCols, removeRow, removeRows, removeRowAndCol, removeRowAndCols Loading Loading @@ -204,6 +205,18 @@ auto difference(const Matrix<ScalarType, device_name_a>& a, return difference(a, cp_b, diff_threshold); } // Returns the real part of a matrix. // In: a // TODO test. template <typename ScalarType> Matrix<ScalarType, CPU> real(const Matrix<std::complex<ScalarType>, CPU>& a) { Matrix<ScalarType, CPU> a_re(a.size()); for (int j = 0; j < a.nrCols(); ++j) for (int i = 0; i < a.nrRows(); ++i) a_re(i, j) = std::real(a(i, j)); return a_re; } // Insert a column at position j. The data is moved accordingly. // In/Out: mat // Preconditions: 0 <= j < mat.nrCols() + 1. Loading include/dca/math/function_transform/function_transform.hpp +59 −11 Original line number Diff line number Diff line Loading @@ -18,6 +18,9 @@ #include "dca/function/function.hpp" #include "dca/linalg/matrix.hpp" #include "dca/math/function_transform/domainwise_function_transform.hpp" #include "dca/math/function_transform/special_transforms/momentum_to_space.hpp" #include "dca/math/function_transform/special_transforms/space_to_momentum.hpp" #include "dca/phys/domains/cluster/cluster_domain.hpp" #include "dca/util/type_list.hpp" namespace dca { Loading @@ -35,7 +38,8 @@ class FunctionTransform<func::dmn_0<type_input>, func::dmn_0<type_output>> { const static bool VERBOSE = false; public: template <typename scalartype_input, class domain_input, typename scalartype_output, class domain_output> template <typename scalartype_input, class domain_input, typename scalartype_output, class domain_output> static void execute(const func::function<scalartype_input, domain_input>& f_input, func::function<scalartype_output, domain_output>& f_output) { if (VERBOSE) Loading @@ -45,7 +49,8 @@ public: typename dca::func::SWAP_FIRST<domain_input, type_input, type_output>::Result; dca::util::assert_same<TRANSFORMED_DOMAIN, domain_output>(); DomainwiseFunctionTransform<domain_input, domain_output, type_input, type_output>::execute_on_first( DomainwiseFunctionTransform<domain_input, domain_output, type_input, type_output>::execute_on_first( f_input, f_output); } Loading @@ -61,11 +66,13 @@ public: typename dca::func::SWAP_FIRST<domain_input, type_input, type_output>::Result; dca::util::assert_same<TRANSFORMED_DOMAIN, domain_output>(); DomainwiseFunctionTransform<domain_input, domain_output, type_input, type_output>::execute_on_first( DomainwiseFunctionTransform<domain_input, domain_output, type_input, type_output>::execute_on_first( f_input, f_output, T); } template <typename scalartype_input, class domain_input, typename scalartype_output, class domain_output> template <typename scalartype_input, class domain_input, typename scalartype_output, class domain_output> static void execute_on_all(const func::function<scalartype_input, domain_input>& f_input, func::function<scalartype_output, domain_output>& f_output) { if (VERBOSE) Loading @@ -76,7 +83,8 @@ public: dca::util::assert_same<TRANSFORMED_DOMAIN, domain_output>(); DomainwiseFunctionTransform<domain_input, domain_output, type_input, type_output>::execute_on_all( DomainwiseFunctionTransform<domain_input, domain_output, type_input, type_output>::execute_on_all( f_input, f_output); } Loading @@ -93,12 +101,14 @@ public: dca::util::assert_same<TRANSFORMED_DOMAIN, domain_output>(); DomainwiseFunctionTransform<domain_input, domain_output, type_input, type_output>::execute_on_all( DomainwiseFunctionTransform<domain_input, domain_output, type_input, type_output>::execute_on_all( f_input, f_output, T); } private: template <typename scalartype_input, class domain_input, typename scalartype_output, class domain_output> template <typename scalartype_input, class domain_input, typename scalartype_output, class domain_output> static void print_types(const func::function<scalartype_input, domain_input>& f_input, const func::function<scalartype_output, domain_output>& f_output, const bool do_all_domains = false) { Loading Loading @@ -150,6 +160,44 @@ private: } }; // Specialization for momentum to space transform. template <typename DmnScalar, int dim, phys::domains::CLUSTER_NAMES c_name, phys::domains::CLUSTER_SHAPE c_shape> class FunctionTransform< func::dmn_0<phys::domains::cluster_domain<DmnScalar, dim, c_name, phys::domains::MOMENTUM_SPACE, c_shape>>, func::dmn_0<phys::domains::cluster_domain<DmnScalar, dim, c_name, phys::domains::REAL_SPACE, c_shape>>> { using KDmn = func::dmn_0< phys::domains::cluster_domain<DmnScalar, dim, c_name, phys::domains::MOMENTUM_SPACE, c_shape>>; using RDmn = func::dmn_0< phys::domains::cluster_domain<DmnScalar, dim, c_name, phys::domains::REAL_SPACE, c_shape>>; public: template <typename ScalarInp, typename ScalarOut, class DomainInput, class DomainOutput> static void execute(const func::function<ScalarInp, DomainInput>& f_input, func::function<ScalarOut, DomainOutput>& f_output) { MomentumToSpaceTransform<KDmn, RDmn>::execute(f_input, f_output); } }; // Specialization for space to momentum transformation. template <typename DmnScalar, int dim, phys::domains::CLUSTER_NAMES c_name, phys::domains::CLUSTER_SHAPE c_shape> class FunctionTransform< func::dmn_0<phys::domains::cluster_domain<DmnScalar, dim, c_name, phys::domains::REAL_SPACE, c_shape>>, func::dmn_0<phys::domains::cluster_domain<DmnScalar, dim, c_name, phys::domains::MOMENTUM_SPACE, c_shape>>> { using KDmn = func::dmn_0< phys::domains::cluster_domain<DmnScalar, dim, c_name, phys::domains::MOMENTUM_SPACE, c_shape>>; using RDmn = func::dmn_0< phys::domains::cluster_domain<DmnScalar, dim, c_name, phys::domains::REAL_SPACE, c_shape>>; public: template <typename ScalarInp, typename ScalarOut, class DomainInput, class DomainOutput> static void execute(const func::function<ScalarInp, DomainInput>& f_input, func::function<ScalarOut, DomainOutput>& f_output) { SpaceToMomentumTransform<RDmn, KDmn>::execute(f_input, f_output); } }; } // transform } // math } // dca Loading include/dca/math/function_transform/special_transforms/kernels_interface.hpp +4 −2 Original line number Diff line number Diff line Loading @@ -23,8 +23,10 @@ namespace details { // dca::math::transform::details:: template <typename Real> void rearrangeResult(const std::complex<Real>* in, int ldi, std::complex<Real>* out, int ldo, int nb, int nk, int nw, cudaStream_t stream); void phaseFactorsAndRearrange(const std::complex<Real> *in, const int ldi, std::complex<Real> *out, const int ldo, const int nb, const int nk, const int nw, const std::complex<Real> *phase_factors, cudaStream_t const stream); } // details } // transform Loading Loading
cmake/dca_config.cmake +13 −2 Original line number Diff line number Diff line Loading @@ -68,7 +68,8 @@ else() endif() # Lattice type set(DCA_LATTICE "square" CACHE STRING "Lattice type, options are: bilayer | square | triangular.") set(DCA_LATTICE "square" CACHE STRING "Lattice type, options are: bilayer | square | triangular | twoband_chain | singleband_chain .") set_property(CACHE DCA_LATTICE PROPERTY STRINGS bilayer square triangular) if (DCA_LATTICE STREQUAL "bilayer") Loading @@ -86,8 +87,18 @@ elseif (DCA_LATTICE STREQUAL "triangular") set(DCA_LATTICE_INCLUDE "dca/phys/models/analytic_hamiltonians/triangular_lattice.hpp") elseif (DCA_LATTICE STREQUAL "twoband_chain") set(DCA_LATTICE_TYPE dca::phys::models::twoband_chain<dca::phys::domains::no_symmetry<1>>) set(DCA_LATTICE_INCLUDE "dca/phys/models/analytic_hamiltonians/twoband_chain.hpp") elseif (DCA_LATTICE STREQUAL "singleband_chain") set(DCA_LATTICE_TYPE dca::phys::models::singleband_chain<dca::phys::domains::no_symmetry<1>>) set(DCA_LATTICE_INCLUDE "dca/phys/models/analytic_hamiltonians/singleband_chain.hpp") else() message(FATAL_ERROR "Please set DCA_LATTICE to a valid option: bilayer | square | triangular.") message(FATAL_ERROR "Please set DCA_LATTICE to a valid option: bilayer | square | triangular | twoband_chain | singleband_chain .") endif() # Model type Loading
include/dca/function/util/real_complex_conversion.hpp +1 −1 Original line number Diff line number Diff line Loading @@ -42,7 +42,7 @@ auto real(const function<std::complex<Scalartype>, Dmn>& f, const bool check_ima function<Scalartype, Dmn> f_real; for (int i = 0; i < f_real.size(); ++i) { if (check_imaginary && std::abs(f(i).imag()) > 10 * std::numeric_limits<Scalartype>::epsilon()) if (check_imaginary && std::abs(f(i).imag()) > 500 * std::numeric_limits<Scalartype>::epsilon()) throw(std::logic_error("The function is not purely real.")); f_real(i) = f(i).real(); Loading
include/dca/linalg/matrixop.hpp +13 −0 Original line number Diff line number Diff line Loading @@ -11,6 +11,7 @@ // This file provides the matrix interface for the following matrix operations: // - copyCol, copyRow, copyCols, copyRows // - difference // - real // - insertCol, insertRow (for CPU matrices only) // - inverse // - removeCol, removeCols, removeRow, removeRows, removeRowAndCol, removeRowAndCols Loading Loading @@ -204,6 +205,18 @@ auto difference(const Matrix<ScalarType, device_name_a>& a, return difference(a, cp_b, diff_threshold); } // Returns the real part of a matrix. // In: a // TODO test. template <typename ScalarType> Matrix<ScalarType, CPU> real(const Matrix<std::complex<ScalarType>, CPU>& a) { Matrix<ScalarType, CPU> a_re(a.size()); for (int j = 0; j < a.nrCols(); ++j) for (int i = 0; i < a.nrRows(); ++i) a_re(i, j) = std::real(a(i, j)); return a_re; } // Insert a column at position j. The data is moved accordingly. // In/Out: mat // Preconditions: 0 <= j < mat.nrCols() + 1. Loading
include/dca/math/function_transform/function_transform.hpp +59 −11 Original line number Diff line number Diff line Loading @@ -18,6 +18,9 @@ #include "dca/function/function.hpp" #include "dca/linalg/matrix.hpp" #include "dca/math/function_transform/domainwise_function_transform.hpp" #include "dca/math/function_transform/special_transforms/momentum_to_space.hpp" #include "dca/math/function_transform/special_transforms/space_to_momentum.hpp" #include "dca/phys/domains/cluster/cluster_domain.hpp" #include "dca/util/type_list.hpp" namespace dca { Loading @@ -35,7 +38,8 @@ class FunctionTransform<func::dmn_0<type_input>, func::dmn_0<type_output>> { const static bool VERBOSE = false; public: template <typename scalartype_input, class domain_input, typename scalartype_output, class domain_output> template <typename scalartype_input, class domain_input, typename scalartype_output, class domain_output> static void execute(const func::function<scalartype_input, domain_input>& f_input, func::function<scalartype_output, domain_output>& f_output) { if (VERBOSE) Loading @@ -45,7 +49,8 @@ public: typename dca::func::SWAP_FIRST<domain_input, type_input, type_output>::Result; dca::util::assert_same<TRANSFORMED_DOMAIN, domain_output>(); DomainwiseFunctionTransform<domain_input, domain_output, type_input, type_output>::execute_on_first( DomainwiseFunctionTransform<domain_input, domain_output, type_input, type_output>::execute_on_first( f_input, f_output); } Loading @@ -61,11 +66,13 @@ public: typename dca::func::SWAP_FIRST<domain_input, type_input, type_output>::Result; dca::util::assert_same<TRANSFORMED_DOMAIN, domain_output>(); DomainwiseFunctionTransform<domain_input, domain_output, type_input, type_output>::execute_on_first( DomainwiseFunctionTransform<domain_input, domain_output, type_input, type_output>::execute_on_first( f_input, f_output, T); } template <typename scalartype_input, class domain_input, typename scalartype_output, class domain_output> template <typename scalartype_input, class domain_input, typename scalartype_output, class domain_output> static void execute_on_all(const func::function<scalartype_input, domain_input>& f_input, func::function<scalartype_output, domain_output>& f_output) { if (VERBOSE) Loading @@ -76,7 +83,8 @@ public: dca::util::assert_same<TRANSFORMED_DOMAIN, domain_output>(); DomainwiseFunctionTransform<domain_input, domain_output, type_input, type_output>::execute_on_all( DomainwiseFunctionTransform<domain_input, domain_output, type_input, type_output>::execute_on_all( f_input, f_output); } Loading @@ -93,12 +101,14 @@ public: dca::util::assert_same<TRANSFORMED_DOMAIN, domain_output>(); DomainwiseFunctionTransform<domain_input, domain_output, type_input, type_output>::execute_on_all( DomainwiseFunctionTransform<domain_input, domain_output, type_input, type_output>::execute_on_all( f_input, f_output, T); } private: template <typename scalartype_input, class domain_input, typename scalartype_output, class domain_output> template <typename scalartype_input, class domain_input, typename scalartype_output, class domain_output> static void print_types(const func::function<scalartype_input, domain_input>& f_input, const func::function<scalartype_output, domain_output>& f_output, const bool do_all_domains = false) { Loading Loading @@ -150,6 +160,44 @@ private: } }; // Specialization for momentum to space transform. template <typename DmnScalar, int dim, phys::domains::CLUSTER_NAMES c_name, phys::domains::CLUSTER_SHAPE c_shape> class FunctionTransform< func::dmn_0<phys::domains::cluster_domain<DmnScalar, dim, c_name, phys::domains::MOMENTUM_SPACE, c_shape>>, func::dmn_0<phys::domains::cluster_domain<DmnScalar, dim, c_name, phys::domains::REAL_SPACE, c_shape>>> { using KDmn = func::dmn_0< phys::domains::cluster_domain<DmnScalar, dim, c_name, phys::domains::MOMENTUM_SPACE, c_shape>>; using RDmn = func::dmn_0< phys::domains::cluster_domain<DmnScalar, dim, c_name, phys::domains::REAL_SPACE, c_shape>>; public: template <typename ScalarInp, typename ScalarOut, class DomainInput, class DomainOutput> static void execute(const func::function<ScalarInp, DomainInput>& f_input, func::function<ScalarOut, DomainOutput>& f_output) { MomentumToSpaceTransform<KDmn, RDmn>::execute(f_input, f_output); } }; // Specialization for space to momentum transformation. template <typename DmnScalar, int dim, phys::domains::CLUSTER_NAMES c_name, phys::domains::CLUSTER_SHAPE c_shape> class FunctionTransform< func::dmn_0<phys::domains::cluster_domain<DmnScalar, dim, c_name, phys::domains::REAL_SPACE, c_shape>>, func::dmn_0<phys::domains::cluster_domain<DmnScalar, dim, c_name, phys::domains::MOMENTUM_SPACE, c_shape>>> { using KDmn = func::dmn_0< phys::domains::cluster_domain<DmnScalar, dim, c_name, phys::domains::MOMENTUM_SPACE, c_shape>>; using RDmn = func::dmn_0< phys::domains::cluster_domain<DmnScalar, dim, c_name, phys::domains::REAL_SPACE, c_shape>>; public: template <typename ScalarInp, typename ScalarOut, class DomainInput, class DomainOutput> static void execute(const func::function<ScalarInp, DomainInput>& f_input, func::function<ScalarOut, DomainOutput>& f_output) { SpaceToMomentumTransform<RDmn, KDmn>::execute(f_input, f_output); } }; } // transform } // math } // dca Loading
include/dca/math/function_transform/special_transforms/kernels_interface.hpp +4 −2 Original line number Diff line number Diff line Loading @@ -23,8 +23,10 @@ namespace details { // dca::math::transform::details:: template <typename Real> void rearrangeResult(const std::complex<Real>* in, int ldi, std::complex<Real>* out, int ldo, int nb, int nk, int nw, cudaStream_t stream); void phaseFactorsAndRearrange(const std::complex<Real> *in, const int ldi, std::complex<Real> *out, const int ldo, const int nb, const int nk, const int nw, const std::complex<Real> *phase_factors, cudaStream_t const stream); } // details } // transform Loading