code: def _squared_loss_derivative_lipschitz_constant(
      X, mask, grad_weight, n_iterations=100
  ):
      """Compute the lipschitz constant of the gradient of the smooth part \
      of the Graph-Net regression problem (squared_loss + grad_weight*grad) \
      via power method."""
      rng = np.random.RandomState(42)
      a = rng.randn(X.shape[1])
      a /= sqrt(np.dot(a, a))
      adjoint_mask = np.tile(mask, [mask.ndim] + [1] * mask.ndim)
  
      # Since we are putting the coefficient into the matrix, which
      # is squared in the data loss function, it must be the
      # square root of the desired weight
      actual_grad_weight = sqrt(grad_weight)
      for _ in range(n_iterations):
          a = _graph_net_adjoint_data_function(
              X,
              _graph_net_data_function(X, a, mask, actual_grad_weight),
              adjoint_mask,
              actual_grad_weight,
          )
          a /= sqrt(np.dot(a, a))
  
      lipschitz_constant = np.dot(
          _graph_net_adjoint_data_function(
              X,
              _graph_net_data_function(X, a, mask, actual_grad_weight),
              adjoint_mask,
              actual_grad_weight,
          ),
          a,
      ) / np.dot(a, a)
  
      return lipschitz_constant
  
file_path: nilearn/nilearn/decoding/space_net_solvers.py
imports: from math import sqrt
  import numpy
  from nilearn.masking import unmask_from_to_3d_array
  from ._objective_functions import divergence, gradient, gradient_id, logistic_loss, logistic_loss_grad, logistic_loss_lipschitz_constant, spectral_norm_squared, squared_loss, squared_loss_grad
  from ._proximal_operators import prox_l1, prox_l1_with_intercept, prox_tvl1, prox_tvl1_with_intercept
  from .fista import mfista
label_desc: Use image node_id 5 for calling a global function with example usage: _squared_loss_derivative_lipschitz_constant(X, mask, grad_weight, n_iterations) and returns: lipschitz_constant