.. _program_listing_file_src_ed_index.hpp: Program Listing for File index.hpp ================================== |exhale_lsh| :ref:`Return to documentation for file ` (``src_ed/index.hpp``) .. |exhale_lsh| unicode:: U+021B0 .. UPWARDS ARROW WITH TIP LEFTWARDS .. code-block:: cpp #ifndef qcm_index_h #define qcm_index_h #include #include "vector_num.hpp" using namespace std; struct Index{ vector dim; // array of dimensions for each index vector ind; // array of indices int dim_tot; // total number of states (product of all the d[i]'s) Index(){ dim_tot = 0; } Index(vector &_dim) : dim(_dim){ ind.resize(dim.size()); set_dim_tot(); } Index(const Index &x): dim(x.dim), ind(x.ind), dim_tot(x.dim_tot){} void set_dim_tot(){ dim_tot = 1; for(int j=0; j=0; j--) label = dim[j]*label + ind[j]; return label; } // builds the indices from the compound index 'label' void operator()(int label){ for(int j=0; j tmp(ind); (*this)(i2); for(int j=0; j