I would like to create a block tridiagonal matrix starting from three numpy.ndarray. Is there any (direct) way to do that in python?
Thank you in advance!
Ch
@TheCorwoodRep's answer can actually be done in a single line. No need for a seperate function.
np.eye(3,3,k=-1) + np.eye(3,3)*2 + np.eye(3,3,k=1)*3
This produces:
array([[ 2., 3., 0.], [ 1., 2., 3.], [ 0., 1., 2.]])