code: def test_sparse_pca_numerical_consistency(SPCA, method):
      # Verify numericall consistentency among np.float32 and np.float64
      rtol = 1e-3
      alpha = 2
      n_samples, n_features, n_components = 12, 10, 3
      rng = np.random.RandomState(0)
      input_array = rng.randn(n_samples, n_features)
  
      model_32 = SPCA(
          n_components=n_components,
          alpha=alpha,
          method=method,
          random_state=0,
      )
      transformed_32 = model_32.fit_transform(
          input_array.astype(np.float32)
      )
  
      model_64 = SPCA(
          n_components=n_components,
          alpha=alpha,
          method=method,
          random_state=0,
      )
      transformed_64 = model_64.fit_transform(
          input_array.astype(np.float64)
      )
  
      assert_allclose(transformed_64, transformed_32, rtol=rtol)
      assert_allclose(
          model_64.components_, model_32.components_, rtol=rtol
      )
  
imports: import sys
  import numpy
  import pytest
  from numpy.testing import assert_array_equal
  from sklearn.decomposition import PCA, MiniBatchSparsePCA, SparsePCA
  from sklearn.utils import check_random_state
  from sklearn.utils._testing import assert_allclose, assert_array_almost_equal, if_safe_multiprocessing_with_blas
label_desc: Use image node_id 14 for calling a global function with example usage: test_sparse_pca_numerical_consistency(SPCA, method) without return types