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

• 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.

Vectors and Parallel Data, Vec, VECNEST, VECSCATTER, VecScatterCreate()