LatNet Builder Manual  2.0.1-11
Software Package for Constructing Highly Uniform Point Sets
tutorial/GenSeqVector.cc

This example shows how to create vectors of distinct sequences of generating values.

// This file is part of LatNet Builder.
//
// Copyright (C) 2012-2018 Pierre L'Ecuyer and 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 "latbuilder/GenSeq/GeneratingValues.h"
#include "latbuilder/GenSeq/VectorCreator.h"
#include "latbuilder/GenSeq/Creator.h"
#include "latbuilder/SizeParam.h"
#include "latbuilder/Traversal.h"
#include "latbuilder/LFSR258.h"
#include "latbuilder/TextStream.h"
#include "Path.h"
#include <iostream>
using namespace LatBuilder;
using TextStream::operator<<;
template <LatticeType LA>
void SeqVector(typename LatticeTraits<LA>::Modulus modulus){
SizeParam<LA, EmbeddingType::UNILEVEL> n(modulus); // lattice size
SizeParam<LA, EmbeddingType::UNILEVEL> n0(LatticeTraits<LA>::TrivialModulus); // fake lattice size to obtain a single value (1)
Dimension dim = 3;
std::cout << "lattice size: " << n << std::endl;
std::cout << " generating value sequences: " << vec << std::endl;
}
template <LatticeType LA>
void RandomSeqVector(typename LatticeTraits<LA>::Modulus modulus){
SizeParam<LA, EmbeddingType::UNILEVEL> n(modulus); // lattice size
SizeParam<LA, EmbeddingType::UNILEVEL> n0(LatticeTraits<LA>::TrivialModulus); // fake lattice size to obtain a single value (1)
Dimension dim = 3;
auto randVec = GenSeq::VectorCreator<RandomSeq>::create(n, dim, 5);
randVec[0] = GenSeq::Creator<RandomSeq>::create(n0, 1); // replace 1st with singleton
std::cout << "lattice size: " << n << std::endl;
std::cout << " random generating value sequences: " << randVec << std::endl;
}
int main()
{
SET_PATH_TO_LATNETBUILDER_FOR_EXAMPLES();
SeqVector<LatticeType::ORDINARY>(7);
SeqVector<LatticeType::POLYNOMIAL>(PolynomialFromInt(7));
RandomSeqVector<LatticeType::ORDINARY>(7);
RandomSeqVector<LatticeType::POLYNOMIAL>(PolynomialFromInt(7));
return 0;
}