def complex_step_jacobian(self, params, unknowns, resids, total_derivs=False,
                              fd_params=None, fd_states=None, fd_unknowns=None,
                              poi_indices=None, qoi_indices=None):
        """ Return derivatives of all unknowns in this system w.r.t. all
        incoming params using complex step.

        Args
        ----
        params : `VecWrapper`
            `VecWrapper` containing parameters. (p)

        unknowns : `VecWrapper`
            `VecWrapper` containing outputs and states. (u)

        resids : `VecWrapper`
            `VecWrapper` containing residuals. (r)

        total_derivs : bool, optional
            Should always be False, as componentwise derivatives only need partials.

        fd_params : list of strings, optional
            List of parameter name strings with respect to which derivatives
            are desired. This is used by problem to limit the derivatives that
            are taken.

        fd_unknowns : list of strings, optional
            List of output or state name strings for derivatives to be
            calculated. This is used by problem to limit the derivatives that
            are taken.

        fd_states : list of strings, optional
            List of state name strings for derivatives to be taken with respect to.
            This is used by problem to limit the derivatives that are taken.

        poi_indices: dict of list of integers, optional
            Should be an empty list, as there is no subcomponent relevance reduction.

        qoi_indices: dict of list of integers, optional
            Should be an empty list, as there is no subcomponent relevance reduction.

        Returns
        -------
        dict
            Dictionary whose keys are tuples of the form ('unknown', 'param')
            and whose values are ndarrays containing the derivative for that
            tuple pair.
        """

        # Params and Unknowns that we provide at this level.
        if fd_params is None:
            fd_params = self._get_fd_params()
        if fd_unknowns is None:
            fd_unknowns = self._get_fd_unknowns()

        # Use settings in the system dict unless variables override.
        step_size = self.fd_options.get('step_size', 1.0e-6)

        jac = {}
        csparams = ComplexStepTgtVecWrapper(params)
        csunknowns = ComplexStepSrcVecWrapper(unknowns)
        csresids = ComplexStepSrcVecWrapper(resids)

        # Pull result from resids only if comp overrides apply_nonlinear
        states = self.states
        if len(states) > 0:
            resultvec = csresids
        else:
            resultvec = csunknowns

        # Manual override of states.
        if fd_states is not None:
            states = fd_states

        # Compute gradient for this param or state.
        for p_name in chain(fd_params, states):


            # States are stepped in unknowns, not params
            if states in p_name:
                stepvec = csunknowns
                target_input = unknowns._dat[p_name].val
            else:
                stepvec = csparams
                target_input = params._dat[p_name].val

            stepvec.set_complex_var(p_name)

            # promoted names and _init_params_dict keys are same
            mydict = self._init_params_dict.get(p_name, {})

            # Local settings for this var trump all
            fdstep = mydict.get('step_size', step_size)

            # Size our Inputs
            p_size = np.size(target_input)
            p_idxs = range(p_size)

            # Size our Outputs
            for u_name in fd_unknowns:
                u_size = np.size(unknowns[u_name])
                jac[u_name, p_name] = np.zeros((u_size, p_size))

            # apply Complex Step on each index in array
            for j, idx in enumerate(p_idxs):

                stepvec.step_complex(idx, fdstep)
                self.apply_nonlinear(csparams, csunknowns, csresids)

                stepvec.step_complex(idx, -fdstep)

                for u_name in fd_unknowns:
                    result = resultvec.flat(u_name)
                    jac[u_name, p_name][:, j] = result.imag/fdstep

            # Need to clear this out because our next input might be a
            # different vector (state vs param)
            stepvec.set_complex_var(None)

        return jac
dataset/ETHPy150Open OpenMDAO/OpenMDAO/openmdao/core/component.py/Component.complex_step_jacobian/swapped operands of `in`