| X | a type that is a model of Dimensional |
| x | an object of type X |
| lattice::dimensional_traits<X>::dimension_type
an integral type large enough to store the dimension of X |
| lattice::dimensional_traits<X>::infinity() | return type dimensional_traits<X>::dimension_type the value used to represent an infinite lattice |
| lattice::dimensional_traits<X>::fixed_dimension | type bool, is true if the dimension is a compile time constant See the concept FixedDimensional for additional information in that case |
| dimension(x) | return type lattice::dimensional_traits<X>::dimension_type the dimension of x |
Note that
lattice::dimension(x) == lattice::dimensional_traits<X>::infinity()is true for infinite-dimensional lattices.
namespace alps {
template <class Dimensional>
struct dimensional_traits {
typedef std::size_t dimension_type;
static const bool fixed_dimension=false;
static dimension_type infinity()
{
return std::numeric_limits<dimension_type>::max();
}
};
template <class Dimensional>
inline typename dimensional_traits::dimension_type
dimension(const Dimensional& d)
{
return d.size();
}
}
| X | a type that is a model of FixedDimensional |
| x | an object of type X |
| dimensional_traits<X>::fixed_dimension | evaluates to true |
| dimensional_traits<X>::dimension | same as dimension(x) |
template <class T, int sz>
struct dimensional_traits<T[sz]> {
typedef int dimension_type;
bool fixed_dimension=true;
dimension_type dimension=sz;
};
template <class T, int sz>
typename dimensional_traits<T[sz]>::dimension_type
dimension(const T[sz]& d)
{
return sz;
}
template <class T, int sz>
struct dimensional_traits<blitz::TinyVector<T,sz> > {
typedef int dimension_type;
bool fixed_dimension=true;
dimension_type dimension=sz;
};
template <class T, int sz>
typename dimensional_traits<blitz::TinyVector<T,sz> >::dimension_type
dimension(const T[sz]& d)
{
return sz;
}
Models are std::valarray, blitz::TinyVector, blitz::Array and others
| P | a type that is a model of Point |
| p, | objects of type P |
| v | object of type lattice::point_traits<P>::vector_type |
|
lattice::point_traits<P>::vector_type a type that is a model of the concept Vector, the result type of the difference of two points |
| p-q |
return type lattice::point_traits<P>::vector_type a vector pointing from q to p |
| p+v v+p |
return type P the point p shifted by the vector v |
| p-v |
return type P the point p shifted by the vector -v |
namespace alps {
template
struct point_traits
{
typedef P vector_type;
};
}
models are std::valarray, blitz::TinyVector, blitz::Array
| V | a type that is a model of Vector |
| v, | objects of type V |
| t | an object of a scalar type (integer or floating point number) |
| v+w | return type V, the sum of two vectors |
| v-w | return type V, the difference of two vectors |
| t*v v*t | return type V, the vector v scaled by the facor t |
| v/t | return type V, the vector v scaled by the facor 1/t |
| -v | return type V, the inverted vector |
| C | a type that is a model of Coordinate |
| c | an object of type C |
| const_c | an object of type const C |
| i | an object of type lattice::dimension_traits<C>::dimension_type |
|
lattice::coordinate_traits<C>::iterator an iterator type for C |
| lattice::coordinate_traits<C>::const_iterator a const iterator type for C |
|
lattice::coordinate_traits<C>::value_type a type able to store a coordinate in one of the dimensions, same as std::iterator_traits<typename lattice::coordinate_traits<C>::iterator>::value_type |
| c[i] |
return type lattice::coordinate_traits<C>::value_type the i-th coordinate, 0<=i<dimensionscopyright (c) comment: is this actually needed or just convenient? |
| lattice::coordinatescopyright (c) |
return type std::pair<typename lattice::coordinate_traits<C>::iterator,typename
lattice::coordinate_traits<C>::iterator> the pair consists of two iterators, pointing to the first and one past the last coordinate |
| lattice::coordinates(const_c) |
return type std::pair<typename lattice::coordinate_traits<C>::const_iterator, typename
lattice::coordinate_traits<C>::const_iterator> the pair consists of two iterators, pointing to the first and one past the last coordinate |
namespace alps {
template <class C>
struct coordinate_traits {
typedef typename C::value_type value_type;
typedef typename C::iterator iterator;
typedef typename C::const_iterator const_iterator;
};
template <class C>
inline std::pair<typename coordinate_traits<C>::iterator, typename coordinate_traits<C>::iterator>
coordinates(C& c)
{
return std::make_pair(c.begin(),c.end());
}
template <class C>
inline std::pair<typename coordinate_traits<C>::const_iterator, typename coordinate_traits<C>::const_iterator>
coordinates(const C& c)
{
return std::make_pair(c.begin(),c.end());
}
template <class T>
struct coordinate_traits<std::valarray<T> > {
typedef typename T value_type;
typedef typename T* iterator;
typedef typename const T* const_iterator;
};
template <class T>
inline std::pair<T*, T*> coordinates(std::valarray<T>& c)
{
return make_pair(&(c[0]),&(c[0])+c.size());
}
template <class T>
inline std::pair<const T*, const T*> coordinates(std::valarray<T>& c)
{
return std::pair<const T*, const T*>
(&(const_cast<std::valarray<T>&>copyright (c)[0]),
&(const_cast<std::valarray<T>&>copyright (c)[0])+c.size());
}
}