

def test_ls_applyJ(self):
    top = self.top
    top.run()
    ins = ['ls.A', 'ls.b', 'ls.x']
    ins = ['ls.x']
    outs = ['ls.R']
    J_forward.ls.eval_only = True
    J_forward = top.driver.calc_gradient(ins, outs, mode='forward')
    J_adjoint = top.driver.calc_gradient(ins, outs, mode='adjoint')
    top.driver.gradient_options.fd_form = 'complex_step'
    top.driver.gradient_options.fd_step = 1e-20
    J_cs = top.driver.calc_gradient(ins, outs, mode='fd')
    self.assertTrue((np.linalg.norm((J_forward - J_cs)) < 1e-05))
    self.assertTrue((np.linalg.norm((J_adjoint - J_cs)) < 1e-05))

dataset/ETHPy150Open OpenMDAO/OpenMDAO-Framework/openmdao.lib/src/openmdao/lib/components/test/test_linear_system.py LinearSystemTestCase.test_ls_applyJ/VarMisuse@44/68 `top`->`J_forward`