33 arma::vec region = X.subvec(min_index, max_index);
34 double max = region.max();
35 arma::uvec positions = find(region == max);
36 position = min_index + positions(0);
52 double delta = std::abs(abscissa(1) - abscissa(0));
53 arma::uvec left_bound = find(((min-delta) <= abscissa) && (abscissa <= (min+delta)));
54 arma::uvec right_bound = find(((max-delta) <= abscissa) && (abscissa <= (max+delta)));
56 arma::uword min_index = left_bound(0);
57 arma::uword max_index = right_bound(0);
59 min = abscissa(min_index);
60 max = abscissa(max_index);
62 arma::vec results(X.n_cols);
64 positions.set_size(X.n_cols);
65 for (arma::uword i = 0; i < X.n_cols; ++i){
67 positions(i) = abscissa(position);
86 double delta = std::abs(abscissa(1) - abscissa(0));
87 arma::uvec first_left_bound = find(((first_min-delta) <= abscissa) && (abscissa <= (first_min+delta)));
88 arma::uvec first_right_bound = find(((first_max-delta) <= abscissa) && (abscissa <= (first_max+delta)));
89 arma::uvec second_left_bound = find(((second_min-delta) <= abscissa) && (abscissa <= (second_min+delta)));
90 arma::uvec second_right_bound = find(((second_max-delta) <= abscissa) && (abscissa <= (second_max+delta)));
92 arma::uword first_min_index = first_left_bound(0);
93 arma::uword first_max_index = first_right_bound(0);
94 arma::uword second_min_index = second_left_bound(0);
95 arma::uword second_max_index = second_right_bound(0);
97 first_min = abscissa(first_min_index);
98 first_max = abscissa(first_max_index);
99 second_min = abscissa(second_min_index);
100 second_max = abscissa(second_max_index);
102 positions.set_size(X.n_cols, 2);
103 arma::mat results(X.n_cols, 2);
104 arma::uword first_position;
105 arma::uword second_position;
106 for (arma::uword i = 0; i < X.n_cols; ++i){
107 results(i, 0) =
FindPeakMax(X.col(i), first_min_index, first_max_index, first_position);
108 results(i, 1) =
FindPeakMax(X.col(i), second_min_index, second_max_index, second_position);
109 positions(i, 0) = abscissa(first_position);
110 positions(i, 1) = abscissa(second_position);
VESPUCCI_EXPORT arma::uword max(arma::uword a, arma::uword b)
Vespucci::Math::max.
VESPUCCI_EXPORT arma::mat FindPeakMaxesMat(const arma::mat &X, arma::vec abscissa, double &first_min, double &first_max, double &second_min, double &second_max, arma::mat positions)
Vespucci::Math::Quantification::FindPeakMaxesMat.
VESPUCCI_EXPORT void position(arma::uword index, arma::uword n_rows, arma::uword n_cols, arma::uword &i, arma::uword &j)
Vespucci::Math::position Find row and column numbers for index.
VESPUCCI_EXPORT arma::vec FindPeakMaxMat(const arma::mat &X, arma::vec abscissa, double &min, double &max, arma::vec &positions)
Vespucci::Math::Quantification::FindPeakMaxMat.
VESPUCCI_EXPORT arma::uword min(arma::uword a, arma::uword b)
Vespucci::Math::min.
VESPUCCI_EXPORT double FindPeakMax(const arma::vec &X, arma::uword min_index, arma::uword max_index, arma::uword &position)
Vespucci::Math::Quantification::FindPeakMax.