This example shows how to transform, using filters, a sequence of merit values based on a component-by-component sequence of lattice definitions.
#include "latbuilder/CoordUniformFigureOfMerit.h"
#include "latticetester/ProductWeights.h"
#include "latbuilder/Kernel/PAlpha.h"
#include "latbuilder/Kernel/PAlphaPLR.h"
#include "latbuilder/Accumulator.h"
#include "latbuilder/Functor/binary.h"
#include "latbuilder/Storage.h"
#include "latbuilder/MeritFilterList.h"
#include "latbuilder/MeritCombiner.h"
#include "latbuilder/MeritFilter.h"
#include "latbuilder/Norm/Normalizer.h"
#include "latbuilder/Norm/PAlphaSL10.h"
#include "latbuilder/Functor/LowPass.h"
#include "latbuilder/MeritSeq/CoordUniformCBC.h"
#include "latbuilder/MeritSeq/CoordUniformInnerProd.h"
#include "latbuilder/GenSeq/GeneratingValues.h"
#include "latbuilder/GenSeq/Creator.h"
#include "latbuilder/TextStream.h"
#include <iostream>
#include <limits>
using TextStream::operator<<;
template <typename T, typename... ARGS>
std::unique_ptr<T> unique(ARGS&&... args)
{ return std::unique_ptr<T>(new T(std::forward<ARGS>(args)...)); }
template <LatticeType LA, class NORMALIZER>
{}
template <LatticeType LA, class NORMALIZER>
{
sizeParam.maxLevel() + 1,
1.0 / sizeParam.maxLevel()
));
}
template<LatticeType LA>
template<LatticeType LA>
template <LatticeType LA, EmbeddingType L, Compress C>
{
auto weights = unique<LatticeTester::ProductWeights>();
weights->setDefaultWeight(0.7);
std::cout << "figure of merit: " << figure << std::endl;
auto cbc = MeritSeq::cbc<MeritSeq::CoordUniformInnerProd>(storage, figure);
setCombiner(filters);
auto normalizer = unique<Norm::Normalizer<LA, L, Norm::PAlphaSL10>>(
);
setLevelWeights(*normalizer, storage.sizeParam());
filters.add(std::move(normalizer));
filters.add(std::move(lowPass));
std::cout << "filters: " << filters << std::endl;
while (
cbc.baseLat().dimension() < dimension) {
std::cout << "CBC search for dimension: " << (baseDim + 1) << std::endl;
std::cout <<
"base lattice: " << std::endl <<
cbc.baseLat();
std::cout <<
"base merit value: " <<
cbc.baseMerit() << std::endl;
auto meritSeq =
cbc.meritSeq(baseDim == 0 ? genSeq0 : genSeq);
auto filteredSeq = filters.apply(meritSeq);
auto best = std::min_element(filteredSeq.begin(), filteredSeq.end());
std::cout <<
"BEST LATTICE: " << std::endl <<
cbc.baseLat() <<
"Merit value: " << *best << std::endl;
}
}
int main()
{
SET_PATH_TO_LATNETBUILDER_FOR_EXAMPLES();
return 0;
}