PETSc version 3.17.4
Fix/Edit manual page

# VecConcatenate

Creates a new vector that is a vertical concatenation of all the given array of vectors in the order they appear in the array. The concatenated vector resides on the same communicator and is the same type as the source vectors.

### Synopsis

    #include "petscvec.h"
    PetscErrorCode VecConcatenate(PetscInt nx, const Vec X[], Vec *Y, IS *x_is[])

Collective on X

### Input Parameters

| nx | - number of vectors to be concatenated
| X | - array containing the vectors to be concatenated in the order of concatenation

### Output Parameters

| Y | - concatenated vector
| x_is | - array of index sets corresponding to the concatenated components of Y (NULL if not needed)

### Notes

Concatenation is similar to the functionality of a VecNest object; they both represent combination of different vector spaces. However, concatenated vectors do not store any information about their sub-vectors and own their own data. Consequently, this function provides index sets to enable the manipulation of data in the concatenated vector that corresponds to the original components at creation.

This is a useful tool for outer loop algorithms, particularly constrained optimizers, where the solver has to operate on combined vector spaces and cannot utilize VecNest objects due to incompatibility with bound projections.

### See Also

VECNEST, VECSCATTER, VecScatterCreate()

### Level

advanced

### Location

src/vec/vec/interface/rvector.c

### Examples

src/vec/vec/tutorials/ex44.c.html

### Implementations

VecConcatenate_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