Stats.Mean Method

Definition

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

Overload List

Mean(DateTime[]) Returns the mean of the elements of an array of DateTime values.
Mean<T>(Vector<T>) Returns the mean of the elements of a vector.
Mean<T>(T[], Boolean) Returns the mean of the elements of a read-only span.
Mean<T>(IEnumerable<T>, Boolean) Returns the mean of the elements of a sequence.
Mean<T>(ReadOnlySpan<T>, Boolean) Returns the mean of the elements of a read-only span.

Mean(DateTime[])

Returns the mean of the elements of an array of DateTime values.
C#
public static DateTime Mean(
	DateTime[] values
)

Parameters

values  DateTime[]
A DateTime array.

Return Value

DateTime
The mean of the elements of values.

Remarks

The mean is a DateTime value.

Exceptions

ArgumentNullException

values is null.

Mean<T>(Vector<T>)

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

Parameters

values  Vector<T>
A vector.

Type Parameters

T
The type of the elements of values.

Return Value

Double
The 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).

Exceptions

ArgumentNullException

values is null.

Mean<T>(T[], Boolean)

Returns the mean of the elements of a read-only span.
C#
public static double Mean<T>(
	this T[] values,
	bool skipMissingValues = false
)

Parameters

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

Type Parameters

T

Return Value

Double
The 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).

Mean<T>(IEnumerable<T>, Boolean)

Returns the mean of the elements of a sequence.
C#
public static double Mean<T>(
	IEnumerable<T> values,
	bool skipMissingValues = false
)

Parameters

values  IEnumerable<T>
An object that implements IEnumerable<Double>.
skipMissingValues  Boolean  (Optional)
Optional. Specifies whether missing values should be excluded from the calculation. The default is false.

Type Parameters

T

Return Value

Double
The mean of the elements of values.

Exceptions

ArgumentNullException

values is null.

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

Returns the mean of the elements of a read-only span.
C#
public static double Mean<T>(
	this ReadOnlySpan<T> values,
	bool skipMissingValues = false
)

Parameters

values  ReadOnlySpan<T>
A read-only span.
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

Double
The 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).

See Also