-
Notifications
You must be signed in to change notification settings - Fork 57
Open
Description
Is your feature request related to a problem? Please describe.
The documentation says that the correlation kernel can be a complex Hermitian matrix with eigenvalues between 0 and 1. However, if you pass such a complex-valued matrix, it complains that the array is not symmetric:
import numpy as np
from dppy.finite_dpps import FiniteDPP
rng = np.random.default_rng(12345)
dim = 5
mat = rng.standard_normal((dim, dim)) + 1j * rng.standard_normal((dim, dim))
mat @= mat.T.conj()
mat /= np.trace(mat)
assert np.allclose(mat, mat.T.conj())
eigs, vecs = np.linalg.eigh(mat)
assert all(0 <= e <= 1 for e in eigs)
dpp = FiniteDPP("correlation", K=mat)Traceback (most recent call last):
File "/home/kjs/projects/ffsim/scratch/repro.py", line 12, in <module>
dpp = FiniteDPP("correlation", K=mat)
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "/home/kjs/.pyenv/versions/ffsim/lib/python3.12/site-packages/dppy/finite_dpps.py", line 121, in __init__
self.K = is_symmetric(params.get('K', None))
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "/home/kjs/.pyenv/versions/ffsim/lib/python3.12/site-packages/dppy/utils.py", line 133, in is_symmetric
raise ValueError('array not symmetric: M.T != M')
ValueError: array not symmetric: M.T != M
The same issue exists for the likelihood kernel,
dpp = FiniteDPP("likelihood", L=mat)Describe the solution you'd like
Complex-valued kernels should be supported.
Describe alternatives you've considered
N/A
Additional context
Complex-valued kernels arise when using DPPs to sample from fermionic systems.
Metadata
Metadata
Assignees
Labels
No labels