code: def test_pinv_hermitian():
      A = matrix("A", dtype="complex128")
      A_h_test = np.c_[[3, 3 + 2j], [3 - 2j, 2]]
      A_not_h_test = A_h_test + 0 + 1j
  
      A_inv = pt_nlinalg.pinv(A, hermitian=False)
      jax_fn = function([A], A_inv, mode="JAX")
  
      assert np.allclose(
          jax_fn(A_h_test), np.linalg.pinv(A_h_test, hermitian=False)
      )
      assert np.allclose(
          jax_fn(A_h_test), np.linalg.pinv(A_h_test, hermitian=True)
      )
      assert np.allclose(
          jax_fn(A_not_h_test),
          np.linalg.pinv(A_not_h_test, hermitian=False),
      )
      assert not np.allclose(
          jax_fn(A_not_h_test),
          np.linalg.pinv(A_not_h_test, hermitian=True),
      )
  
      A_inv = pt_nlinalg.pinv(A, hermitian=True)
      jax_fn = function([A], A_inv, mode="JAX")
  
      assert np.allclose(
          jax_fn(A_h_test), np.linalg.pinv(A_h_test, hermitian=False)
      )
      assert np.allclose(
          jax_fn(A_h_test), np.linalg.pinv(A_h_test, hermitian=True)
      )
      assert not np.allclose(
          jax_fn(A_not_h_test),
          np.linalg.pinv(A_not_h_test, hermitian=False),
      )
      # Numpy fails differently than JAX when hermitian assumption is violated
      assert not np.allclose(
          jax_fn(A_not_h_test),
          np.linalg.pinv(A_not_h_test, hermitian=True),
      )
  
imports: import numpy
  import pytest
  from packaging.version import parse
  from pytensor.compile.function import function
  from pytensor.compile.mode import Mode
  from pytensor.configdefaults import config
  from pytensor.graph.fg import FunctionGraph
  from pytensor.graph.op import get_test_value
  from pytensor.graph.rewriting.db import RewriteDatabaseQuery
  from pytensor.link.jax import JAXLinker
  from pytensor.tensor import blas
  from pytensor.tensor import nlinalg
  from pytensor.tensor.math import MaxAndArgmax, maximum
  from pytensor.tensor.math import max
  from pytensor.tensor.type import dvector, matrix, scalar, tensor3, vector
  from tests.link.jax.test_basic import compare_jax_and_py
label_desc: Use image node_id 6 for calling a global function with example usage: test_pinv_hermitian() without return types