# 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

## Input Parameters#

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

## Output Parameters#

concatenated vector**Y -**array of index sets corresponding to the concatenated components of**x_is -**`Y`

(pass`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#

Vectors and Parallel Data, `Vec`

, `VECNEST`

, `VECSCATTER`

, `VecScatterCreate()`

## Level#

advanced

## Location#

## Examples#

## 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