ALPS MPS Codes
Reference documentation.
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Pages
Classes | Functions
measurements::detail Namespace Reference

Classes

class  CorrPermutator
 

Functions

std::vector< std::vector
< std::size_t > > 
resort_labels (const std::vector< std::vector< std::size_t > > &labels, std::vector< size_t > const &order, bool is_nn=false)
 

Function Documentation

std::vector<std::vector<std::size_t> > measurements::detail::resort_labels ( const std::vector< std::vector< std::size_t > > &  labels,
std::vector< size_t > const &  order,
bool  is_nn = false 
)
inline

Definition at line 42 of file correlations.h.

45  {
46  std::vector<std::vector<std::size_t> > ret(labels.size());
47  for (int i=0; i<labels.size(); ++i) {
48  #ifndef NDEBUG
49  if (is_nn) assert(2*order.size() == labels[i].size());
50  else assert(order.size() == labels[i].size());
51  #endif
52  ret[i].resize(labels[i].size());
53 
54  for (int j=0; j<order.size(); ++j) {
55  if (is_nn) {
56  ret[i][order[j]] = labels[i][2*j];
57  ret[i][order[j]+1] = labels[i][2*j+1];
58  } else {
59  ret[i][order[j]] = labels[i][j];
60  }
61  }
62  }
63  return ret;
64  }