# VecGetSubVector#

Gets a vector representing part of another vector

## Synopsis#

#include "petscvec.h"
PetscErrorCode VecGetSubVector(Vec X, IS is, Vec *Y)


Collective

## Input Parameters#

• X - vector from which to extract a subvector

• is - index set representing portion of X to extract

## Output Parameter#

• Y - subvector corresponding to is

## Notes#

The subvector Y should be returned with VecRestoreSubVector(). X and must be defined on the same communicator

This function may return a subvector without making a copy, therefore it is not safe to use the original vector while modifying the subvector. Other non-overlapping subvectors can still be obtained from X using this function. The resulting subvector inherits the block size from the IS if greater than one. Otherwise, the block size is guessed from the block size of the original vec.

Vectors and Parallel Data, Vec, IS, VECNEST, MatCreateSubMatrix()