helib::GeneratorTrees Class Reference

A std::vector of generator trees, one per generator in Zm*‍/(p) More...

#include <permutations.h>

Public Member Functions

 GeneratorTrees ()
 
long numLayers () const
 
long numTrees () const
 
long getSize () const
 
OneGeneratorTree & operator[] (long i)
 
const OneGeneratorTree & operator[] (long i) const
 
OneGeneratorTree & at (long i)
 
const OneGeneratorTree & at (long i) const
 
OneGeneratorTree & getGenTree (long i)
 
const OneGeneratorTree & getGenTree (long i) const
 
const Permut & mapToCube () const
 
const Permut & mapToArray () const
 
Permut & mapToCube ()
 
Permut & mapToArray ()
 
long mapToCube (long i) const
 
long mapToArray (long i) const
 
void getCubeDims (NTL::Vec< long > &dims) const
 
void getCubeSubDims (NTL::Vec< long > &dims) const
 
long buildOptimalTrees (const NTL::Vec< GenDescriptor > &vec, long depthBound)
 
void ComputeCubeMapping ()
 Computes permutations mapping between linear array and the cube. More...
 

Friends

std::ostream & operator<< (std::ostream &s, const GeneratorTrees &t)
 

Detailed Description

A std::vector of generator trees, one per generator in Zm*‍/(p)

Constructor & Destructor Documentation

◆ GeneratorTrees()

helib::GeneratorTrees::GeneratorTrees ( )
inline

Member Function Documentation

◆ at() [1/2]

OneGeneratorTree& helib::GeneratorTrees::at ( long  i)
inline

◆ at() [2/2]

const OneGeneratorTree& helib::GeneratorTrees::at ( long  i) const
inline

◆ buildOptimalTrees()

long helib::GeneratorTrees::buildOptimalTrees ( const NTL::Vec< GenDescriptor > &  vec,
long  depthBound 
)

Compute the trees corresponding to the "optimal" way of breaking a permutation into dimensions, subject to some constraints. Returns the cost (# of 1D shifts) of this solution. Returns NTL_MAX_LONG if no solution

◆ ComputeCubeMapping()

void helib::GeneratorTrees::ComputeCubeMapping ( )

Computes permutations mapping between linear array and the cube.

If the cube dimensions (i.e., leaves of tree) are n1,n2,...,nt and N=\prod_j n_j is the size of the cube, then an integer i can be represented in either the mixed base of the n_j's or in "CRT basis" relative to the leaves: Namely either i = \sum_{j<=t} i_j * \prod_{k>j} n_k, or i = \sum_leaf i'_leaf * leaf.e mod N.

The breakPermByDim procedure expects its input in the mixed-base representation, and the maps are used to convert back and forth. Specifically, let (i'_1,...,i'_t) be the CRT representation of i in this cube, and j = \sum_{j=1}^t i'_j * \prod_{k>j} n_k, then we have map2cube[i]=j and map2array[j]=i.

◆ getCubeDims()

void helib::GeneratorTrees::getCubeDims ( NTL::Vec< long > &  dims) const

Get the "crude" cube dimensions corresponding to the vector of trees, the ordered vector with one dimension per tree

◆ getCubeSubDims()

void helib::GeneratorTrees::getCubeSubDims ( NTL::Vec< long > &  dims) const

Get the "fine" cube dimensions corresponding to the vector of trees, the ordered vector with one dimension per leaf in all the trees.

◆ getGenTree() [1/2]

OneGeneratorTree& helib::GeneratorTrees::getGenTree ( long  i)
inline

◆ getGenTree() [2/2]

const OneGeneratorTree& helib::GeneratorTrees::getGenTree ( long  i) const
inline

◆ getSize()

long helib::GeneratorTrees::getSize ( ) const
inline

◆ mapToArray() [1/3]

Permut& helib::GeneratorTrees::mapToArray ( )
inline

◆ mapToArray() [2/3]

const Permut& helib::GeneratorTrees::mapToArray ( ) const
inline

◆ mapToArray() [3/3]

long helib::GeneratorTrees::mapToArray ( long  i) const
inline

◆ mapToCube() [1/3]

Permut& helib::GeneratorTrees::mapToCube ( )
inline

◆ mapToCube() [2/3]

const Permut& helib::GeneratorTrees::mapToCube ( ) const
inline

◆ mapToCube() [3/3]

long helib::GeneratorTrees::mapToCube ( long  i) const
inline

◆ numLayers()

long helib::GeneratorTrees::numLayers ( ) const
inline

◆ numTrees()

long helib::GeneratorTrees::numTrees ( ) const
inline

◆ operator[]() [1/2]

OneGeneratorTree& helib::GeneratorTrees::operator[] ( long  i)
inline

◆ operator[]() [2/2]

const OneGeneratorTree& helib::GeneratorTrees::operator[] ( long  i) const
inline

Friends And Related Function Documentation

◆ operator<<

std::ostream& operator<< ( std::ostream &  s,
const GeneratorTrees &  t 
)
friend