Skip to content

Commit

Permalink
Apply some cosmetic changes
Browse files Browse the repository at this point in the history
  • Loading branch information
cschwan committed Jun 17, 2013
1 parent fa122a1 commit 4dab6c1
Show file tree
Hide file tree
Showing 4 changed files with 40 additions and 7 deletions.
8 changes: 8 additions & 0 deletions examples/mpi_vegas.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,8 @@
#include <cstddef>
#include <iostream>

#include <mpi.h>

double gauss(hep::mc_point<double> const& sample)
{
double result = 1.0;
Expand Down Expand Up @@ -45,6 +47,12 @@ int main(int argc, char* argv[])
iterations,
gauss
);
// std::vector<hep::mc_result<double>> results = { hep::mpi_plain<double>(
// MPI_COMM_WORLD,
// dimension,
// 5 * 10000000,
// gauss
// )};

// print numbers in scientific format
std::cout.setf(std::ios_base::scientific);
Expand Down
20 changes: 19 additions & 1 deletion include/hep/mc/mpi_vegas.hpp
Original file line number Diff line number Diff line change
@@ -1,6 +1,24 @@
#ifndef HEP_MC_MPI_VEGAS_HPP
#define HEP_MC_MPI_VEGAS_HPP

/*
* hep-mc - A Template Library for Monte Carlo Integration
* Copyright (C) 2013 Christopher Schwan
*
* This program is free software: you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation, either version 3 of the License, or
* (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program. If not, see <http://www.gnu.org/licenses/>.
*/

#include <hep/mc/mpi_datatype.hpp>
#include <hep/mc/vegas.hpp>

Expand Down Expand Up @@ -36,7 +54,7 @@ namespace hep
* \param alpha The \f$ \alpha \f$ parameter of VEGAS. This parameter should be
* between `1` and `2`.
* \param generator The random number generator that will be used to generate
* random points from the hypercube. This generator is not seeded.
* random points from the hypercube. This generator is properly seeded.
*/
template <typename T, typename F, typename R = std::mt19937>
std::vector<vegas_iteration_result<T>> mpi_vegas(
Expand Down
13 changes: 10 additions & 3 deletions include/hep/mc/plain.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -19,13 +19,13 @@
* along with this program. If not, see <http://www.gnu.org/licenses/>.
*/

#include <hep/mc/mc_point.hpp>
#include <hep/mc/mc_result.hpp>

#include <cstddef>
#include <random>
#include <vector>

#include <hep/mc/mc_point.hpp>
#include <hep/mc/mc_result.hpp>

namespace hep
{

Expand All @@ -36,6 +36,13 @@ namespace hep
* unit-hypercube with the specified `dimensions` using `calls` function
* evaluations with randomly chosen points determined by `generator`. The
* generator is not seeded.
*
* \param dimensions The number of parameters `function` accepts.
* \param calls The number of function calls that are used to obtain the result.
* \param function The function that will be integrated over the hypercube. See
* \ref integrands for further explanation.
* \param generator The random number generator that will be used to generate
* random points from the hypercube. This generator is not seeded.
*/
template <typename T, typename F, typename R = std::mt19937>
mc_result<T> plain(
Expand Down
6 changes: 3 additions & 3 deletions include/hep/mc/vegas.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -19,13 +19,13 @@
* along with this program. If not, see <http://www.gnu.org/licenses/>.
*/

#include <hep/mc/mc_point.hpp>
#include <hep/mc/mc_result.hpp>

#include <cstddef>
#include <random>
#include <vector>

#include <hep/mc/mc_point.hpp>
#include <hep/mc/mc_result.hpp>

namespace hep
{

Expand Down

0 comments on commit 4dab6c1

Please sign in to comment.