QMCPACK
RandomForTest.h
Go to the documentation of this file.
1 //////////////////////////////////////////////////////////////////////////////////////
2 // This file is distributed under the University of Illinois/NCSA Open Source License.
3 // See LICENSE file in top directory for details.
4 //
5 // Copyright (c) 2021 QMCPACK developers.
6 //
7 // File developed by: Peter Doak, doakpw@ornl.gov, Oak Ridge National Laboratory
8 //
9 // File created by: Peter Doak, doakpw@ornl.gov, Oak Ridge National Laboratory
10 //////////////////////////////////////////////////////////////////////////////////////
11 
12 #ifndef QMCPLUSPLUS_RANDOMFORTEST_H
13 #define QMCPLUSPLUS_RANDOMFORTEST_H
14 
15 #include <complex>
16 #include <vector>
17 #include "Utilities/StdRandom.h"
18 
19 namespace qmcplusplus
20 {
21 namespace testing
22 {
23 
24 /** Get a known sequence of random numbers for testing.
25  * VT is the floating point precision
26  * While inelegant to have separate named calls for the cplx types in the same class
27  * separate class templates for RandomForTest<double> and RandomForTest<std::complex<double>>
28  * turned out to be surprisingly difficult. Someone is welcome to try when we required > c++14
29  */
30 template<typename VT>
32 {
33 public:
34  RandomForTest();
35  std::vector<VT> getRngVec(int ncount);
36  std::vector<std::complex<VT>> getRngVecComplex(int ncount);
37  void fillVecRng(std::vector<VT>& rng_reals);
38  void fillVecRng(std::vector<std::complex<VT>>& rng_reals);
39  void fillBufferRng(VT* rng_reals, size_t number);
40  void fillBufferRng(std::complex<VT>* rng_reals, size_t number);
41  VT operator()();
42 private:
44 };
45 
46  extern template class RandomForTest<double>;
47  extern template class RandomForTest<float>;
48 } // namespace testing
49 } // namespace qmcplusplus
50 #endif
helper functions for EinsplineSetBuilder
Definition: Configuration.h:43
std::vector< std::complex< VT > > getRngVecComplex(int ncount)
void fillBufferRng(VT *rng_reals, size_t number)
Get a known sequence of random numbers for testing.
Definition: RandomForTest.h:31
void fillVecRng(std::vector< VT > &rng_reals)
A minimally functional wrapper for the since c++11 <random>
std::vector< VT > getRngVec(int ncount)