Array Math.Sum If Method
Definition
Namespace: Numerics.NET
Assembly: Numerics.NET (in Numerics.NET.dll) Version: 9.0.0
Assembly: Numerics.NET (in Numerics.NET.dll) Version: 9.0.0
Overload List
Sum | Computes the sum of the elements in an array that satisfy the specified predicate. |
Sum | Computes the sum of the elements in an array that satisfy the specified predicate. |
SumIf(Double[], Func<Double, Boolean>)
Computes the sum of the elements in an array that satisfy the specified predicate.
public static double SumIf(
this double[] array,
Func<double, bool> predicate
)
Parameters
- array Double[]
- A Double array.
- predicate Func<Double, Boolean>
- A delegate that represents a function of one variable that returns whether a value should be included in the sum.
Return Value
DoubleThe sum of the specified elements in array.
Usage Note
In Visual Basic and C#, you can call this method as an instance method on any object of type Double[]. 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).SumIf(Double[], Func<Double, Int32, Boolean>)
Computes the sum of the elements in an array that satisfy the specified predicate.
public static double SumIf(
this double[] array,
Func<double, int, bool> predicate
)
Parameters
- array Double[]
- A Double array.
- predicate Func<Double, Int32, Boolean>
- A delegate that represents a function of one variable that returns whether a value at a specified index should be included in the sum.
Return Value
DoubleThe sum of the specified elements in array.