This example shows how to instantiate the various types of digital nets supported by NetBuilder.
#include <iostream>
#include <memory>
int main(int argc, char** argv)
{
SET_PATH_TO_LATNETBUILDER_FOR_EXAMPLES();
{
std::cout << "Constructing Sobol' nets..." << std::endl;
GeneratingValue firstGenValue(0, {0});
std::vector<GeneratingValue> genVals{firstGenValue};
auto sobolNet = std::make_unique<DigitalNetConstruction<NetConstruction::SOBOL>>(1, SizeParameter(10), genVals);
std::cout << "First generating matrix:" << std::endl << sobolNet->generatingMatrix(0) << std::endl;
GeneratingValue secondGenValue(1, {1});
auto newSobolNet = sobolNet->extendDimension(secondGenValue);
std::cout << "Second generating matrix:" << std::endl << newSobolNet->generatingMatrix(1) << std::endl;
if (&(sobolNet->generatingMatrix(0)) == &(newSobolNet->generatingMatrix(0)))
std::cout << "The shared generating matrix has a unique address." << std::endl;
std::cout << std::endl;
}
{
std::cout << "Constructing polynomial lattice rules..." << std::endl;
std::cout << "Modulus: " << modulus << std::endl;
std::cout << "First generating value: " << firstGenValue << std::endl;
std::vector<GeneratingValue> genVals{firstGenValue};
auto polynomialNet = std::make_unique<DigitalNetConstruction<NetConstruction::POLYNOMIAL>>(1, modulus, genVals);
std::cout << "First generating matrix:" << std::endl << polynomialNet->generatingMatrix(0) << std::endl;
std::cout << "Second generating value: " << newGenValue << std::endl;
auto newPolynomialNet = polynomialNet->extendDimension(newGenValue);
std::cout << "Second generating matrix:" << std::endl << newPolynomialNet->generatingMatrix(1) << std::endl;
std::cout << std::endl;
}
{
std::cout << "Constructing digital net with explicit generating matrices..." << std::endl;
GeneratingValue firstGenValue(10, 10, {1, 2, 4, 8, 16, 32, 64, 128, 256, 512, 1024});
std::cout << "Second generating value: " << std::endl << firstGenValue << std::endl;
GeneratingValue newGenValue(10, 10, {1, 1, 0, 7, 0, 31, 0, 127, 0, 511, 0});
std::cout << "Second generating value: " << std::endl << newGenValue << std::endl;
std::vector<GeneratingValue> genVals{firstGenValue, newGenValue};
SizeParameter sizeParam(10,10);
auto explicitNet = std::make_unique<DigitalNetConstruction<NetConstruction::EXPLICIT>>(2, sizeParam, genVals);
}
}