code: def is_valid(self):
          
          # Lazy import to improve `import odl` time
          import scipy.sparse
  
          if scipy.sparse.isspmatrix(self.matrix):
              raise NotImplementedError('validation not supported for sparse '
                                        'matrices')
          elif self._eigval is not None:
              return np.all(np.greater(self._eigval, 0))
          else:
              try:
                  np.linalg.cholesky(self.matrix)
                  return np.array_equal(self.matrix, self.matrix.conj().T)
              except np.linalg.LinAlgError:
                  return False
docs: Test if the matrix is positive definite Hermitian.
  
          If the matrix decomposition is available, this test checks
          if all eigenvalues are positive.
          Otherwise, the test tries to calculate a Cholesky decomposition,
          which can be very time-consuming for large matrices. Sparse
          matrices are not supported.