# VecStrideSum
Computes the sum of subvector of a vector defined by a starting point and a stride. 
## Synopsis
```
#include "petscvec.h" 
PetscErrorCode VecStrideSum(Vec v, PetscInt start, PetscScalar *sum)
```
Collective on v


## Input Parameters

- ***v -*** the vector
- ***start -*** starting point of the subvector (defined by a stride)



## Output Parameter

- ***sum -*** the sum



## Notes
One must call `VecSetBlockSize()` before this routine to set the stride
information, or use a vector created from a multicomponent `DMDA`.

If x is the array representing the vector x then this computes the sum
of the array (x[start],x[start+stride],x[start+2*stride], ....)




## See Also
 `VecSum()`, `VecStrideGather()`, `VecStrideScatter()`, `VecStrideMin()`, `VecStrideMax()`

## Level
advanced

## Location
<A HREF="PETSC_DOC_OUT_ROOT_PLACEHOLDER/src/vec/vec/utils/vinv.c.html#VecStrideSum">src/vec/vec/utils/vinv.c</A>

## Examples
<A HREF="PETSC_DOC_OUT_ROOT_PLACEHOLDER/src/vec/vec/tutorials/ex13.c.html">src/vec/vec/tutorials/ex13.c.html</A><BR>


---
[Edit on GitLab](https://gitlab.com/petsc/petsc/-/edit/release/src/vec/vec/utils/vinv.c)


[Index of all Vec routines](index.md)  
[Table of Contents for all manual pages](/docs/manualpages/index.md)  
[Index of all manual pages](/docs/manualpages/singleindex.md)  
