LatNet Builder Manual 2.1.3-6
Software Package for Constructing Highly Uniform Point Sets
Loading...
Searching...
No Matches
tutorial/NetDef.cc

This example shows how to instantiate the various types of digital nets supported by NetBuilder.

This example shows how to instantiate the various types of digital nets supported by NetBuilder.

// This file is part of LatNet Builder.
//
// Copyright (C) 2012-2021 The LatNet Builder author's, supervised by Pierre L'Ecuyer, Universite de Montreal.
//
// Licensed under the Apache License, Version 2.0 (the "License");
// you may not use this file except in compliance with the License.
// You may obtain a copy of the License at
//
// http://www.apache.org/licenses/LICENSE-2.0
//
// Unless required by applicable law or agreed to in writing, software
// distributed under the License is distributed on an "AS IS" BASIS,
// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
// See the License for the specific language governing permissions and
// limitations under the License.
#include <iostream>
#include <memory>
#include "Path.h"
using namespace NetBuilder;
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<DigitalNet<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->appendNewCoordinate(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;
Modulus modulus = PolynomialFromInt(1033);
std::cout << "Modulus: " << modulus << std::endl;
GeneratingValue firstGenValue = PolynomialFromInt(1);
std::cout << "First generating value: " << firstGenValue << std::endl;
std::vector<GeneratingValue> genVals{firstGenValue};
auto polynomialNet = std::make_unique<DigitalNet<NetConstruction::POLYNOMIAL>>(1, modulus, genVals);
std::cout << "First generating matrix:" << std::endl << polynomialNet->generatingMatrix(0) << std::endl;
GeneratingValue newGenValue = PolynomialFromInt(512);
std::cout << "Second generating value: " << newGenValue << std::endl;
auto newPolynomialNet = polynomialNet->appendNewCoordinate(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<DigitalNet<NetConstruction::EXPLICIT>>(2, sizeParam, genVals);
}
}
This file contains the base classes for digital nets in base 2.
This file contains the definition of generating matrices in base 2.
This file contains a global variable PATH_TO_LATNETBUILDER_DIR which should always equal the path to ...
Tools for streaming and poor man's factorization.
Polynomial PolynomialFromInt(uInteger x)
convert Integer to polynomial
NetBuilder namespace.
Definition libtut_net.dox:17
Digital net construction traits.
Definition NetConstructionTraits.h:77