You may stack vectors row-wise or column-wise using vstack and column_stack, as illustrated in Figure 4.3:

Figure 4.3: Difference between vstack and column_stack
Note that hstack would produce the concatenation of v1 and v2.Â
Let's consider the symplectic permutation as an example for vector stacking: we have a vector of sizeÂ
. We want to perform a symplectic transformation of a vector with an even number of components, that is, exchange the first half with the second half of the vector with sign change:

This operation is resolved in Python as follows:
# v is supposed to have an even length.
def symp(v):
n = len(v) // 2 # use the integer division //
return hstack([v[-n:], -v[:n]])