docstr: Solve CVXPY problem
  
  Solve a CVXPY problem instance for a given design matrix and a given set
  of observations, and return the optimum.
  
  Parameters
  ----------
  design_matrix : array (n, m)
      Design matrix.
  measurements : array (n)
      Measurements.
  check : boolean (optional)
      If True check whether the unconstrained optimization solution
      already satisfies the constraints, before running the constrained
      optimization. This adds overhead, but can avoid unnecessary
      constrained optimization calls.
      Default: False
  kwargs : keyword arguments
      Arguments passed to the CVXPY solve method.
  
  Returns
  -------
  h : array (m)
       Estimated optimum for problem variables $h$.
docstr_tok: ["Solve","CVXPY","problem","Solve","a","CVXPY","problem","instance","for","a","given","design","matrix","and","a","given","set","of","observations",",","and","return","the","optimum",".","Parameters","--","--","--","--","--","design_matrix",":","array","(","n",",","m",")","Design","matrix",".","measurements",":","array","(","n",")","Measurements",".","check",":","boolean","(","optional",")","If","True","check","whether","the","unconstrained","optimization","solution","already","satisfies","the","constraints",",","before","running","the","constrained","optimization",".","This","adds","overhead",",","but","can","avoid","unnecessary","constrained","optimization","calls",".","Default",":","False","kwargs",":","keyword","arguments","Arguments","passed","to","the","CVXPY","solve","method",".","Returns","--","--","--","-","h",":","array","(","m",")","Estimated","optimum","for","problem","variables","$","h","$","."]
code: def solve(self, design_matrix, measurements, check=False, **kwargs):
      r"""Solve CVXPY problem
  
      Solve a CVXPY problem instance for a given design matrix and a given set
      of observations, and return the optimum.
  
      Parameters
      ----------
      design_matrix : array (n, m)
          Design matrix.
      measurements : array (n)
          Measurements.
      check : boolean (optional)
          If True check whether the unconstrained optimization solution
          already satisfies the constraints, before running the constrained
          optimization. This adds overhead, but can avoid unnecessary
          constrained optimization calls.
          Default: False
      kwargs : keyword arguments
          Arguments passed to the CVXPY solve method.
  
      Returns
      -------
      h : array (m)
           Estimated optimum for problem variables $h$.
      """
  
      # Compute and set reduced problem parameters
      try:
          X = np.linalg.cholesky(
              np.dot(design_matrix.T, design_matrix)
          ).T
      except np.linalg.linalg.LinAlgError:
          msg = "Cholesky decomposition failed, returning zero array. Verify "
          msg += "that the data is sufficient to estimate the model "
          msg += "parameters, and that the design matrix has full rank."
          warnings.warn(msg)
          return self._zeros
      self._X.value = X
      self._y.value = np.linalg.multi_dot(
          [X, np.linalg.pinv(design_matrix), measurements]
      )
  
      try:
          # Check unconstrained solution
          if check:
              # Solve unconstrained problem
              self.unconstrained_problem.solve(**kwargs)
  
              # Return zeros if optimization failed
              status = self.unconstrained_problem.status
              if status != "optimal":
                  msg = (
                      "Solver failed to produce an optimum: %s."
                      % status
                  )
                  warnings.warn(msg)
                  msg = "Optimization failed, returning zero array."
                  warnings.warn(msg)
                  return self._zeros
  
              # Return unconstrained solution if satisfactory
              self._f.value = self._h.value
              self.feasibility_problem.solve(**kwargs)
              if self.feasibility_problem.status == "optimal":
                  return np.asarray(self._h.value).squeeze()
  
          # Solve constrained problem
          self.problem.solve(**kwargs)
  
          # Show warning if solution is not optimal
          status = self.problem.status
          if status != "optimal":
              msg = "Solver failed to produce an optimum: %s." % status
              warnings.warn(msg)
  
          # Return solution
          return np.asarray(self._h.value).squeeze()
  
      except cvxpy.error.SolverError:
          # Return zeros
          msg = "Optimization failed, returning zero array."
          warnings.warn(msg)
          return self._zeros
  
imports: import abc
  import warnings
  import numpy
  import scipy.sparse
  import scipy.optimize
  from scipy.optimize import minimize
  from dipy.utils.optpkg import optional_package
label_desc: Use image node_id 2 for calling the PositiveDefiniteLeastSquares obj's underlying member method code with example usage: obj.solve(design_matrix, measurements, check) and returns: np, self, self, self, np