1import numpy as np
2...
3shape = (6, 6) #This will be some pre-determined size
4sigma = np.diag(S) #diagonalise the matrix - this works
5sigma.resize(shape) #Resize the matrix and fill with zeros
1# This assumes that you have a 2-dimensional array
2zeros = np.zeros(shape, dtype=np.int32)
3zeros[:sigma.shape[0], :sigma.shape[1]] = sigma