def setup(self):
    super(ExplicitLastComp, self).setup()
    self.add_output('x_norm2', shape=(1,))
    self._n = 1
    pd_type = self.metadata['partial_type']
    if ((self.metadata['jacobian_type'] != 'matvec') and (pd_type != 'array')):
        x = np.ones(self.var_shape)
        for i in range(self.metadata['num_var']):
            in_var = self._cycle_names['x'].format(i)
            self.declare_partials('x_norm2', in_var, **self._array2kwargs(x.flatten(), pd_type))
        self.declare_partials(self._cycle_names['theta_out'], self._cycle_names['psi'], **self._array2kwargs(np.array([1.0]), pd_type))
def setup(self):
    super(ExplicitLastComp, self).setup()
    self.add_output('x_norm2', shape=(1,))
    self._n = 1
    pd_type = self.metadata['partial_type']
    if ((self.metadata['jacobian_type'] != 'matvec') and (pd_type != 'array')):
        x = np.ones(self.var_shape)
        for i in range(self.metadata['num_var']):
            in_var = self._cycle_names['x'].format(i)
            self.declare_partials('x_norm2', in_var, **self._array2kwargs(x.flatten(), pd_type))
        self.declare_partials(self._cycle_names['theta_out'], self._cycle_names['psi'], **self._array2kwargs(np.array([1.0]), pd_type))