# KSPSetWorkVecs
Sets a number of work vectors into a `KSP` object 
## Synopsis
```
#include "petscksp.h" 
PetscErrorCode KSPSetWorkVecs(KSP ksp, PetscInt nw)
```
Collective on ksp


## Input Parameters

- ***ksp  -*** iterative context
- ***nw   -*** number of work vectors to allocate





## Developers Note
This is PETSC_EXTERN because it may be used by user written plugin KSP implementations


## See Also
 [](chapter_ksp), `KSP`, `KSPCreateVecs()`

## Level
developer

## Location
<A HREF="PETSC_DOC_OUT_ROOT_PLACEHOLDER/src/ksp/ksp/interface/iterativ.c.html#KSPSetWorkVecs">src/ksp/ksp/interface/iterativ.c</A>


---
[Edit on GitLab](https://gitlab.com/petsc/petsc/-/edit/release/src/ksp/ksp/interface/iterativ.c)


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