LinqExtensions.Aggregate Method

Definition

Namespace: Extreme.DataAnalysis.Linq
Assembly: Extreme.Numerics (in Extreme.Numerics.dll) Version: 8.1.23

Overload List

Aggregate<T>(Vector<T>, Func<T, T, T>) Applies an accumulator function over the elements of a vector.
Aggregate<T, TAccumulate>(Vector<T>, TAccumulate, Func<TAccumulate, T, TAccumulate>) Applies an accumulator function over the elements of a vector.
Aggregate<R, C, TAccumulate>(DataFrame<R, C>, TAccumulate, Func<TAccumulate, DataFrameRow<R, C>, TAccumulate>) Applies an accumulator function over the rows of a data frame. The specified seed value is used as the initial accumulator value.
Aggregate<T, TAccumulate, TResult>(Vector<T>, TAccumulate, Func<TAccumulate, T, TAccumulate>, Func<TAccumulate, TResult>) Aggregates the elements of a vector using the specified accumulator and seed value.
Aggregate<R, C, TAccumulate, TResult>(DataFrame<R, C>, TAccumulate, Func<TAccumulate, DataFrameRow<R, C>, TAccumulate>, Func<TAccumulate, TResult>) Applies an accumulator function over the rows of a data frame. The specified seed value is used as the initial accumulator value.

Aggregate<T>(Vector<T>, Func<T, T, T>)

Applies an accumulator function over the elements of a vector.
C#
public static T Aggregate<T>(
	this Vector<T> vector,
	Func<T, T, T> func
)

Parameters

vector  Vector<T>
A vector to aggregate over.
func  Func<T, T, T>
An accumulator function to apply to each element.

Type Parameters

T
The type of the elements of the vector.

Return Value

T
The final accumulator value.

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

Aggregate<R, C, TAccumulate>(DataFrame<R, C>, TAccumulate, Func<TAccumulate, DataFrameRow<R, C>, TAccumulate>)

Applies an accumulator function over the rows of a data frame. The specified seed value is used as the initial accumulator value.
C#
public static TAccumulate Aggregate<R, C, TAccumulate>(
	this DataFrame<R, C> frame,
	TAccumulate seed,
	Func<TAccumulate, DataFrameRow<R, C>, TAccumulate> func
)

Parameters

frame  DataFrame<R, C>
A data frame to project.
seed  TAccumulate
The initial accumulator value.
func  Func<TAccumulate, DataFrameRow<R, C>, TAccumulate>
An accumulator function to be invoked on each element.

Type Parameters

R
The element type of the row index of the data frame.
C
The element type of the column index of the data frame.
TAccumulate
The type of the accumulated value.

Return Value

TAccumulate
The final accumulator value.

Usage Note

In Visual Basic and C#, you can call this method as an instance method on any object of type DataFrame<R, C>. 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

frame is null.

-or-

func is null.

Aggregate<T, TAccumulate>(Vector<T>, TAccumulate, Func<TAccumulate, T, TAccumulate>)

Applies an accumulator function over the elements of a vector.
C#
public static TAccumulate Aggregate<T, TAccumulate>(
	this Vector<T> vector,
	TAccumulate seed,
	Func<TAccumulate, T, TAccumulate> func
)

Parameters

vector  Vector<T>
A vector to aggregate over.
seed  TAccumulate
The initial accumulator value.
func  Func<TAccumulate, T, TAccumulate>
An accumulator function to apply to each element.

Type Parameters

T
The type of the elements of the vector.
TAccumulate
The type of the accumulator value.

Return Value

TAccumulate
The final accumulator value.

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

Aggregate<R, C, TAccumulate, TResult>(DataFrame<R, C>, TAccumulate, Func<TAccumulate, DataFrameRow<R, C>, TAccumulate>, Func<TAccumulate, TResult>)

Applies an accumulator function over the rows of a data frame. The specified seed value is used as the initial accumulator value.
C#
public static TResult Aggregate<R, C, TAccumulate, TResult>(
	this DataFrame<R, C> frame,
	TAccumulate seed,
	Func<TAccumulate, DataFrameRow<R, C>, TAccumulate> func,
	Func<TAccumulate, TResult> resultSelector
)

Parameters

frame  DataFrame<R, C>
A data frame to project.
seed  TAccumulate
The initial accumulator value.
func  Func<TAccumulate, DataFrameRow<R, C>, TAccumulate>
An accumulator function to be invoked on each element.
resultSelector  Func<TAccumulate, TResult>
A function to be applied to the final accumulator value.

Type Parameters

R
The element type of the row index of the data frame.
C
The element type of the column index of the data frame.
TAccumulate
The type of the accumulated value.
TResult
The type of the final result.

Return Value

TResult
The final accumulator value.

Usage Note

In Visual Basic and C#, you can call this method as an instance method on any object of type DataFrame<R, C>. 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

frame is null.

-or-

func is null.

-or-

resultSelector is null.

Aggregate<T, TAccumulate, TResult>(Vector<T>, TAccumulate, Func<TAccumulate, T, TAccumulate>, Func<TAccumulate, TResult>)

Aggregates the elements of a vector using the specified accumulator and seed value.
C#
public static TResult Aggregate<T, TAccumulate, TResult>(
	this Vector<T> vector,
	TAccumulate seed,
	Func<TAccumulate, T, TAccumulate> func,
	Func<TAccumulate, TResult> resultSelector
)

Parameters

vector  Vector<T>
A vector.
seed  TAccumulate
A seed value for the accumulator.
func  Func<TAccumulate, T, TAccumulate>
A function that accumulates an element of the vector.
resultSelector  Func<TAccumulate, TResult>
A function that transforms the result of the accumulation.

Type Parameters

T
The element type of the vector.
TAccumulate
The return type of the accumulator.
TResult
The type of the result.

Return Value

TResult
The function resultSelector applied to the result of accumulating the values of vector with seed value seed using the function func.

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

See Also