def tridiag(d, diag_value, offdiag_value):
diag_mat = tf.eye(d) * (diag_value - offdiag_value)<EOL>three_bands = tf.linalg.band_part(tf.fill([d, d], offdiag_value), <NUM_LIT:1>, <NUM_LIT:1>)<EOL>return diag_mat + three_bands<EOL>
d x d matrix with given value on diag, and one super/sub diag.