Tests/testFFT.cpp
/**
 * Rearrange the fft index into 16-vectors
 */
Rearrange the fft index into 16-vectors
Rearrange the fft index into 16 - vectors
std::vector<Indexes16> indexes_to_16vectors(std::vector<Offsets> const &fft_indexes) {
  std::vector<Indexes16> ret;
  for (int i = 0; i < (int) fft_indexes.size(); i++) {
    int s = i + 1;
    auto offsets = fft_indexes[i];
    for (int j = 0; j < (int) offsets.size(); j++) {
      CombinedOffsets co(offsets, j);
      if (co.valid_index(j)) {
        if (co.k_count() == 1) {
          assert((int) co.k_vec.size() % 16 == 0);
          assert((int) co.k_m2_vec.size() % 16 == 0);
          for (int offset = 0; offset < (int) co.size(); offset += 16) {
            Indexes16 item(co, s, j);
            for (int k = 0; k < 16; k++) {
              item.k_16[k]    = co.k_vec[offset + k];
            }
            ret << item;
          }
        } else {
          assert(co.k_vec.size() == 16);
          assert(co.k_m2_vec.size() == 16);
          Indexes16 item(co, s, j);
          item.k_16    = co.k_vec;
          ret << item;
        }
      } else {
        ret << Indexes16(co, s, false);
      }
      j += (co.k_count() - 1);
    }
  }
   Check assumption:
     - if one item does not have a valid index, then all items are not valid
     - conversely, if one item is valid, then all items are valid
  int valid_count = 0;
  for (int i = 0; i < (int) ret.size(); i++) {
    if (ret[i].valid_index) valid_count++;
  }
  if (!(valid_count == 0 || valid_count == (int) ret.size())) {
    std::string msg = "Valid count failed: ";
    msg << valid_count << " out of " << ret.size() << " valid";
    assertq(false, msg);
  }
  return ret;
}
std :: vector < Indexes16 > indexes_to_16vectors ( std :: vector < Offsets > const & fft_indexes ) { std :: vector < Indexes16 > ret ; for ( int i = 0 ; i < ( int ) fft_indexes . size ( ) ; i ++ ) { int s = i + 1 ; auto offsets = fft_indexes [ i ] ; for ( int j = 0 ; j < ( int ) offsets . size ( ) ; j ++ ) { CombinedOffsets co ( offsets , j ) ; if ( co . valid_index ( j ) ) { if ( co . k_count ( ) == 1 ) { assert ( ( int ) co . k_vec . size ( ) % 16 == 0 ) ; assert ( ( int ) co . k_m2_vec . size ( ) % 16 == 0 ) ; for ( int offset = 0 ; offset < ( int ) co . size ( ) ; offset += 16 ) { Indexes16 item ( co , s , j ) ; for ( int k = 0 ; k < 16 ; k ++ ) { item . k_16 [ k ] = co . k_vec [ offset + k ] ; } ret << item ; } } else { assert ( co . k_vec . size ( ) == 16 ) ; assert ( co . k_m2_vec . size ( ) == 16 ) ; Indexes16 item ( co , s , j ) ; item . k_16 = co . k_vec ; ret << item ; } } else { ret << Indexes16 ( co , s , false ) ; } j += ( co . k_count ( ) - 1 ) ; } } int valid_count = 0 ; for ( int i = 0 ; i < ( int ) ret . size ( ) ; i ++ ) { if ( ret [ i ] . valid_index ) valid_count ++ ; } if ( ! ( valid_count == 0 || valid_count == ( int ) ret . size ( ) ) ) { std :: string msg = " " ; msg << valid_count << " " << ret . size ( ) << " " ; assertq ( false , msg ) ; } return ret ; }
Rearrange the fft index into 16-vectors
Rearrange the fft index into 16 - vectors
// // Check assumption: //   - if one item does not have a valid index, then all items are not valid //   - conversely, if one item is valid, then all items are valid //