Stats.HarmonicMean Method

Definition

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

Overload List

HarmonicMean(Int32[]) Returns the harmonic mean of the elements of an array.
HarmonicMean<T>(T[]) Returns the harmonic mean of the elements of an array.
HarmonicMean<T>(ReadOnlySpan<T>) Returns the harmonic mean of the elements of a span.
HarmonicMean<T>(Vector<T>) Returns the harmonic mean of the elements of a vector.

HarmonicMean<T>(T[])

Returns the harmonic mean of the elements of an array.
C#
public static T HarmonicMean<T>(
	this T[] values
)

Parameters

values  T[]
An array of values.

Type Parameters

T

Return Value

T
The harmonic mean 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).

Remarks

The harmonic mean is the reciprocal of the arithmetic mean of the reciprocals of the values values.

Exceptions

ArgumentNullException

values is null.

HarmonicMean(Int32[])

Returns the harmonic mean of the elements of an array.
C#
public static double HarmonicMean(
	int[] values
)

Parameters

values  Int32[]
An Int32 array.

Return Value

Double
The harmonic mean of the elements of values.

Remarks

The harmonic mean is the reciprocal of the arithmetic mean of the reciprocals of the values values.

The harmonic mean is a Double value.

Exceptions

ArgumentNullException

values is null.

HarmonicMean<T>(ReadOnlySpan<T>)

Returns the harmonic mean of the elements of a span.
C#
public static T HarmonicMean<T>(
	this ReadOnlySpan<T> values
)

Parameters

values  ReadOnlySpan<T>
A span of values.

Type Parameters

T

Return Value

T
The harmonic mean 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).

Remarks

The harmonic mean is the reciprocal of the arithmetic mean of the reciprocals of the values values.

Exceptions

ArgumentNullException

values is null.

HarmonicMean<T>(Vector<T>)

Returns the harmonic mean of the elements of a vector.
C#
public static T HarmonicMean<T>(
	this Vector<T> values
)

Parameters

values  Vector<T>
A vector.

Type Parameters

T

Return Value

T
The harmonic mean 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).

Remarks

The harmonic mean is the reciprocal of the arithmetic mean of the reciprocals of the values values.

Exceptions

ArgumentNullException

values is null.

See Also