code: def testcompare(m1, m2):
      from numpy.testing import assert_almost_equal, assert_approx_equal
  
      decimal = 12
  
      # inv
      assert_almost_equal(m1.minv, m2.minv, decimal=decimal)
  
      # matrix half and invhalf
      # fix sign in test, should this be standardized
      s1 = np.sign(m1.mhalf.sum(1))[:, None]
      s2 = np.sign(m2.mhalf.sum(1))[:, None]
      scorr = s1 / s2
      assert_almost_equal(m1.mhalf, m2.mhalf * scorr, decimal=decimal)
      assert_almost_equal(m1.minvhalf, m2.minvhalf, decimal=decimal)
  
      # eigenvalues, eigenvectors
      evals1, evecs1 = m1.meigh
      evals2, evecs2 = m2.meigh
      assert_almost_equal(evals1, evals2, decimal=decimal)
      # normalization can be different: evecs in columns
      s1 = np.sign(evecs1.sum(0))
      s2 = np.sign(evecs2.sum(0))
      scorr = s1 / s2
      assert_almost_equal(evecs1, evecs2 * scorr, decimal=decimal)
  
      # determinant
      assert_approx_equal(m1.mdet, m2.mdet, significant=13)
      assert_approx_equal(m1.mlogdet, m2.mlogdet, significant=13)
  
imports: import numpy
  from scipy import linalg
  from statsmodels.tools.decorators import cache_readonly
label_desc: Use image node_id 1 for calling a global function with example usage: testcompare(m1, m2) without return types