LOOS  v2.3.2
GridUtils.cpp
1 /*
2  Utility functions/classes for LOOS grids
3 */
4 
5 /*
6  This file is part of LOOS.
7 
8  LOOS (Lightweight Object-Oriented Structure library)
9  Copyright (c) 2009, Tod D. Romo, Alan Grossfield
10  Department of Biochemistry and Biophysics
11  School of Medicine & Dentistry, University of Rochester
12 
13  This package (LOOS) is free software: you can redistribute it and/or modify
14  it under the terms of the GNU General Public License as published by
15  the Free Software Foundation under version 3 of the License.
16 
17  This package is distributed in the hope that it will be useful,
18  but WITHOUT ANY WARRANTY; without even the implied warranty of
19  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
20  GNU General Public License for more details.
21 
22  You should have received a copy of the GNU General Public License
23  along with this program. If not, see <http://www.gnu.org/licenses/>.
24 */
25 
26 
27 #include <GridUtils.hpp>
28 
29 
30 using namespace std;
31 
32 
33 
34 namespace loos {
35  namespace DensityTools {
36 
37 
38  std::vector<double> gaussian1d(const int w, const double sigma) {
39 
40  double a = 1.0 / sqrt(2.0 * M_PI * sigma);
41  double b = -1.0 / (2.0 * sigma);
42 
43  std::vector<double> kernel;
44  for (int i=0; i<=w; ++i) {
45  double x = 2.0*i/w-1.0;
46  kernel.push_back(a*exp(b*x*x));
47  }
48 
49  return(kernel);
50  }
51 
52 
53  };
54 };
55 
56 
57 
STL namespace.
std::vector< double > gaussian1d(const int w, const double sigma)
Construct a 1D gaussian.
Definition: GridUtils.cpp:38
Namespace for most things not already encapsulated within a class.