Stats.Median Method

Definition

Namespace: Numerics.NET.Statistics
Assembly: Numerics.NET (in Numerics.NET.dll) Version: 9.0.2

Overload List

Median(Int32[]) Returns the median of the elements of an array.
Median<T>(IList<T>) Returns the median of the elements of an array.
Median<T>(Vector<T>) Returns the median of the elements of a vector.
Median<T>(T[], Boolean) Returns the median of the elements of an array.
Median<T>(ReadOnlySpan<T>, Boolean) Returns the median of the elements of a span.

Median<T>(IList<T>)

Returns the median of the elements of an array.
C#
public static T Median<T>(
	IList<T> values
)
where T : Object, IComparable<T>

Parameters

values  IList<T>
An Int32 array.

Type Parameters

T

Return Value

T
The median of the elements of values.

Exceptions

ArgumentNullException

values is null.

Median(Int32[])

Returns the median of the elements of an array.
C#
public static double Median(
	int[] values
)

Parameters

values  Int32[]
An Int32 array.

Return Value

Double
The median of the elements of values.

Exceptions

ArgumentNullException

values is null.

Median<T>(Vector<T>)

Returns the median of the elements of a vector.
C#
public static T Median<T>(
	this Vector<T> values
)

Parameters

values  Vector<T>
A vector.

Type Parameters

T
The type of the elements of values.

Return Value

T
The median of the elements of values.

Usage Note

In Visual Basic and C#, you can call this method as an instance method on any object of type Vector<T>. When you use instance method syntax to call this method, omit the first parameter. For more information, see Extension Methods (Visual Basic) or Extension Methods (C# Programming Guide).

Exceptions

ArgumentNullException

values is null.

Median<T>(T[], Boolean)

Returns the median of the elements of an array.
C#
public static T Median<T>(
	this T[] values,
	bool skipMissingValues = false
)

Parameters

values  T[]
An array of values.
skipMissingValues  Boolean  (Optional)
Optional. Specifies whether missing values should be excluded from the calculation. The default is false.

Type Parameters

T
The type of the elements of values.

Return Value

T
The median of the elements of values.

Usage Note

In Visual Basic and C#, you can call this method as an instance method on any object of type T[]. When you use instance method syntax to call this method, omit the first parameter. For more information, see Extension Methods (Visual Basic) or Extension Methods (C# Programming Guide).

Exceptions

ArgumentNullException

values is null.

Median<T>(ReadOnlySpan<T>, Boolean)

Returns the median of the elements of a span.
C#
public static T Median<T>(
	this ReadOnlySpan<T> values,
	bool skipMissingValues = false
)

Parameters

values  ReadOnlySpan<T>
An span of values.
skipMissingValues  Boolean  (Optional)
Optional. Specifies whether missing values should be excluded from the calculation. The default is false.

Type Parameters

T
The type of the elements of values.

Return Value

T
The median of the elements of values.

Usage Note

In Visual Basic and C#, you can call this method as an instance method on any object of type ReadOnlySpan<T>. When you use instance method syntax to call this method, omit the first parameter. For more information, see Extension Methods (Visual Basic) or Extension Methods (C# Programming Guide).

Exceptions

ArgumentNullException

values is null.

See Also