QMCPACK
test_prime_set.cpp
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) 2017 Jeongnim Kim and QMCPACK developers.
6 //
7 // File developed by: Mark Dewing, mdewing@anl.gov Argonne National Laboratory
8 //
9 // File created by: Mark Dewing, mdewing@anl.gov Argonne National Laboratory
10 //////////////////////////////////////////////////////////////////////////////////////
11 
12 
13 #include "catch.hpp"
14 
15 #include <iostream>
16 #include "Message/Communicate.h"
18 #include <stdio.h>
19 #include <string>
20 #include <vector>
21 
22 using std::string;
23 using std::vector;
24 namespace qmcplusplus
25 {
26 TEST_CASE("prime number set 32 bit", "[utilities]")
27 {
29  //std::cout << "32 bit size = "<< pns.size() << std::endl;
30  REQUIRE(pns.size() == 4097);
31  REQUIRE(pns[0] == 3);
32 
33  std::vector<uint32_t> more_primes;
34  // get prime numbers already in the list
35  pns.get(1, 2, more_primes);
36  REQUIRE(more_primes.size() == 2);
37  REQUIRE(more_primes[0] == 5);
38 
39  // generate additional prime numbers
40  pns.get(4098, 2, more_primes);
41  REQUIRE(more_primes.size() == 4);
42  REQUIRE(more_primes[2] > pns[4096]);
43 }
44 
45 TEST_CASE("prime number set 64 bit", "[utilities]")
46 {
48  //std::cout << "64 bit size = "<< pns.size() << std::endl;
49  REQUIRE(pns.size() == 55109);
50  REQUIRE(pns[0] == 3);
51 
52  std::vector<uint64_t> more_primes;
53  // get prime numbers already in the list
54  pns.get(1, 2, more_primes);
55  REQUIRE(more_primes.size() == 2);
56  REQUIRE(more_primes[0] == 5);
57 
58  // generate additional prime numbers
59  pns.get(55110, 2, more_primes);
60  REQUIRE(more_primes.size() == 4);
61  REQUIRE(more_primes[2] > pns[55108]);
62 }
63 
64 } // namespace qmcplusplus
class to generate prime numbers
helper functions for EinsplineSetBuilder
Definition: Configuration.h:43
TEST_CASE("complex_helper", "[type_traits]")
size_t size() const
REQUIRE(std::filesystem::exists(filename))
define a class to generate prime numbers for random number generators
bool get(UIntType offset, int n, std::vector< UIntType > &primes_add)
add n new primes starting with an offset