]>
git.proxmox.com Git - ceph.git/blob - ceph/src/boost/libs/math/tools/zeta_data.cpp
1 // Copyright John Maddock 2007.
2 // Use, modification and distribution are subject to the
3 // Boost Software License, Version 1.0. (See accompanying file
4 // LICENSE_1_0.txt or copy at http://www.boost.org/LICENSE_1_0.txt)
6 #include <boost/math/special_functions/zeta.hpp>
7 #include <boost/math/constants/constants.hpp>
9 #include <boost/math/tools/test_data.hpp>
12 using namespace boost::math::tools
;
15 struct zeta_data_generator
17 mp_t
operator()(mp_t z
)
19 std::cout
<< z
<< " ";
20 mp_t result
= boost::math::zeta(z
);
21 std::cout
<< result
<< std::endl
;
26 struct zeta_data_generator2
28 boost::math::tuple
<mp_t
, mp_t
> operator()(mp_t z
)
30 std::cout
<< -z
<< " ";
31 mp_t result
= boost::math::zeta(-z
);
32 std::cout
<< result
<< std::endl
;
33 return boost::math::make_tuple(-z
, result
);
38 int main(int argc
, char*argv
[])
40 parameter_info
<mp_t
> arg1
;
46 std::cout
<< "Welcome.\n"
47 "This program will generate spot tests for the zeta function:\n";
50 if(0 == get_user_parameter_info(arg1
, "z"))
52 arg1
.type
|= dummy_param
;
53 data
.insert(zeta_data_generator2(), arg1
);
55 std::cout
<< "Any more data [y/n]?";
56 std::getline(std::cin
, line
);
57 boost::algorithm::trim(line
);
61 std::cout
<< "Enter name of test data file [default=zeta_data.ipp]";
62 std::getline(std::cin
, line
);
63 boost::algorithm::trim(line
);
65 line
= "zeta_data.ipp";
66 std::ofstream
ofs(line
.c_str());
67 ofs
<< std::scientific
<< std::setprecision(40);
68 write_code(ofs
, data
, "zeta_data");