Xped
Loading...
Searching...
No Matches
Basis.hpp
Go to the documentation of this file.
1#ifndef BASIS_H_
2#define BASIS_H_
3
5#include "yas/serialize.hpp"
6#include "yas/std_types.hpp"
8
9namespace Xped {
10
11// forward declaration
12template <typename Symmetry, std::size_t depth, typename AllocationPolicy>
13class Qbasis;
14
20class Basis
21{
22 template <typename Symmetry_, std::size_t depth, typename AllocationPolicy>
23 friend class Qbasis;
24
25public:
27 Basis(){};
28
29 Basis(std::size_t dim_in)
30 : dim_(dim_in){};
31
32 inline const std::size_t dim() const { return dim_; }
33
35 Basis add(const Basis& other) const;
36
41 Basis combine(const Basis& other) const;
42
44 auto print() const;
45
47 auto printHistory() const;
48
49 inline bool operator==(const Basis& other) const { return (this->dim() == other.dim()); }
50
51 friend std::ostream& operator<<(std::ostream& os, const Basis& basis);
52
53 template <typename Ar>
54 void serialize(Ar& ar)
55 {
56 ar& YAS_OBJECT_NVP("Basis", ("dim", dim_), ("history", history));
57 }
58
59private:
60 std::size_t dim_;
61
62 struct fuseData
63 {
64 std::size_t dim1 = 0, dim2 = 0;
65 std::array<std::size_t, 2> source(std::size_t combined_num) const
66 {
67 std::size_t tmp = combined_num / dim1;
68 return {{combined_num - dim1 * tmp, tmp}};
69 };
70 template <typename Ar>
71 void serialize(Ar& ar)
72 {
73 ar& YAS_OBJECT_NVP("fuseData", ("dim1", dim1), ("dim2", dim2));
74 }
75 };
76
77 Basis::fuseData history;
78};
79
80} // namespace Xped
81
82#ifndef XPED_COMPILED_LIB
83# include "Core/Basis.cpp"
84#endif
85
86#endif
void serialize(Ar &ar) const
Definition: EigenPlugins.hpp:7
Definition: Basis.hpp:21
Basis add(const Basis &other) const
Definition: Basis.cpp:11
auto printHistory() const
Definition: Basis.cpp:51
Basis()
Definition: Basis.hpp:27
const std::size_t dim() const
Definition: Basis.hpp:32
Basis combine(const Basis &other) const
Definition: Basis.cpp:17
friend std::ostream & operator<<(std::ostream &os, const Basis &basis)
Definition: Basis.cpp:73
bool operator==(const Basis &other) const
Definition: Basis.hpp:49
Basis(std::size_t dim_in)
Definition: Basis.hpp:29
void serialize(Ar &ar)
Definition: Basis.hpp:54
auto print() const
Definition: Basis.cpp:26
Definition: Qbasis.hpp:39
Definition: bench.cpp:62