code: def test_vec2vec_rotmat():
      a = np.array([1, 0, 0])
      for b in np.array([[0, 0, 1], [-1, 0, 0], [1, 0, 0]]):
          R = vec2vec_rotmat(a, b)
          assert_array_almost_equal(np.dot(R, a), b)
  
      # These vectors are not unit norm
      c = np.array([0.33950729, 0.92041729, 0.1938216])
      d = np.array([0.40604787, 0.97518325, 0.2057731])
      R1 = vec2vec_rotmat(c, d)
  
      c_norm = c / np.linalg.norm(c)
      d_norm = d / np.linalg.norm(d)
      R2 = vec2vec_rotmat(c_norm, d_norm)
  
      assert_array_almost_equal(R1, R2, decimal=1)
      assert_array_almost_equal(np.diag(R1), np.diag(R2), decimal=3)
  
      # we are catching collinear vectors
      # but in the case where they are not
      # exactly collinear and slightly different
      # the cosine can be larger than 1 or smaller than
      # -1 and therefore we have to catch that issue
      e = np.array([1.0001, 0, 0])
      f = np.array([1.001, 0.01, 0])
      R3 = vec2vec_rotmat(e, f)
  
      g = np.array([1.001, 0.0, 0])
      R4 = vec2vec_rotmat(e, g)
  
      assert_array_almost_equal(R3, R4, decimal=1)
  
      assert_array_almost_equal(np.diag(R3), np.diag(R4), decimal=3)
  
imports: import numpy
  import random
  from dipy.core.geometry import sphere2cart, cart2sphere, nearest_pos_semi_def, sphere_distance, cart_distance, vector_cosine, lambert_equal_area_projection_polar, circumradius, vec2vec_rotmat, vector_norm, compose_transformations, compose_matrix, decompose_matrix, perpendicular_directions, dist_to_corner, is_hemispherical
  from numpy.testing import assert_array_equal, assert_array_almost_equal, assert_equal, assert_raises, assert_almost_equal
  from dipy.testing.spherepoints import sphere_points
  from dipy.testing.decorators import set_random_number_generator
  from dipy.core.sphere_stats import random_uniform_on_sphere
  from itertools import permutations
label_desc: Use image node_id 11 for calling a global function with example usage: test_vec2vec_rotmat() without return types