code: def test_pos_recipr():
      X = np.array([2, 1, -1, 0], dtype=np.int8)
      eX = np.array([0.5, 1, 0, 0])
      Y = pos_recipr(X)
      assert_array_almost_equal(Y, eX)
      assert Y.dtype.type == np.float64
      X2 = X.reshape((2, 2))
      Y2 = pos_recipr(X2)
      assert_array_almost_equal(Y2, eX.reshape((2, 2)))
      # check that lists have arrived
      XL = [0, 1, -1]
      assert_array_almost_equal(pos_recipr(XL), [0, 1, 0])
      # scalars
      assert pos_recipr(-1) == 0
      assert pos_recipr(0) == 0
      assert pos_recipr(2) == 0.5
  
file_path: nipy/nipy/algorithms/utils/tests/test_matrices.py
imports: import numpy
  import scipy.linalg
  from numpy.testing import assert_almost_equal, assert_array_almost_equal
  from ..matrices import full_rank, matrix_rank, pos_recipr, recipr0
label_desc: Use image node_id 3 for calling a global function with example usage: test_pos_recipr() without return types