Xped
Loading...
Searching...
No Matches
TensorHelper.hpp
Go to the documentation of this file.
1#ifndef XPED_HELPER_H_
2#define XPED_HELPER_H_
3
4#include "Qbasis.hpp"
5
6namespace Xped {
7
8namespace internal {
9
10template <std::size_t Rank1, std::size_t Rank2, typename Symmetry, typename AllocationPolicy>
11std::pair<Qbasis<Symmetry, Rank2 + Rank1, AllocationPolicy>, std::array<Qbasis<Symmetry, 1, AllocationPolicy>, 0>>
12build_FusionTree_Helper(const Qbasis<Symmetry, Rank2, AllocationPolicy>& coupled,
13 const std::array<Qbasis<Symmetry, 1, AllocationPolicy>, Rank1>& uncoupled);
14
15template <std::size_t Rank, typename Symmetry, typename AllocationPolicy>
16Qbasis<Symmetry, Rank, AllocationPolicy> build_FusionTree(const std::array<Qbasis<Symmetry, 1, AllocationPolicy>, Rank>& uncoupled);
17
18} // namespace internal
19
20} // namespace Xped
21
22#ifndef XPED_COMPILED_LIB
23# include "Core/TensorHelper.cpp"
24#endif
25// template <typename MatrixType_>
26// MatrixType_ zero_init()
27// {
28// if constexpr(std::is_same<MatrixType_, Eigen::MatrixXd>::value) {
29// return Eigen::MatrixXd::Zero(1, 1);
30// } else if constexpr(std::is_same<MatrixType_, Eigen::SparseMatrix<double>>::value) {
31// Eigen::SparseMatrix<double> M(1, 1);
32// return M;
33// } else if constexpr(std::is_same<MatrixType_, Eigen::DiagonalMatrix<double, -1>>::value) {
34// Eigen::DiagonalMatrix<double, -1> M(1);
35// M.diagonal() << 0.;
36// return M;
37// }
38// }
39
40// template <typename MatrixType_>
41// string print_matrix(const MatrixType_& mat)
42// {
43// std::stringstream ss;
44// if constexpr(std::is_same<MatrixType_, Eigen::MatrixXd>::value) {
45// ss << mat;
46// return ss.str();
47// } else if constexpr(std::is_same<MatrixType_, Eigen::SparseMatrix<double>>::value) {
48// ss << mat;
49// return ss.str();
50// } else if constexpr(std::is_same<MatrixType_, Eigen::DiagonalMatrix<double, -1>>::value) {
51// ss << mat.toDenseMatrix();
52// return ss.str();
53// }
54// }
55
56#endif
Qbasis< Symmetry, Rank, AllocationPolicy > build_FusionTree(const std::array< Qbasis< Symmetry, 1, AllocationPolicy >, Rank > &uncoupled)
Definition: TensorHelper.cpp:29
std::pair< Qbasis< Symmetry, Rank2+Rank1, AllocationPolicy >, std::array< Qbasis< Symmetry, 1, AllocationPolicy >, 0 > > build_FusionTree_Helper(const Qbasis< Symmetry, Rank2, AllocationPolicy > &coupled, const std::array< Qbasis< Symmetry, 1, AllocationPolicy >, Rank1 > &uncoupled)
Definition: TensorHelper.cpp:13
Definition: bench.cpp:62
Definition: MatrixMultiplication.hpp:4