# AUTOGENERATED! DO NOT EDIT! File to edit: 02_herm.ipynb (unless otherwise specified).

__all__ = ['rand_herm_ndarray', 'test_herm_ndarray']

# Cell
from numpy.random import random_sample
from numpy import array
from numpy.testing import assert_allclose
from qutip.random_objects import rand_herm
from qutip import Qobj

# Cell
def rand_herm_ndarray(ndarray_shape):
    r"""Make a random hermitian ndarray of ndarray_shape"""
    N = ndarray_shape[0]
    try:
        assert N == ndarray_shape[1]
    except AssertionError as  e:
        print("Please pass a shape that is square")
    herm_qutip = rand_herm(N)
    herm_ndarray = herm_qutip.full()
    return herm_ndarray

# Cell
def test_herm_ndarray(ndarray):
    r"""Returns true if array is Hermitian"""
    therm_qutip = Qobj(ndarray)
    herm_test_result = therm_qutip.isherm
    return herm_test_result
