code: def test_sparse_encode_input():
      n_components = 100
      rng = np.random.RandomState(0)
      V = rng.randn(n_components, n_features)  # random init
      V /= np.sum(V**2, axis=1)[:, np.newaxis]
      Xf = check_array(X, order="F")
      for algo in (
          "lasso_lars",
          "lasso_cd",
          "lars",
          "omp",
          "threshold",
      ):
          a = sparse_encode(X, V, algorithm=algo)
          b = sparse_encode(Xf, V, algorithm=algo)
          assert_array_almost_equal(a, b)
  
imports: import itertools
  import warnings
  from functools import partial
  import numpy
  import pytest
  import sklearn
  from sklearn.base import clone
  from sklearn.decomposition import DictionaryLearning, MiniBatchDictionaryLearning, SparseCoder, dict_learning, dict_learning_online, sparse_encode
  from sklearn.decomposition._dict_learning import _update_dict
  from sklearn.exceptions import ConvergenceWarning
  from sklearn.utils import check_array
  from sklearn.utils._testing import TempMemmap, assert_allclose, assert_array_almost_equal, assert_array_equal, ignore_warnings
  from sklearn.utils.estimator_checks import check_transformer_data_not_an_array, check_transformer_general, check_transformers_unfitted
  from sklearn.utils.parallel import Parallel
label_desc: Use image node_id 28 for calling a global function with example usage: test_sparse_encode_input() without return types