note that scipy.linalg.triu is deprecated as of v1.13