PURIFY
Next-generation radio interferometric imaging
Public Member Functions | List of all members
purify::IndexMapping< STORAGE_INDEX_TYPE > Class Template Reference

#include <IndexMapping.h>

Public Member Functions

 IndexMapping (const std::vector< STORAGE_INDEX_TYPE > &indices, const STORAGE_INDEX_TYPE N, const STORAGE_INDEX_TYPE start=0)
 
template<class ITER >
 IndexMapping (const ITER &first, const ITER &end, const STORAGE_INDEX_TYPE N, const STORAGE_INDEX_TYPE start=0)
 
 IndexMapping (const std::set< STORAGE_INDEX_TYPE > &indices, const STORAGE_INDEX_TYPE N, const STORAGE_INDEX_TYPE start=0)
 
template<class T0 , class T1 >
void operator() (Eigen::MatrixBase< T0 > const &input, Eigen::MatrixBase< T1 > const &output) const
 Creates a vector of elements equal to re-indexed inpu. More...
 
template<class T0 , class T1 >
void adjoint (Eigen::MatrixBase< T0 > const &input, Eigen::MatrixBase< T1 > const &output) const
 Vector of size N where non-zero elements are chosen from input at given indices. More...
 
t_int rows () const
 
STORAGE_INDEX_TYPE cols () const
 

Detailed Description

template<class STORAGE_INDEX_TYPE = t_int>
class purify::IndexMapping< STORAGE_INDEX_TYPE >

Definition at line 11 of file IndexMapping.h.

Constructor & Destructor Documentation

◆ IndexMapping() [1/3]

template<class STORAGE_INDEX_TYPE = t_int>
purify::IndexMapping< STORAGE_INDEX_TYPE >::IndexMapping ( const std::vector< STORAGE_INDEX_TYPE > &  indices,
const STORAGE_INDEX_TYPE  N,
const STORAGE_INDEX_TYPE  start = 0 
)
inline

Definition at line 13 of file IndexMapping.h.

15  : indices(indices), N(N), start(start){};

◆ IndexMapping() [2/3]

template<class STORAGE_INDEX_TYPE = t_int>
template<class ITER >
purify::IndexMapping< STORAGE_INDEX_TYPE >::IndexMapping ( const ITER &  first,
const ITER &  end,
const STORAGE_INDEX_TYPE  N,
const STORAGE_INDEX_TYPE  start = 0 
)
inline

Definition at line 17 of file IndexMapping.h.

19  : IndexMapping(std::vector<STORAGE_INDEX_TYPE>(first, end), N, start) {}
IndexMapping(const std::vector< STORAGE_INDEX_TYPE > &indices, const STORAGE_INDEX_TYPE N, const STORAGE_INDEX_TYPE start=0)
Definition: IndexMapping.h:13

◆ IndexMapping() [3/3]

template<class STORAGE_INDEX_TYPE = t_int>
purify::IndexMapping< STORAGE_INDEX_TYPE >::IndexMapping ( const std::set< STORAGE_INDEX_TYPE > &  indices,
const STORAGE_INDEX_TYPE  N,
const STORAGE_INDEX_TYPE  start = 0 
)
inline

Definition at line 20 of file IndexMapping.h.

22  : IndexMapping(indices.begin(), indices.end(), N, start) {}

Member Function Documentation

◆ adjoint()

template<class STORAGE_INDEX_TYPE = t_int>
template<class T0 , class T1 >
void purify::IndexMapping< STORAGE_INDEX_TYPE >::adjoint ( Eigen::MatrixBase< T0 > const &  input,
Eigen::MatrixBase< T1 > const &  output 
) const
inline

Vector of size N where non-zero elements are chosen from input at given indices.

Definition at line 39 of file IndexMapping.h.

39  {
40  assert(static_cast<size_t>(input.size()) == indices.size());
41  auto &derived = output.const_cast_derived();
42  derived = T1::Zero(N, 1);
43  typename T0::Index i(0);
44  for (STORAGE_INDEX_TYPE const &index : indices) {
45  assert(index >= start and index < (N + start));
46  derived(index - start) += input(i++);
47  }
48  }

◆ cols()

template<class STORAGE_INDEX_TYPE = t_int>
STORAGE_INDEX_TYPE purify::IndexMapping< STORAGE_INDEX_TYPE >::cols ( ) const
inline

Definition at line 51 of file IndexMapping.h.

51 { return N; }

◆ operator()()

template<class STORAGE_INDEX_TYPE = t_int>
template<class T0 , class T1 >
void purify::IndexMapping< STORAGE_INDEX_TYPE >::operator() ( Eigen::MatrixBase< T0 > const &  input,
Eigen::MatrixBase< T1 > const &  output 
) const
inline

Creates a vector of elements equal to re-indexed inpu.

Definition at line 26 of file IndexMapping.h.

26  {
27  auto &derived = output.const_cast_derived();
28  derived.resize(indices.size());
29  typename T0::Index i(0);
30  for (auto const &index : indices) {
31  assert(index >= start and index < (N + start));
32  assert(derived.size() > i);
33  derived(i++) = input(index - start);
34  }
35  }

◆ rows()

template<class STORAGE_INDEX_TYPE = t_int>
t_int purify::IndexMapping< STORAGE_INDEX_TYPE >::rows ( ) const
inline

Definition at line 50 of file IndexMapping.h.

50 { return indices.size(); }

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