code: def _nnls_lbfgs_block(
      A: np.ndarray,
      B: np.ndarray,
      x_init: Optional[np.ndarray] = None,
      **kwargs: Any,
  ) -> np.ndarray:
      """Solve the constrained problem over a single block
  
      Parameters
      ----------
      A : np.ndarray [shape=(m, d)]
          The basis matrix
      B : np.ndarray [shape=(m, N)]
          The regression targets
      x_init : np.ndarray [shape=(d, N)]
          An initial guess
      **kwargs
          Additional keyword arguments to `scipy.optimize.fmin_l_bfgs_b`
  
      Returns
      -------
      x : np.ndarray [shape=(d, N)]
          Non-negative matrix such that Ax ~= B
      """
      # If we don't have an initial point, start at the projected
      # least squares solution
      if x_init is None:
          # Suppress type checks because mypy can't find pinv
          x_init = np.einsum(
              "fm,...mt->...ft", np.linalg.pinv(A), B, optimize=True
          )
          np.clip(x_init, 0, None, out=x_init)
  
      # Adapt the hessian approximation to the dimension of the problem
      kwargs.setdefault("m", A.shape[1])
  
      # Construct non-negative bounds
      bounds = [(0, None)] * x_init.size
      shape = x_init.shape
  
      # optimize
      x: np.ndarray
      x, obj_value, diagnostics = scipy.optimize.fmin_l_bfgs_b(
          _nnls_obj, x_init, args=(shape, A, B), bounds=bounds, **kwargs
      )
      # reshape the solution
      return x.reshape(shape)
  
imports: import numpy
  import scipy.optimize
  from .utils import MAX_MEM_BLOCK
  from typing import Any, Optional, Tuple, Sequence
label_desc: Use image node_id 2 for calling a global function with example usage: _nnls_lbfgs_block(A, B, x_init) and returns: x