37 template<
typename T,
typename U>
40 template<
typename T,
typename U>
61 template<
typename T,
typename U>
72 template<
typename Comp1=std::less<Real>,
73 typename Comp2=std::greater_equal<Real> >
87 template<
typename Comp1=std::greater<Real>,
88 typename Comp2=std::less_equal<Real> >
102 const std::vector<Real>& mag) {
103 int size = pos.size();
104 if (size !=
int(mag.size())) {
105 throw EssentiaException(
"realsToPeaks: position vector size != magnitude vector size");
107 std::vector<Peak> peaks(size);
108 for (
int i=0; i<size; i++) {
109 peaks[i] =
Peak(pos[i], mag[i]);
116 std::vector<Real>& pos, std::vector<Real>& mag) {
117 int size = peaks.size();
118 if (size !=
int(pos.size())) pos.resize(size);
119 if (size !=
int(mag.size())) mag.resize(size);
121 for (
int i=0; i<size; i++) {
122 pos[i] = peaks[i].position;
123 mag[i] = peaks[i].magnitude;
Comp2 _cmp2
Definition: peak.h:91
bool operator()(const Peak &p1, const Peak &p2) const
Definition: peak.h:93
Comp1 _cmp1
Definition: peak.h:90
Comp2 _cmp2
Definition: peak.h:76
bool operator()(const Peak &p1, const Peak &p2) const
Definition: peak.h:78
Comp1 _cmp1
Definition: peak.h:75
Peak & operator=(const std::pair< T, U > &p)
Definition: peak.h:62
bool operator==(const Peak &p) const
Definition: peak.h:43
bool operator<(const Peak &p) const
Definition: peak.h:51
bool operator!=(const Peak &p) const
Definition: peak.h:47
bool operator>=(const Peak &p) const
Definition: peak.h:54
bool operator>(const Peak &p) const
Definition: peak.h:52
Peak & operator=(const Peak &p)
Definition: peak.h:56
Real position
Definition: peak.h:31
bool operator<=(const Peak &p) const
Definition: peak.h:53
Peak(const std::pair< T, U > &p)
Definition: peak.h:41
Peak()
Definition: peak.h:34
Peak(const Peak &p)
Definition: peak.h:35
Peak(const T &pos, const U &mag)
Definition: peak.h:38
Real magnitude
Definition: peak.h:32
void peaksToReals(const std::vector< Peak > &peaks, std::vector< Real > &pos, std::vector< Real > &mag)
Definition: peak.h:115
std::ostream & operator<<(std::ostream &out, const Peak &p)
Definition: peak.h:127
std::vector< Peak > realsToPeaks(const std::vector< Real > &pos, const std::vector< Real > &mag)
Definition: peak.h:101
Definition: algorithm.h:28
float Real
Definition: types.h:69