def test_ls_applyJ(self):

        top = self.top
        top.run() 

        ins = ['ls.A', 'ls.b', 'ls.x']
        ins = ['ls.x',]
        outs = ['ls.R',]

        top.ls.eval_only = True #needed to check residual derivatives
        
        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-5)
        self.assertTrue(np.linalg.norm((J_adjoint- J_cs)) < 1e-5)
dataset/ETHPy150Open OpenMDAO/OpenMDAO-Framework/openmdao.lib/src/openmdao/lib/components/test/test_linear_system.py/LinearSystemTestCase.test_ls_applyJ/original