xxxxxxxxxx
import numpy as np
from scipy.sparse import diags
# Making example matrices (4x4)
o = np.array([-1, 0, 1]) # Offset
d1 = diags([1, 2, 1], o, (4, 4)).toarray()
d2 = diags([2, 1, 2], o, (4, 4)).toarray()
# Stacking horizontally
d3 = np.hstack((d1, d2))