def _assemble_deriv_data(params, resids, cdata, jac_fwd, jac_rev, jac_fd,
                         out_stream, c_name='root', jac_fd2=None, fd_desc=None,
                         fd_desc2=None, compact_print=False):
    """ Assembles dictionaries and prints output for check derivatives
    functions. This is used by both the partial and total derivative
    checks.
    """
    started = False

    for p_name in params:
        for u_name in resids:

            key = (u_name, p_name)

            # Ignore non-differentiables
            if key not in jac_fd:
                continue

            ldata = cdata[key] = {}

            Jsub_fd = jac_fd[key]
            ldata['J_fd'] = Jsub_fd
            magfd = np.linalg.norm(Jsub_fd)

            if jac_fwd:
                Jsub_for = jac_fwd[key]
                ldata['J_fwd'] = Jsub_for
                magfor = np.linalg.norm(Jsub_for)
            else:
                magfor = None

            if jac_rev:
                Jsub_rev = jac_rev[key]
                ldata['J_rev'] = Jsub_rev
                magrev = np.linalg.norm(Jsub_rev)
            else:
                magrev = None

            if jac_fd2:
                Jsub_fd2 = jac_fd2[key]
                ldata['J_fd2'] = Jsub_fd2
                magfd2 = np.linalg.norm(Jsub_fd2)
            else:
                magfd2 = None

            ldata['magnitude'] = (magfor, magrev, magfd)

            if jac_fwd:
                abs1 = np.linalg.norm(Jsub_for - Jsub_fd)
            else:
                abs1 = None
            if jac_rev:
                abs2 = np.linalg.norm(Jsub_rev - Jsub_fd)
            else:
                abs2 = None

            if jac_fwd and jac_rev:
                abs3 = np.linalg.norm(Jsub_for - Jsub_rev)
            else:
                abs3 = None

            if jac_fd2:
                abs4 = np.linalg.norm(Jsub_fd2 - Jsub_fd)
            else:
                abs4 = None

            ldata['abs error'] = (abs1, abs2, abs3)

            if magfd == 0.0:
                rel1 = rel2 = rel3 = rel4 = float('nan')
            else:
                if jac_fwd:
                    rel1 = np.linalg.norm(Jsub_for - Jsub_fd)/magfd
                else:
                    rel1 = None

                if jac_rev:
                    rel2 = np.linalg.norm(Jsub_rev - Jsub_fd)/magfd
                else:
                    rel2 = None

                if jac_fwd and jac_rev:
                    rel3 = np.linalg.norm(Jsub_for - Jsub_rev)/magfd
                else:
                    rel3 = None

                if jac_fd2:
                    rel4 = np.linalg.norm(Jsub_fd2 - Jsub_fd)/magfd
                else:
                    rel4 = None

            ldata['rel error'] = (rel1, rel2, rel3)

            if out_stream is None:
                continue

            if compact_print:
                if jac_fwd and jac_rev:
                    if not started:
                        tmp1 = "{0} wrt {1} | {2} | {3} |  {4} | {5} | {6} | {7} | {8}\n"
                        out_str = tmp1.format(_pad_name('<unknown>'), _pad_name('<param>'),
                                              _pad_name('fwd mag.', 10, quotes=False),
                                              _pad_name('rev mag.', 10, quotes=False),
                                              _pad_name('fd mag.', 10, quotes=False),
                                              _pad_name('a(fwd-fd)', 10, quotes=False),
                                              _pad_name('a(rev-fd)', 10, quotes=False),
                                              _pad_name('r(fwd-rev)', 10, quotes=False),
                                              _pad_name('r(rev-fd)', 10, quotes=False)
                        )
                        out_stream.write(out_str)
                        out_stream.write('-'*len(out_str)+'\n')
                        started=True

                    tmp1 = "{0} wrt {1} | {2:.4e} | {3:.4e} |  {4:.4e} | {5:.4e} | {6:.4e} | {7:.4e} | {8:.4e}\n"
                    out_stream.write(tmp1.format(_pad_name(u_name), _pad_name(p_name),
                                                 magfor, magrev, magfd, abs1, abs2,
                                                 rel1, rel2))

                elif jac_fd and jac_fd2:
                    if not started:
                        tmp1 = "{0} wrt {1} | {2} | {3} | {4} | {5}\n"
                        out_str = tmp1.format(_pad_name('<unknown>'), _pad_name('<param>'),
                                              _pad_name('fd1 mag.', 13, quotes=False),
                                              _pad_name('fd2 mag.', 12, quotes=False),
                                              _pad_name('ab(fd2 - fd1)', 12, quotes=False),
                                              _pad_name('rel(fd2 - fd1)', 12, quotes=False)
                        )
                        out_stream.write(out_str)
                        out_stream.write('-'*len(out_str)+'\n')
                        started=True

                    tmp1 = "{0} wrt {1} | {2: .6e} | {3:.6e} | {4: .6e} | {5: .6e}\n"
                    out_stream.write(tmp1.format(_pad_name(u_name), _pad_name(p_name),
                                                 magfd, magfd2, abs4, rel4))
            else:

                if started:
                    out_stream.write(' -'*30 + '\n')
                else:
                    started = True

                # Optional file_like output
                out_stream.write((c_name, u_name, p_name) % "  %s: '%s' wrt '%s'\n\n")

                if jac_fwd:
                    out_stream.write('    Forward Magnitude : %.6e\n' % magfor)
                if jac_rev:
                    out_stream.write('    Reverse Magnitude : %.6e\n' % magrev)
                if not jac_fwd and not jac_rev:
                    out_stream.write('    Fwd/Rev Magnitude : Component supplies no analytic derivatives.\n')
                if jac_fd:
                    out_stream.write('         Fd Magnitude : %.6e' % magfd)
                    if fd_desc:
                        out_stream.write(' (%s)' % fd_desc)
                    out_stream.write('\n')
                if jac_fd2:
                    out_stream.write('        Fd2 Magnitude : %.6e' % magfd2)
                    if fd_desc2:
                        out_stream.write(' (%s)' % fd_desc2)
                    out_stream.write('\n')
                out_stream.write('\n')

                if jac_fwd:
                    out_stream.write('    Absolute Error (Jfor - Jfd) : %.6e\n' % abs1)
                if jac_rev:
                    out_stream.write('    Absolute Error (Jrev - Jfd) : %.6e\n' % abs2)
                if jac_fwd and jac_rev:
                    out_stream.write('    Absolute Error (Jfor - Jrev): %.6e\n' % abs3)
                if jac_fd2:
                    out_stream.write('    Absolute Error (Jfd2 - Jfd): %.6e\n' % abs4)
                out_stream.write('\n')

                if jac_fwd:
                    out_stream.write('    Relative Error (Jfor - Jfd) : %.6e\n' % rel1)
                if jac_rev:
                    out_stream.write('    Relative Error (Jrev - Jfd) : %.6e\n' % rel2)
                if jac_fwd and jac_rev:
                    out_stream.write('    Relative Error (Jfor - Jrev): %.6e\n' % rel3)
                if jac_fd2:
                    out_stream.write('    Relative Error (Jfd2 - Jfd) : %.6e\n' % rel4)
                out_stream.write('\n')

                if jac_fwd:
                    out_stream.write('    Raw Forward Derivative (Jfor)\n\n')
                    out_stream.write(str(Jsub_for))
                    out_stream.write('\n\n')
                if jac_rev:
                    out_stream.write('    Raw Reverse Derivative (Jrev)\n\n')
                    out_stream.write(str(Jsub_rev))
                    out_stream.write('\n\n')
                out_stream.write('    Raw FD Derivative (Jfd)\n\n')
                out_stream.write(str(Jsub_fd))
                out_stream.write('\n\n')
                if jac_fd2:
                    out_stream.write('    Raw FD Check Derivative (Jfd2)\n\n')
                    out_stream.write(str(Jsub_fd2))
                    out_stream.write('\n\n')
dataset/ETHPy150Open OpenMDAO/OpenMDAO/openmdao/core/problem.py/_assemble_deriv_data/swapped operands of `%`