class_docstr: Rosenbrock function.
  
  The following optimization problem:
      minimize sum(100.0*(x[1:] - x[:-1]**2.0)**2.0 + (1 - x[:-1])**2.0)
class_docstr_tok: ["Rosenbrock","function",".","The","following","optimization","problem",":","minimize","sum","(","100.0","*","(","x","[","1",":","]","-","x","[",":","-1","]","*","*","2.0",")","*","*","2.0","+","(","1","-","x","[",":","-1","]",")","*","*","2.0",")"]
code: def grad(self, x):
      x = np.asarray(x)
      xm = x[1:-1]
      xm_m1 = x[:-2]
      xm_p1 = x[2:]
      der = np.zeros_like(x)
      der[1:-1] = (
          200 * (xm - xm_m1**2)
          - 400 * (xm_p1 - xm**2) * xm
          - 2 * (1 - xm)
      )
      der[0] = -400 * x[0] * (x[1] - x[0] ** 2) - 2 * (1 - x[0])
      der[-1] = 200 * (x[-1] - x[-2] ** 2)
      return der
  
imports: from __future__ import division, print_function, absolute_import
  import numpy
  import pytest
  from scipy.linalg import block_diag
  from scipy.sparse import csc_matrix
  from numpy.testing import TestCase, assert_array_almost_equal, assert_array_less, assert_allclose, assert_
  from pytest import raises
  from scipy.optimize import NonlinearConstraint, LinearConstraint, Bounds, minimize, BFGS, SR1
  from scipy._lib._numpy_compat import suppress_warnings
label_desc: Use image node_id 3 for calling the Rosenbrock obj's underlying member method code with example usage: obj.grad(x) and returns: der