Skip to content

Commit

Permalink
Merge pull request #88 from SpM-lab/terasaki/update-augment-part2
Browse files Browse the repository at this point in the history
Allow to accept basif_f
  • Loading branch information
terasakisatoshi authored Jan 30, 2025
2 parents e037346 + f4ffca5 commit a3ff815
Showing 1 changed file with 8 additions and 8 deletions.
16 changes: 8 additions & 8 deletions include/sparseir/augment.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -228,21 +228,21 @@ class AugmentedTauFunction {
}
};

template <typename S>
class AugmentedMatsubaraFunction {
public:
template<typename S>
using MatsubaraVec = PiecewiseLegendreFTVector<S>;

const MatsubaraVec<Bosonic>& basis_func;
const MatsubaraVec& basis_func;
const std::vector<std::shared_ptr<AbstractAugmentation>>& augmentations;

AugmentedMatsubaraFunction(const MatsubaraVec<Bosonic>& basis_func,
AugmentedMatsubaraFunction(const MatsubaraVec& basis_func,
const std::vector<std::shared_ptr<AbstractAugmentation>>& augmentations)
: basis_func(basis_func)
, augmentations(augmentations) {}

template<typename S>
std::complex<double> operator()(MatsubaraFreq<S> n) const {
template<typename T>
std::complex<double> operator()(MatsubaraFreq<T> n) const {
std::complex<double> result = basis_func(n);
for (const auto& aug : augmentations) {
result += (*aug)(n);
Expand All @@ -262,15 +262,15 @@ class AugmentedBasis : public AbstractBasis<S> {
std::shared_ptr<FiniteTempBasis<S>> basis_;
std::vector<std::shared_ptr<AbstractAugmentation>> augmentations_;
std::unique_ptr<AugmentedTauFunction> u_;
std::unique_ptr<AugmentedMatsubaraFunction> uhat_;
std::unique_ptr<AugmentedMatsubaraFunction<S>> uhat_;

public:
AugmentedBasis(std::shared_ptr<FiniteTempBasis<S>> basis,
const std::vector<std::shared_ptr<AbstractAugmentation>>& augmentations)
: basis_(basis)
, augmentations_(augmentations)
, u_(std::make_unique<AugmentedTauFunction>(basis->u, augmentations))
, uhat_(std::make_unique<AugmentedMatsubaraFunction>(basis->uhat, augmentations)) {}
, uhat_(std::make_unique<AugmentedMatsubaraFunction<S>>(basis->uhat, augmentations)) {}

// Prevent copying, allow moving
AugmentedBasis(const AugmentedBasis&) = delete;
Expand All @@ -297,7 +297,7 @@ class AugmentedBasis : public AbstractBasis<S> {

// Accessors
const AugmentedTauFunction& u() const { return *u_; }
const AugmentedMatsubaraFunction& uhat() const { return *uhat_; }
const AugmentedMatsubaraFunction<S>& uhat() const { return *uhat_; }
size_t nAug() const { return augmentations_.size(); }

// Factory method
Expand Down

0 comments on commit a3ff815

Please sign in to comment.