code: def test_GroupLasso_MultitaskLasso_equivalence():
      "GroupLasso and MultitaskLasso equivalence." ""
      n_samples, n_features = 30, 50
      X_, Y_ = build_dataset(n_samples, n_features, n_targets=3)
      y = Y_.reshape(-1, order="F")
      X = np.zeros([3 * n_samples, 3 * n_features], order="F")
  
      # block filling new design
      for i in range(3):
          X[
              i * n_samples : (i + 1) * n_samples,
              i * n_features : (i + 1) * n_features,
          ] = X_
  
      grp_indices = (
          np.arange(3 * n_features)
          .reshape(3, -1)
          .reshape(-1, order="F")
          .astype(np.int32)
      )
      grp_ptr = 3 * np.arange(n_features + 1).astype(np.int32)
  
      alpha_max = np.max(norm(X_.T @ Y_, axis=1)) / len(Y_)
  
      X_data = np.empty([1], dtype=X.dtype)
      X_indices = np.empty([1], dtype=np.int32)
      X_indptr = np.empty([1], dtype=np.int32)
      weights = np.ones(len(grp_ptr) - 1)
  
      other = dnorm_grp(
          False,
          y,
          grp_ptr,
          grp_indices,
          X,
          X_data,
          X_indices,
          X_indptr,
          X_data,
          weights,
          len(grp_ptr) - 1,
          np.zeros(1, dtype=np.int32),
          False,
      )
      np.testing.assert_allclose(alpha_max, other / len(Y_))
  
      alpha = alpha_max / 10
      clf = MultiTaskLasso(
          alpha, fit_intercept=False, tol=1e-8, verbose=0
      )
      clf.fit(X_, Y_)
  
      groups = [grp.tolist() for grp in grp_indices.reshape(50, 3)]
      clf1 = GroupLasso(
          alpha=alpha / 3,
          groups=groups,
          fit_intercept=False,
          tol=1e-8,
          verbose=0,
      )
      clf1.fit(X, y)
  
      np.testing.assert_allclose(
          clf1.coef_, clf.coef_.reshape(-1), atol=1e-4
      )
  
imports: import pytest
  import itertools
  import numpy
  from numpy.linalg import norm
  from numpy.testing import assert_allclose, assert_array_less, assert_array_equal
  from sklearn.utils.estimator_checks import check_estimator
  from sklearn.linear_model import MultiTaskLassoCV
  from sklearn.linear_model import MultiTaskLasso
  from sklearn.linear_model import lasso_path
  from celer import Lasso, GroupLasso, GroupLassoCV, MultiTaskLasso, MultiTaskLassoCV
  from celer.homotopy import celer_path, mtl_path, _grp_converter
  from celer.group_fast import dnorm_grp
  from celer.utils.testing import build_dataset
label_desc: Use image node_id 2 for calling a global function with example usage: test_GroupLasso_MultitaskLasso_equivalence() without return types