Works with upper and lower triangular values.