petsc-3.12.4 2020-02-04
Report Typos and Errors

# VecGetSubVector

Gets a vector representing part of another vector

### Synopsis

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

Collective on IS

### Input Arguments

| X | - vector from which to extract a subvector
| is | - index set representing portion of X to extract

### Output Arguments

Y -subvector corresponding to is

### Notes

The subvector Y should be returned with VecRestoreSubVector().

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.

### See Also

MatCreateSubMatrix()

### Level

advanced

### Location

src/vec/vec/interface/rvector.c

### Examples

src/snes/examples/tutorials/ex70.c.html

### Implementations

VecGetSubVector_Nest in src/vec/vec/impls/nest/vecnest.c
Index of all Vec routines
Table of Contents for all manual pages
Index of all manual pages