code: def test_against_R_monotone(self):
      y = [0, 6, 8, 3, 5, 2, 1, 7, 9, 4]
      res = isotonic_regression(y)
      # R code
      # library(monotone)
      # options(digits=8)
      # monotone(c(0, 6, 8, 3, 5, 2, 1, 7, 9, 4))
      x_R = [
          0,
          4.1666667,
          4.1666667,
          4.1666667,
          4.1666667,
          4.1666667,
          4.1666667,
          6.6666667,
          6.6666667,
          6.6666667,
      ]
      assert_allclose(res.x, x_R)
      assert_equal(res.blocks, [0, 1, 7, 10])
  
      n = 100
      y = np.linspace(0, 1, num=n, endpoint=False)
      y = 5 * y + np.sin(10 * y)
      res = isotonic_regression(y)
      # R code
      # library(monotone)
      # n <- 100
      # y <- 5 * ((1:n)-1)/n + sin(10 * ((1:n)-1)/n)
      # options(digits=8)
      # monotone(y)
      x_R = [
          0.00000000,
          0.14983342,
          0.29866933,
          0.44552021,
          0.58941834,
          0.72942554,
          0.86464247,
          0.99421769,
          1.11735609,
          1.23332691,
          1.34147098,
          1.44120736,
          1.53203909,
          1.57081100,
          1.57081100,
          1.57081100,
          1.57081100,
          1.57081100,
          1.57081100,
          1.57081100,
          1.57081100,
          1.57081100,
          1.57081100,
          1.57081100,
          1.57081100,
          1.57081100,
          1.57081100,
          1.57081100,
          1.57081100,
          1.57081100,
          1.57081100,
          1.57081100,
          1.57081100,
          1.57081100,
          1.57081100,
          1.57081100,
          1.57081100,
          1.57081100,
          1.57081100,
          1.57081100,
          1.57081100,
          1.57081100,
          1.57081100,
          1.57081100,
          1.57081100,
          1.57081100,
          1.57081100,
          1.57081100,
          1.57081100,
          1.57081100,
          1.57081100,
          1.62418532,
          1.71654534,
          1.81773256,
          1.92723551,
          2.04445967,
          2.16873336,
          2.29931446,
          2.43539782,
          2.57612334,
          2.72058450,
          2.86783750,
          3.01691060,
          3.16681390,
          3.31654920,
          3.46511999,
          3.61154136,
          3.75484992,
          3.89411335,
          4.02843976,
          4.15698660,
          4.27896904,
          4.39366786,
          4.50043662,
          4.59870810,
          4.68799998,
          4.76791967,
          4.83816823,
          4.86564130,
          4.86564130,
          4.86564130,
          4.86564130,
          4.86564130,
          4.86564130,
          4.86564130,
          4.86564130,
          4.86564130,
          4.86564130,
          4.86564130,
          4.86564130,
          4.86564130,
          4.86564130,
          4.86564130,
          4.86564130,
          4.86564130,
          4.86564130,
          4.86564130,
          4.86564130,
          4.86564130,
          4.86564130,
      ]
      assert_allclose(res.x, x_R)
  
      # Test increasing
      assert np.all(np.diff(res.x) >= 0)
  
      # Test balance property: sum(y) == sum(x)
      assert_allclose(np.sum(res.x), np.sum(y))
  
      # Reverse order
      res_inv = isotonic_regression(-y, increasing=False)
      assert_allclose(-res_inv.x, res.x)
      assert_equal(res_inv.blocks, res.blocks)
  
file_path: scipy/scipy/optimize/tests/test_isotonic_regression.py
imports: import numpy
  from numpy.testing import assert_allclose, assert_equal
  import pytest
  from scipy.optimize._pava_pybind import pava
  from scipy.optimize import isotonic_regression
label_desc: Use image node_id 6 for calling the TestIsotonicRegression obj's underlying member method code with example usage: obj.test_against_R_monotone() without return types