OKlib::Combinatorics::Hypergraphs::Generators::Pd_arithmetical_progressions< Int > Class Template Reference

All palindromised arithmetical progressions in {1,...,n} (in iterator-fashion, without storage) More...

#include <VanderWaerden.hpp>

List of all members.

Public Types

typedef Int Index

Public Member Functions

 Pd_arithmetical_progressions (const Index k, const Index n)
Index mirror_image (const Index v)
sequence_type next ()

Static Public Member Functions

static std::string message ()

Public Attributes

const Index n
const Index k
 size of arithmetic progression in {1, ..., n}
const Index mp
 midpoint of {1, ..., n}
const Index count
 number of palindromised arithmetic progressions of length k in {1, ..., n}

Detailed Description

template<typename Int>
class OKlib::Combinatorics::Hypergraphs::Generators::Pd_arithmetical_progressions< Int >

All palindromised arithmetical progressions in {1,...,n} (in iterator-fashion, without storage)

Old, "quick and dirty" implementation, to be improved (via using a standard output interface).


  • Construct an object Pd_arithmetical_progressions ap(k,n), where k is the length of the arithmetic progressions, to be considered in {1,...,n}.
  • In ap.count the total number of ap's is to be found.
  • Via calling ap.next() one then obtains the ap's, as vectors, in lexicographical order.
  • It is an error if ap.next() is called more than ap.count many times.
  • "Palindromised" means that elements v > (n+1)/2 are mapped to their "mirror image" n-v+1.
  • The order is lexicographical order, however regarding the order on the original arithmetic progressions, before transformation.
  • Arithmetic progressions where all elements would be mapped are ignored (since they have been already obtained).
  • Nevertheless, in general the sequence of vectors contains duplicates (and subsumed elements).
  • All palindromised progressions are ascendingly sorted and without duplicates.
  • For example for k=3, n=6 from (1,2,3),(1,3,5),(2,3,4),(2,4,6),(3,4,5),(4,5,6) we obtain (1,2,3),(1,2,3),(2,3), (1,2,3),(2,3).

Definition at line 396 of file VanderWaerden.hpp.

Member Typedef Documentation

Definition at line 398 of file VanderWaerden.hpp.

Constructor & Destructor Documentation

Definition at line 416 of file VanderWaerden.hpp.

Member Function Documentation

template<typename Int >
static std::string OKlib::Combinatorics::Hypergraphs::Generators::Pd_arithmetical_progressions< Int >::message ( ) [inline, static]

Definition at line 424 of file VanderWaerden.hpp.

Member Data Documentation

number of palindromised arithmetic progressions of length k in {1, ..., n}

Definition at line 412 of file VanderWaerden.hpp.

Referenced by OKlib::Combinatorics::Hypergraphs::Generators::Pd_arithprog_ohg< Int >::operator()().

size of arithmetic progression in {1, ..., n}

Definition at line 401 of file VanderWaerden.hpp.

The documentation for this class was generated from the following file: