class_docstr: Generates a new quasirandom Sobol' vector with each call.
  
  Parameters
  ----------
  skip : int
      Skipped seed number.
  
  randomize : bool, default=False
      When set to True, random shift is applied.
  
  Notes
  -----
  Sobol' sequences [1]_ provide :math:`n=2^m` low discrepancy points in
  :math:`[0,1)^{dim}`. Scrambling them makes them suitable for singular
  integrands, provides a means of error estimation, and can improve their
  rate of convergence.
  
  There are many versions of Sobol' sequences depending on their
  'direction numbers'. Here, the maximum number of dimension is 40.
  
  The routine adapts the ideas of Antonov and Saleev [2]_.
  
  .. warning::
  
     Sobol' sequences are a quadrature rule and they lose their balance
     properties if one uses a sample size that is not a power of 2, or skips
     the first point, or thins the sequence [5]_.
  
     If :math:`n=2^m` points are not enough then one should take :math:`2^M`
     points for :math:`M>m`. When scrambling, the number R of independent
     replicates does not have to be a power of 2.
  
     Sobol' sequences are generated to some number :math:`B` of bits. Then
     after :math:`2^B` points have been generated, the sequence will repeat.
     Currently :math:`B=30`.
  
  References
  ----------
  .. [1] I. M. Sobol. The distribution of points in a cube and the accurate
     evaluation of integrals. Zh. Vychisl. Mat. i Mat. Phys., 7:784-802,
     1967.
  
  .. [2] Antonov, Saleev,
     USSR Computational Mathematics and Mathematical Physics,
     Volume 19, 1980, pages 252 - 256.
  
  .. [3] Paul Bratley, Bennett Fox,
     Algorithm 659:
     Implementing Sobol's Quasirandom Sequence Generator,
     ACM Transactions on Mathematical Software,
     Volume 14, Number 1, pages 88-100, 1988.
  
  .. [4] Bennett Fox,
     Algorithm 647:
     Implementation and Relative Efficiency of Quasirandom
     Sequence Generators,
  
  .. [5] Art B. Owen. On dropping the first Sobol' point. arXiv 2008.08051,
     2020.
code: def init(self, dim_num):
      self.dim_num_save = dim_num
      self.v = np.zeros((self.dim_max, self.log_max))
      self.v[0:40, 0] = np.transpose(
          [
              1,
              1,
              1,
              1,
              1,
              1,
              1,
              1,
              1,
              1,
              1,
              1,
              1,
              1,
              1,
              1,
              1,
              1,
              1,
              1,
              1,
              1,
              1,
              1,
              1,
              1,
              1,
              1,
              1,
              1,
              1,
              1,
              1,
              1,
              1,
              1,
              1,
              1,
              1,
              1,
          ]
      )
  
      self.v[2:40, 1] = np.transpose(
          [
              1,
              3,
              1,
              3,
              1,
              3,
              3,
              1,
              3,
              1,
              3,
              1,
              3,
              1,
              1,
              3,
              1,
              3,
              1,
              3,
              1,
              3,
              3,
              1,
              3,
              1,
              3,
              1,
              3,
              1,
              1,
              3,
              1,
              3,
              1,
              3,
              1,
              3,
          ]
      )
  
      self.v[3:40, 2] = np.transpose(
          [
              7,
              5,
              1,
              3,
              3,
              7,
              5,
              5,
              7,
              7,
              1,
              3,
              3,
              7,
              5,
              1,
              1,
              5,
              3,
              3,
              1,
              7,
              5,
              1,
              3,
              3,
              7,
              5,
              1,
              1,
              5,
              7,
              7,
              5,
              1,
              3,
              3,
          ]
      )
  
      self.v[5:40, 3] = np.transpose(
          [
              1,
              7,
              9,
              13,
              11,
              1,
              3,
              7,
              9,
              5,
              13,
              13,
              11,
              3,
              15,
              5,
              3,
              15,
              7,
              9,
              13,
              9,
              1,
              11,
              7,
              5,
              15,
              1,
              15,
              11,
              5,
              3,
              1,
              7,
              9,
          ]
      )
  
      self.v[7:40, 4] = np.transpose(
          [
              9,
              3,
              27,
              15,
              29,
              21,
              23,
              19,
              11,
              25,
              7,
              13,
              17,
              1,
              25,
              29,
              3,
              31,
              11,
              5,
              23,
              27,
              19,
              21,
              5,
              1,
              17,
              13,
              7,
              15,
              9,
              31,
              9,
          ]
      )
  
      self.v[13:40, 5] = np.transpose(
          [
              37,
              33,
              7,
              5,
              11,
              39,
              63,
              27,
              17,
              15,
              23,
              29,
              3,
              21,
              13,
              31,
              25,
              9,
              49,
              33,
              19,
              29,
              11,
              19,
              27,
              15,
              25,
          ]
      )
  
      self.v[19:40, 6] = np.transpose(
          [
              13,
              33,
              115,
              41,
              79,
              17,
              29,
              119,
              75,
              73,
              105,
              7,
              59,
              65,
              21,
              3,
              113,
              61,
              89,
              45,
              107,
          ]
      )
  
      self.v[37:40, 7] = np.transpose([7, 23, 39])
  
      #  Set POLY.
      self.poly = [
          1,
          3,
          7,
          11,
          13,
          19,
          25,
          37,
          59,
          47,
          61,
          55,
          41,
          67,
          97,
          91,
          109,
          103,
          115,
          131,
          193,
          137,
          145,
          143,
          241,
          157,
          185,
          167,
          229,
          171,
          213,
          191,
          253,
          203,
          211,
          239,
          247,
          285,
          369,
          299,
      ]
  
      #  Find the number of bits in ATMOST.
      self.maxcol = _bit_hi1(self.atmost)
  
      #  Initialize row 1 of V.
      self.v[0, 0 : self.maxcol] = 1
  
      #  Check parameters.
      if dim_num < 1 or self.dim_max < dim_num:
          raise ValueError(
              f"I4_SOBOL - Fatal error!\n"
              f"  The spatial dimension DIM_NUM should "
              f"satisfy:\n"
              f"  1 <= DIM_NUM <= {self.dim_max}\n"
              f"  But this input value is DIM_NUM = {dim_num}"
          )
  
      #  Initialize the remaining rows of V.
      for i in range(2, dim_num + 1):
          #  The bits of the integer POLY(I) gives the form of polynomial I.
          #  Find the degree of polynomial I from binary encoding.
          j = self.poly[i - 1]
          m = 0
          j //= 2
          while j > 0:
              j //= 2
              m += 1
  
          #  Expand this bit pattern to separate components
          #  of the logical array INCLUD.
          j = self.poly[i - 1]
          includ = np.zeros(m)
          for k in range(m, 0, -1):
              j2 = j // 2
              includ[k - 1] = j != 2 * j2
              j = j2
  
          #  Calculate the remaining elements of row I as explained
          #  in Bratley and Fox, section 2.
          for j in range(m + 1, self.maxcol + 1):
              newv = self.v[i - 1, j - m - 1]
              p2 = 1
              for k in range(1, m + 1):
                  p2 *= 2
                  if includ[k - 1]:
                      newv = np.bitwise_xor(
                          int(newv), int(p2 * self.v[i - 1, j - k - 1])
                      )
              self.v[i - 1, j - 1] = newv
      #  Multiply columns of V by appropriate power of 2.
      p2 = 1
      for j in range(self.maxcol - 1, 0, -1):
          p2 *= 2
          self.v[0:dim_num, j - 1] = self.v[0:dim_num, j - 1] * p2
  
      #  RECIPD is 1/(common denominator of the elements in V).
      self.recipd = 1.0 / (2 * p2)
      self.lastq = np.zeros(dim_num)
  
file_path: scikit-optimize/skopt/sampler/sobol.py
imports: from __future__ import division
  import warnings
  import numpy
  from .base import InitialPointGenerator
  from ..space import Space
  from sklearn.utils import check_random_state
label_desc: Use image node_id 2 for calling the Sobol obj's underlying member method code with example usage: obj.init(dim_num) without return types