tenpy.tools.misc.pad(a, w_l=0, v_l=0, w_r=0, v_r=0, axis=0)[source]

Pad an array along a given axis.

Parameters
• a (ndarray) – the array to be padded

• w_l (int) – the width to be padded in the front

• v_l (dtype) – the value to be inserted before a

• w_r (int) – the width to be padded after the last index

• v_r (dtype) – the value to be inserted after a

• axis (int) – the axis along which to pad

Returns

padded – a copy of a with enlarged axis, padded with the given values.

Return type

ndarray