Example #1
0
def test_gell_mann_idx_8():
    """Gell-Mann operator for index = 8."""
    expected_res = np.array([[1, 0, 0], [0, 1, 0], [0, 0, -2]]) / np.sqrt(3)
    res = gell_mann(8)

    bool_mat = np.isclose(expected_res, res)
    np.testing.assert_equal(np.all(bool_mat), True)
Example #2
0
def test_gell_mann_idx_2():
    """Gell-Mann operator for index = 2."""
    expected_res = np.array([[0, -1j, 0], [1j, 0, 0], [0, 0, 0]])
    res = gell_mann(2)

    bool_mat = np.isclose(expected_res, res)
    np.testing.assert_equal(np.all(bool_mat), True)
Example #3
0
def test_gell_mann_sparse():
    """Test sparse Gell-Mann matrix."""
    res = gell_mann(3, is_sparse=True)
    np.testing.assert_equal(isinstance(res, csr_matrix), True)
Example #4
0
def test_gell_mann_invalid_idx():
    """Invalid Gell-Mann parameters."""
    with np.testing.assert_raises(ValueError):
        gell_mann(9)