def setup(self):
    for i in range(self.num_var):
        self.add_input(self._cycle_names['x'].format(i), shape=self.var_shape)
        self.add_output(self._cycle_names['y'].format(i), shape=self.var_shape)
    self.add_input(self._cycle_names['theta'], val=1.0)
    self.add_output(self._cycle_names['theta_out'], shape=(1,))
    pd_type = self.metadata['partial_type']
    if self.metadata['finite_difference']:
        if (self.metadata['jacobian_type'] == 'matvec'):
            raise unittest.SkipTest('not testing FD and matvec')
        if (pd_type != 'array'):
            raise unittest.SkipTest('only dense FD supported')
        self.declare_partials('*', '*', method='fd')
    elif ((self.metadata['jacobian_type'] != 'matvec') and (pd_type != 'array')):
        num_var = self.num_var
        var_shape = self.var_shape
        var_size = np.prod(var_shape)
        A = np.ones((self.size, self.size))
        dA_x = np.ones((self.size, 1))
        dtheta = np.array([[1.0]])
        angle_param = self._cycle_names[self.angle_param]
        for out_idx in range(num_var):
            out_var = self._cycle_names['y'].format(out_idx)
            for in_idx in range(num_var):
                in_var = self._cycle_names['x'].format(in_idx)
                Aij = A[(array_idx(out_idx, var_size), array_idx(in_idx, var_size))]
                self.declare_partials(out_var, in_var, **self._array2kwargs(Aij, pd_type))
                self.declare_partials(out_var, angle_param, **self._array2kwargs(dA_x[array_idx(out_idx, var_size)], pd_type))
        self.declare_partials(self._cycle_names['theta_out'], self._cycle_names['theta'], **self._array2kwargs(dtheta, pd_type))
    else:
        self.declare_partials(of='*', wrt='*')
def setup(self):
    for i in range(self.num_var):
        self.add_input(self._cycle_names['x'].format(i), shape=self.var_shape)
        self.add_output(self._cycle_names['y'].format(i), shape=self.var_shape)
    self.add_input(self._cycle_names['theta'], val=1.0)
    self.add_output(self._cycle_names['theta_out'], shape=(1,))
    pd_type = self.metadata['partial_type']
    if self.metadata['finite_difference']:
        if (self.metadata['jacobian_type'] == 'matvec'):
            raise unittest.SkipTest('not testing FD and matvec')
        if (pd_type != 'array'):
            raise unittest.SkipTest('only dense FD supported')
        self.declare_partials('*', '*', method='fd')
    elif ((self.metadata['jacobian_type'] != 'matvec') and (pd_type != 'array')):
        num_var = self.num_var
        var_shape = self.var_shape
        var_size = np.prod(var_shape)
        A = np.ones((self.size, self.size))
        dA_x = np.ones((self.size, 1))
        dtheta = np.array([[1.0]])
        angle_param = self._cycle_names[self.angle_param]
        for out_idx in range(num_var):
            out_var = self._cycle_names['y'].format(out_idx)
            for in_idx in range(num_var):
                in_var = self._cycle_names['x'].format(in_idx)
                Aij = A[(array_idx(out_idx, var_size), array_idx(in_idx, var_size))]
                self.declare_partials(out_var, in_var, **self._array2kwargs(Aij, pd_type))
                self.declare_partials(out_var, angle_param, **self._array2kwargs(dA_x[array_idx(out_idx, var_size)], pd_type))
        self.declare_partials(self._cycle_names['theta_out'], self._cycle_names['theta'], **self._array2kwargs(dtheta, pd_type))
    else:
        self.declare_partials(of='*', wrt='*')