def _run1(self):
if self.check_update_J():<EOL><INDENT>self.update_J()<EOL><DEDENT>else:<EOL><INDENT>if self.check_Broyden_J():<EOL><INDENT>self.update_Broyden_J()<EOL><DEDENT>if self.check_update_eig_J():<EOL><INDENT>self.update_eig_J()<EOL><DEDENT><DEDENT>delta_vals = self.find_LM_updates(self.calc_grad())<EOL>er1 = self.update_function(self.param_vals + delta_vals)<EOL>good_step = (find_best_step([self.error, er1]) == <NUM_LIT:1>)<EOL>if not good_step:<EOL><INDENT>er0 = self.update_function(self.param_vals)<EOL>if np.abs(er0 -self.error)/er0 > <NUM_LIT>:<EOL><INDENT>raise RuntimeError('<STR_LIT>')<EOL><DEDENT>CLOG.debug('<STR_LIT>')<EOL>CLOG.debug('<STR_LIT>' % (self.error, er1))<EOL>grad = self.calc_grad()<EOL>for _try in range(self._max_inner_loop):<EOL><INDENT>self.increase_damping()<EOL>delta_vals = self.find_LM_updates(grad)<EOL>er1 = self.update_function(self.param_vals + delta_vals)<EOL>good_step = (find_best_step([self.error, er1]) == <NUM_LIT:1>)<EOL>if good_step:<EOL><INDENT>break<EOL><DEDENT><DEDENT>else:<EOL><INDENT>er0 = self.update_function(self.param_vals)<EOL>CLOG.warn('<STR_LIT>')<EOL>if np.abs(er0 -self.error)/er0 > <NUM_LIT>:<EOL><INDENT>raise RuntimeError('<STR_LIT>')<EOL><DEDENT><DEDENT><DEDENT>if good_step:<EOL><INDENT>self._last_error = self.error<EOL>self.error = er1<EOL>CLOG.debug('<STR_LIT>' % (self._last_error, self.error))<EOL>self.update_param_vals(delta_vals, incremental=True)<EOL>self.decrease_damping()<EOL><DEDENT>
workhorse for do_run_1