docs: def create_problem_from_type_A(problem):
      """
      Creates OptProblem from type-A problem.
  
      Parameters
      ----------
      problem : Object
      """
      
      p = OptProblem()
      
      nx = problem.get_num_primal_variables()
      nz = problem.G.shape[0]
  
      p.phi = problem.phi
      p.gphi = np.hstack((problem.gphi,np.zeros(nz)))
      p.Hphi = coo_matrix((problem.Hphi.data,(problem.Hphi.row,problem.Hphi.col)),shape=(nx+nz,nx+nz))    
      p.A = bmat([[problem.A,None],[problem.G,-eye(nz)]],format='coo')
      p.b = np.hstack((problem.b,np.zeros(nz)))
      p.f = problem.f
      p.J = coo_matrix((problem.J.data,(problem.J.row,problem.J.col)),shape=(problem.J.shape[0],nx+nz))
      p.H_combined = coo_matrix((problem.H_combined.data,(problem.H_combined.row,problem.H_combined.col)),shape=(nx+nz,nx+nz))
      p.u = np.hstack((problem.get_upper_limits(),problem.u))                
      p.l = np.hstack((problem.get_lower_limits(),problem.l))
      p.x = np.hstack((problem.x,np.zeros(nz)))
  
      p.P = None
      p.lam = None
      p.nu = None
      p.mu = None
      p.pi = None
      
      p.wrapped_problem = problem
  
      def eval(cls,xz):
          x = xz[:nx]
          z = xz[nx:]
          prob = cls.wrapped_problem
          prob.eval(x)
          cls.phi = prob.phi
          cls.gphi = np.hstack((prob.gphi,np.zeros(nz)))
          cls.Hphi = coo_matrix((prob.Hphi.data,(prob.Hphi.row,prob.Hphi.col)),shape=(nx+nz,nx+nz))
          cls.f = prob.f
          cls.J = coo_matrix((prob.J.data,(prob.J.row,prob.J.col)),shape=(prob.J.shape[0],nx+nz))
  
      def combine_H(cls,coeff,ensure_psd=False):
          prob = cls.wrapped_problem
          prob.combine_H(coeff,ensure_psd=ensure_psd)
          cls.H_combined = coo_matrix((prob.H_combined.data,(prob.H_combined.row,prob.H_combined.col)),shape=(nx+nz,nx+nz))
              
      def recover_primal_variables(cls,x):
          return x[:nx]
      
      def recover_dual_variables(cls,lam,nu,mu,pi):
          prob = cls.wrapped_problem
          return lam[:prob.A.shape[0]],nu,mu[nx:],pi[nx:]
                  
      p.eval = MethodType(eval,p)
      p.combine_H = MethodType(combine_H,p)
      p.recover_primal_variables = MethodType(recover_primal_variables,p)
      p.recover_dual_variables = MethodType(recover_dual_variables,p)
  
      # Return
      return p