ProteoWizard
Namespaces | Classes | Typedefs | Functions
pwiz::math::MatchedFilter Namespace Reference

Namespaces

 details
 

Classes

struct  Correlation
 
struct  KernelTraits
 
struct  KernelTraitsBase
 
struct  KernelTraitsBase< Y(*)(X)>
 
struct  ProductSpace
 
struct  SampledData
 

Typedefs

typedef ProductSpace< double, double > DxD
 
typedef ProductSpace< double, std::complex< double > > DxCD
 

Functions

template<typename space_type >
std::ostream & operator<< (std::ostream &os, const SampledData< space_type > &data)
 
template<typename Kernel >
void checkKernelConcept ()
 
template<typename Y >
std::ostream & operator<< (std::ostream &os, const Correlation< Y > &c)
 
template<typename Kernel >
KernelTraits< Kernel >::correlation_data_type computeCorrelationData (const typename KernelTraits< Kernel >::sampled_data_type &data, const Kernel &kernel, int sampleRadius, int subsampleFactor)
 

Typedef Documentation

§ DxD

typedef ProductSpace< double, double > pwiz::math::MatchedFilter::DxD

Definition at line 50 of file MatchedFilter.hpp.

§ DxCD

typedef ProductSpace< double, std::complex<double> > pwiz::math::MatchedFilter::DxCD

Definition at line 51 of file MatchedFilter.hpp.

Function Documentation

§ operator<<() [1/2]

template<typename space_type >
std::ostream& pwiz::math::MatchedFilter::operator<< ( std::ostream &  os,
const SampledData< space_type > &  data 
)

Definition at line 97 of file MatchedFilter.hpp.

References pwiz::math::MatchedFilter::SampledData< space_type >::samples.

98 {
99  os << "[" << data.domain.first << "," << data.domain.second << "] "
100  << "(" << data.samples.size() << " samples)\n";
101 
102  typename SampledData<space_type>::samples_type::const_iterator it=data.samples.begin();
103  for (unsigned int index=0; index!=data.samples.size(); ++index, ++it)
104  os << data.x(index) << "\t" << *it << std::endl;
105 
106  return os;
107 }

§ checkKernelConcept()

template<typename Kernel >
void pwiz::math::MatchedFilter::checkKernelConcept ( )

Definition at line 150 of file MatchedFilter.hpp.

151 {
152  // force compile of KernelConcept::check()
153  void (KernelConcept<Kernel>::*dummy)() = &KernelConcept<Kernel>::check;
154  (void)dummy;
155 }

§ operator<<() [2/2]

template<typename Y >
std::ostream& pwiz::math::MatchedFilter::operator<< ( std::ostream &  os,
const Correlation< Y > &  c 
)

Definition at line 174 of file MatchedFilter.hpp.

175 {
176  os << "<" << c.dot << ", " << c.e2 << ", " << c.angle() << ">";
177  return os;
178 }

§ computeCorrelationData()

template<typename Kernel >
KernelTraits<Kernel>::correlation_data_type pwiz::math::MatchedFilter::computeCorrelationData ( const typename KernelTraits< Kernel >::sampled_data_type &  data,
const Kernel &  kernel,
int  sampleRadius,
int  subsampleFactor 
)

Definition at line 287 of file MatchedFilter.hpp.

References pwiz::math::MatchedFilter::details::createFilters(), pwiz::math::MatchedFilter::SampledData< space_type >::domain, pwiz::math::MatchedFilter::SampledData< space_type >::dx(), and pwiz::math::MatchedFilter::SampledData< space_type >::samples.

Referenced by test_compute().

291 {
292  checkKernelConcept<Kernel>();
293 
294  typedef typename KernelTraits<Kernel>::correlation_data_type result_type;
295  result_type result;
296 
297  result.domain = data.domain;
298  if (data.samples.empty()) return result;
299  result.samples.resize((data.samples.size()-1) * subsampleFactor + 1);
300 
301  typedef typename KernelTraits<Kernel>::filter_type filter_type;
302  std::vector<filter_type> filters = details::createFilters(kernel,
303  sampleRadius,
304  subsampleFactor,
305  data.dx());
306 
307  typedef typename KernelTraits<Kernel>::samples_type samples_type;
308 
309  unsigned int sampleIndex = sampleRadius;
310  for (typename samples_type::const_iterator itData = data.samples.begin() + sampleRadius;
311  itData + sampleRadius != data.samples.end(); ++itData, ++sampleIndex)
312  for (unsigned int filterIndex=0; filterIndex<filters.size(); ++filterIndex)
313  {
314  unsigned int index = sampleIndex * filters.size() + filterIndex;
315 
316  if (index >= result.samples.size()) // only when sampleRadius==0, filterIndex>0
317  break;
318 
319  details::computeCorrelation<Kernel>(itData-sampleRadius, itData+sampleRadius+1,
320  filters[filterIndex].begin(),
321  result.samples[index]);
322  }
323 
324  return result;
325 }
std::vector< typename KernelTraits< Kernel >::filter_type > createFilters(const Kernel &kernel, int sampleRadius, int subsampleFactor, typename KernelTraits< Kernel >::abscissa_type dx)