QuantLib: a free/open-source library for quantitative finance
fully annotated source code - version 1.34
Loading...
Searching...
No Matches
primenumbers.hpp
Go to the documentation of this file.
1/* -*- mode: c++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
2
3/*
4 Copyright (C) 2003 Ferdinando Ametrano
5
6 This file is part of QuantLib, a free-software/open-source library
7 for financial quantitative analysts and developers - http://quantlib.org/
8
9 QuantLib is free software: you can redistribute it and/or modify it
10 under the terms of the QuantLib license. You should have received a
11 copy of the license along with this program; if not, please email
12 <quantlib-dev@lists.sf.net>. The license is also available online at
13 <http://quantlib.org/license.shtml>.
14
15 This program is distributed in the hope that it will be useful, but WITHOUT
16 ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS
17 FOR A PARTICULAR PURPOSE. See the license for more details.
18*/
19
20// ===========================================================================
21// NOTE: The following copyright notice applies to the original code,
22//
23// Copyright (C) 2002 Peter Jäckel "Monte Carlo Methods in Finance".
24// All rights reserved.
25//
26// Permission to use, copy, modify, and distribute this software is freely
27// granted, provided that this notice is preserved.
28// ===========================================================================
29
30/*! \file primenumbers.hpp
31 \brief Prime numbers calculator
32*/
33
34#ifndef quantlib_primenumbers_h
35#define quantlib_primenumbers_h
36
37#include <ql/types.hpp>
38#include <vector>
39
40namespace QuantLib {
41
42 //! Prime numbers calculator
43 /*! Taken from "Monte Carlo Methods in Finance", by Peter Jäckel
44 */
46 public:
47 //! Get and store one after another.
48 static BigNatural get(Size absoluteIndex);
49 private:
50 PrimeNumbers() = default;
52 static std::vector<BigNatural> primeNumbers_;
53 };
54
55}
56
57#endif
Prime numbers calculator.
static BigNatural nextPrimeNumber()
static BigNatural get(Size absoluteIndex)
Get and store one after another.
static std::vector< BigNatural > primeNumbers_
std::size_t Size
size of a container
Definition: types.hpp:58
Definition: any.hpp:35
unsigned QL_BIG_INTEGER BigNatural
large positive integer
Definition: types.hpp:46
Custom types.