BuildSysPro.Utilities.Math.FindMultiExtremum

# .BuildSysPro.Utilities.Math.FindMultiExtremum

Extract the n smallest values (ascending=true) or greatest values (ascending=false) of a vector X

## Information

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 :

- a vector X made of N real values,
- n, the number of extreme values to extract from the vector X
- The boolean ascending, to set if extreme values wanted are the smallest ones (=true) or the greatest ones (=false)

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)
--------------------------------------------------------------

#### Interface

>     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;

## Revisions

Benoît Charrier 01/2016 : Adaptation pour compatibilité avec OpenModelica

Generated at 2026-05-12T20:19:03Z by OpenModelicaOpenModelica 1.26.7 using GenerateDoc.mos