Extend StepFunction for lea
add debug function: clean cache
enhance phi_i_j_hat_s_gen
enhance phi.i.j.hat.s.gen and psi_i.hat
correct kappa_i.j.gen