Version

SumIf(Vector,BooleanVector) Method

Returns the sum of the elements of the Vectorx where the corresponding BooleanVector is True.
Syntax
'Declaration
 
Public Overloads Shared Function SumIf( _
   ByVal x As Vector, _
   ByVal comparison As BooleanVector _
) As Double
public static double SumIf( 
   Vector x,
   BooleanVector comparison
)

Parameters

x
A Vector.
comparison
A BooleanVector with the same length and orientation as x.

Return Value

The sum of the elements of x where comparison is true.
Exceptions
ExceptionDescription
System.ArithmeticException Occurs if the comparison has a different length than x.
System.ArithmeticException Occurs if the comparison has a different orientation than x.
Remarks
The BooleanVector comparison can be easily constructed using the compare operators on Vector. The following notation is convenient: Vector x1 = Compute.Line(-1, 1, 1000); double sumif = Compute.SumIf(x, x > 0);
Requirements

Target Platforms: Windows 10, Windows 8.1, Windows 8, Windows 7, Windows Server 2012, Windows 7, Windows Vista SP1 or later, Windows XP SP3, Windows Server 2008 (Server Core not supported), Windows Server 2008 R2 (Server Core supported with SP1 or later), Windows Server 2003 SP2

See Also