How to use the thewalrus.libwalrus.hermite_multidimensional function in thewalrus

To help you get started, we’ve selected a few thewalrus examples, based on popular ways it is used in public projects.

Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.

github XanaduAI / thewalrus / thewalrus / _hermite_multidimensional.py View on Github external
if y is None:
        y = np.zeros([n], dtype=complex)

    m = y.shape[0]
    if m != n:
        raise ValueError("The matrix R and vector y have incompatible dimensions")


    Rt = np.real_if_close(R)
    yt = np.real_if_close(y)

    if Rt.dtype == np.float and yt.dtype == np.float:
        values = np.array(hmr(Rt, yt, cutoff, renorm=renorm))
    else:
        values = np.array(hm(R, y, cutoff, renorm=renorm))

    if make_tensor:
        shape = cutoff * np.ones([n], dtype=int)
        values = np.reshape(values, shape)

    return values