Skip to content

tuple_medianTupleMedianTupleMediantuple_mediantuple_median🔗

Short description🔗

tuple_medianTupleMedianTupleMediantuple_mediantuple_median — Return the median of the elements of a tuple.

Signature🔗

tuple_median( number Tuple, out number Median )void TupleMedian( const HTuple& Tuple, HTuple* Median )static void HOperatorSet.TupleMedian( HTuple tuple, out HTuple median )def tuple_median( tuple: MaybeSequence[Union[float, int]] ) -> Union[int, float]

Herror tuple_median( const Hlong Tuple, Hlong* Median )

Herror T_tuple_median( const Htuple Tuple, Htuple* Median )

HTuple HTuple::TupleMedian( ) const

HTuple HTuple.TupleMedian( )

Description🔗

tuple_medianTupleMedian calculates the median of all elements of the input tuple Tupletupletuple and returns it in the output parameter Medianmedianmedian. The input tuple may only consist of numbers (integer or floating point numbers). The median is defined as the element with rank n/2 (see tuple_select_rankTupleSelectRank).

Note that for an even number of input elements, this will return the upper median, not the arithmetic median. To calculate the arithmetic median, you can use tuple_select_rankTupleSelectRank to select the upper and lower median values and then calculate the arithmetic mean of both values.

Exception: Empty input tuple🔗

If the input tuple is empty, an exception is raised.

HDevelop In-line Operation🔗

HDevelop provides an in-line operation for tuple_medianTupleMedian, which can be used in an expression in the following syntax:

Median := median(Tuple)

Execution information🔗

Execution information
  • Multithreading type: reentrant (runs in parallel with non-exclusive operators).

  • Multithreading scope: global (may be called from any thread).

  • Processed without parallelization.

Parameters🔗

Tupletupletuple (input_control) number(-array) → (integer / real)HTuple (Hlong / double)HTuple (int / long / double)MaybeSequence[Union[float, int]]Htuple (Hlong / double)

Input tuple.

Medianmedianmedian (output_control) number → (integer / real)HTuple (Hlong / double)HTuple (int / long / double)Union[int, float]Htuple (Hlong / double)

Median of the tuple elements.

Combinations with other operators🔗

Combinations

Alternatives

tuple_select_rankTupleSelectRank

See also

tuple_meanTupleMean, tuple_minTupleMin, tuple_maxTupleMax

Module🔗

Foundation