Restructure C++ core into cpp module and package bindings.
Move the pricing engine sources out of src/ into cpp/, add the closed-form engine and pybind wiring, and align tests/build targets with the new project layout. Made-with: Cursor
This commit is contained in:
31
cpp/RandomGenerator.hpp
Normal file
31
cpp/RandomGenerator.hpp
Normal file
@@ -0,0 +1,31 @@
|
||||
/**
|
||||
* @file RandomGenerator.hpp
|
||||
* @brief Random numbers for Monte Carlo (Gaussian draws).
|
||||
*/
|
||||
|
||||
#ifndef QUANTENGINE_RANDOMGENERATOR_HPP
|
||||
#define QUANTENGINE_RANDOMGENERATOR_HPP
|
||||
#include <random>
|
||||
|
||||
/** @brief Interface for standard normal variates. */
|
||||
class RandomGenerator {
|
||||
public:
|
||||
RandomGenerator() = default;
|
||||
virtual ~RandomGenerator() = default;
|
||||
virtual double nextGaussian() = 0;
|
||||
virtual std::vector<double> nextGaussianVector(std::size_t n) = 0;
|
||||
};
|
||||
|
||||
/** @brief @c std::mt19937 with normal distribution. */
|
||||
class MersenneTwister : public RandomGenerator {
|
||||
public:
|
||||
MersenneTwister() = default;
|
||||
double nextGaussian() override;
|
||||
std::vector<double> nextGaussianVector(std::size_t n) override;
|
||||
private:
|
||||
std::mt19937 generator_;
|
||||
std::normal_distribution<> distr_ {0.0, 1.0};
|
||||
};
|
||||
|
||||
|
||||
#endif //QUANTENGINE_RANDOMGENERATOR_HPP
|
||||
Reference in New Issue
Block a user