Healpix C++  3.83
weight_utils.h
Go to the documentation of this file.
1 /*
2  * This file is part of Healpix_cxx.
3  *
4  * Healpix_cxx is free software; you can redistribute it and/or modify
5  * it under the terms of the GNU General Public License as published by
6  * the Free Software Foundation; either version 2 of the License, or
7  * (at your option) any later version.
8  *
9  * Healpix_cxx is distributed in the hope that it will be useful,
10  * but WITHOUT ANY WARRANTY; without even the implied warranty of
11  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
12  * GNU General Public License for more details.
13  *
14  * You should have received a copy of the GNU General Public License
15  * along with Healpix_cxx; if not, write to the Free Software
16  * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
17  *
18  * For more information about HEALPix, see http://healpix.sourceforge.net
19  */
20 
21 /*
22  * Healpix_cxx is being developed at the Max-Planck-Institut fuer Astrophysik
23  * and financially supported by the Deutsches Zentrum fuer Luft- und Raumfahrt
24  * (DLR).
25  */
26 
27 /*! \file weight_utils.h
28  *
29  * Copyright (C) 2016-2019 Max-Planck-Society
30  * \author Martin Reinecke
31  */
32 
33 #ifndef PLANCK_WEIGHT_UTILS_H
34 #define PLANCK_WEIGHT_UTILS_H
35 
36 #include <vector>
37 #include <memory>
38 #include "healpix_map.h"
39 
40 /*! Applies the vector \a wgt containing compressed full weights to \a map. */
41 template<typename T>void apply_fullweights (Healpix_Map<T> &map,
42  const std::vector<double> &wgt);
43 
44 /*! Computes full weights for a map of the given \a nside at a maximum
45  multipole \a lmax. The solution is obtained via CGNE iteration, which stops
46  once the norm of the residual falls below \a epsilon times the norm of the
47  initial residual, or once \a itmax iterations have been performed.
48  \returns a vector containing the compressed full weights.
49  \note \a lmax must be even; odd \a l do not contribute to the weights. */
50 std::vector<double> get_fullweights(int nside, int lmax, double epsilon,
51  int itmax, double &epsilon_out);
52 
53 /*! Computes ring weights for a map of the given \a nside at a maximum
54  multipole \a lmax. The solution is obtained via CGNE iteration, which stops
55  once the norm of the residual falls below \a epsilon times the norm of the
56  initial residual, or once \a itmax iterations have been performed.
57  \returns a vector of size \c 2*nside containing the ring weights.
58  \note \a lmax must be even; odd \a l do not contribute to the weights. */
59 std::vector<double> get_ringweights(int nside, int lmax, double epsilon,
60  int itmax, double &epsilon_out);
61 
62 namespace weight_utils_detail {
63 
64 class FullWeightImpl;
65 
66 }
67 
68 class FullWeightComputer
69  {
70  private:
71  std::unique_ptr<weight_utils_detail::FullWeightImpl> impl;
72  public:
73  FullWeightComputer(int nside, int lmax);
74  ~FullWeightComputer();
75  void iterate(int niter);
76  std::vector<double> current_alm() const;
77  std::vector<double> alm2wgt(const std::vector<double> &alm) const;
78  double current_epsilon() const;
79  int current_iter() const;
80  };
81 
82 #endif
std::vector< double > get_ringweights(int nside, int lmax, double epsilon, int itmax, double &epsilon_out)
void apply_fullweights(Healpix_Map< T > &map, const std::vector< double > &wgt)
std::vector< double > get_fullweights(int nside, int lmax, double epsilon, int itmax, double &epsilon_out)

Generated on Wed Nov 13 2024 12:18:30 for Healpix C++