geometric-kernels / GeometricKernels

Geometric kernels on manifolds, meshes and graphs
https://geometric-kernels.github.io/
Apache License 2.0
218 stars 18 forks source link

Characters not orthogonal / random working incorrectly for SpecialOrthogonal with even n #152

Closed vabor112 closed 2 weeks ago

vabor112 commented 2 weeks ago

Bug

The test tests/spaces/test_lie_groups.py::test_characters_orthogonal fails for even n (we used to only test for odd n).

To reproduce

If you run tests/spaces/test_lie_groups.py::test_characters_orthogonal with _group fixture changed to

@pytest.fixture(name="group", params=[3, 5, 4, 6, 8])
def _group(group_cls, request):
    group = group_cls(n=request.param)
    return group

you get something like

tests/spaces/test_lie_groups.py::test_characters_orthogonal[10-4-so] FAILED

============================================================================== FAILURES ==============================================================================
________________________________________________________________ test_characters_orthogonal[10-4-so] _________________________________________________________________
tests/spaces/test_lie_groups.py:198: in test_characters_orthogonal
    assert_allclose(scalar_products, np.eye(order, dtype=dtype), atol=5e-2)
../../anaconda3/envs/gkconda_updated_sh/lib/python3.10/contextlib.py:79: in inner
    return func(*args, **kwds)
E   AssertionError:
E   Not equal to tolerance rtol=1e-07, atol=0.05
E
E   Mismatched elements: 99 / 100 (99%)
E   Max absolute difference: 117.54889286
E   Max relative difference: 117.54889286
E    x: array([[  1.      ,   3.443176,   2.443176,   2.443176,   6.389407,
E             5.389407,   5.389407,   2.946231,   2.946231,   9.394928],
E          [  3.443176,  12.275758,   8.832582,   8.832582,  23.616917,...
E    y: array([[1., 0., 0., 0., 0., 0., 0., 0., 0., 0.],
E          [0., 1., 0., 0., 0., 0., 0., 0., 0., 0.],
E          [0., 0., 1., 0., 0., 0., 0., 0., 0., 0.],...

Expected behavior

The test should not fail.

System information

vabor112 commented 2 weeks ago

One simple way to reproduce: run make test on commit https://github.com/geometric-kernels/GeometricKernels/pull/149/commits/a817021dcda588898a951138b73081b6e105437f

vabor112 commented 2 weeks ago

Fixed by https://github.com/geometric-kernels/GeometricKernels/commit/461670378ea254a7e286388fa932ba640f6949de. As it turns out, this bug was never present in main.