changing impl of sqr_abs to improve performances + making some functors generic + adding tests