<SYSTEM_TASK:>
Solve the following problem using Python, implementing the functions described below, one line at a time
<END_TASK>
<USER_TASK:>
Description:
 def get_num_primal_variables(self):
 """ Gets number of primal variables. Returns ------- num : int """


        if self.x is not None:
            return self.x.size
        if self.gphi is not None:
            return self.gphi.size
        if self.Hphi is not None:
            return self.Hphi.shape[0]
        if self.A is not None:
            return self.A.shape[1]
        if self.J is not None:
            return self.J.shape[1]
        if self.u is not None:
            return self.u.size
        if self.l is not None:
            return self.l.size
        return 0