FindMultiExtremum returns a vector containing the n (where n <N) extreme values of the input vector X and their indexes.
Hypothesis and equations
This function takes as input :
FindMultiExtremum returns a vector Xm contenant les n (où n < N) containing the n (where n < N) extreme values of the input vector X and the vector Indm containing their indexes in the vector X.
Bibliography
none
Instructions for use
u = {1, 3, 4, 5, 4, 3}
(X,Ind)=FindMultiExtremum(X=u,n=4,ascending=false)
Declaring variable: Real X [4];
Declaring variable: Integer Ind [4];
X = {5.0, 4.0, 4.0, 3.0}, Ind = {4, 3, 5, 2}
Known limits / Use precautions
none
Validations
Validated function - Gilles Plessis, Hassan Bouia 06/2012
--------------------------------------------------------------
Licensed by EDF under a 3-clause BSD-license
Copyright © EDF 2009 - 2023
BuildSysPro version 3.6.0
Author : Gilles PLESSIS, Hassan BOUIA, EDF (2012)
--------------------------------------------------------------
function FindMultiExtremum input Integer n "Number of extreme values to extract to the vector X"; input Real[:] X "Vector of reals"; input Boolean ascending = false; output Real Xm[n] "Ordered extreme values of the vector X"; output Integer Indm[n] "Corresponding indexes in the vector X"; end FindMultiExtremum;
Benoît Charrier 01/2016 : Adaptation pour compatibilité avec OpenModelica