def test_special_matrix_objects(): from pybind11_tests import incr_diag, symmetric_upper, symmetric_lower assert np.all(incr_diag(7) == np.diag([1, 2, 3, 4, 5, 6, 7])) asymm = np.array([[1, 2, 3, 4], [5, 6, 7, 8], [9, 10, 11, 12], [13, 14, 15, 16]]) symm_lower = np.array(asymm) symm_upper = np.array(asymm) for i in range(4): for j in range(i + 1, 4): symm_lower[i, j] = symm_lower[j, i] symm_upper[j, i] = symm_upper[i, j] assert np.all(symmetric_lower(asymm) == symm_lower) assert np.all(symmetric_upper(asymm) == symm_upper)
def test_special_matrix_objects(): from pybind11_tests import incr_diag, symmetric_upper, symmetric_lower assert np.all(incr_diag(7) == np.diag([1., 2, 3, 4, 5, 6, 7])) asymm = np.array([[ 1., 2, 3, 4], [ 5, 6, 7, 8], [ 9, 10, 11, 12], [13, 14, 15, 16]]) symm_lower = np.array(asymm) symm_upper = np.array(asymm) for i in range(4): for j in range(i + 1, 4): symm_lower[i, j] = symm_lower[j, i] symm_upper[j, i] = symm_upper[i, j] assert np.all(symmetric_lower(asymm) == symm_lower) assert np.all(symmetric_upper(asymm) == symm_upper)