Functions | |
std::pair< float, float > | atan2r (float y_, float x_, bool overR=false) |
std::pair< double, double > | atan2r (double y_, double x_, bool overR=false) |
template<typename T > | |
std::pair< T, T > | etaphi (T x, T y, T z) |
float | invSqrt (float in) |
double | invSqrt (double in) |
std::pair<float,float> fastmath::atan2r | ( | float | y_, |
float | x_, | ||
bool | overR = false |
||
) | [inline] |
Definition at line 40 of file FastMath.h.
References fastmath_details::_2pif, fastmath_details::atanbuf_, f, flags, i, invSqrt(), mag2(), x, and detailsBasic3DVector::y.
Referenced by etaphi().
{ using namespace fastmath_details; float mag2 = x_ * x_ + y_ * y_; if(!(mag2 > 0)) { return std::pair<float,float>(0.f,0.f); } // degenerate case // float r_ = std::sqrt(mag2); float rinv = invSqrt(mag2); unsigned int flags = 0; float x, y; union { float f; int i; } yp; yp.f = 32768.f; if (y_ < 0 ) { flags |= 4; y_ = -y_; } if (x_ < 0 ) { flags |= 2; x_ = -x_; } if (y_ > x_) { flags |= 1; x = rinv * y_; y = rinv * x_; yp.f += y; } else { x = rinv * x_; y = rinv * y_; yp.f += y; } int ind = (yp.i & 0x01FF) * 2; float* asbuf = (float*)(atanbuf_ + ind); float sv = yp.f - 32768.f; float cv = asbuf[0]; float asv = asbuf[1]; sv = y * cv - x * sv; // delta sin value // ____ compute arcsin directly float asvd = 6.f + sv * sv; sv *= float(1.0f / 6.0f); float th = asv + asvd * sv; if (flags & 1) { th = (_2pif / 4.f) - th; } if (flags & 2) { th = (_2pif / 2.f) - th; } if (flags & 4) { th = -th; } return std::pair<float,float>(th,overR ? rinv : rinv*mag2); }
std::pair<double, double> fastmath::atan2r | ( | double | y_, |
double | x_, | ||
bool | overR = false |
||
) | [inline] |
Definition at line 82 of file FastMath.h.
References fastmath_details::_2pi, fastmath_details::datanbuf_, flags, i, mag2(), mathSSE::sqrt(), x, and detailsBasic3DVector::y.
{ using namespace fastmath_details; // assert(ataninited); double mag2 = x_ * x_ + y_ * y_; if(!(mag2 > 0)) { return std::pair<double, double>(0.,0.); } // degenerate case double r_ = std::sqrt(mag2); double rinv = 1./r_; unsigned int flags = 0; double x, y; const double _2p43 = 65536.0 * 65536.0 * 2048.0; union { double d; int i[2]; } yp; yp.d = _2p43; if (y_ < 0) { flags |= 4; y_ = -y_; } if (x_ < 0) { flags |= 2; x_ = -x_; } if (y_ > x_) { flags |= 1; x = rinv * y_; y = rinv * x_; yp.d += y; } else { x = rinv * x_; y = rinv * y_; yp.d += y; } int ind = (yp.i[0] & 0x03FF) * 2; // 0 for little indian double* dasbuf = (double*)(datanbuf_ + ind); double sv = yp.d - _2p43; // index fraction double cv = dasbuf[0]; double asv = dasbuf[1]; sv = y * cv - x * sv; // delta sin value // double sv = y *(cv-x); // ____ compute arcsin directly double asvd = 6 + sv * sv; sv *= double(1.0 / 6.0); double th = asv + asvd * sv; if (flags & 1) { th = (_2pi / 4) - th; } if (flags & 2) { th = (_2pi / 2) - th; } if (flags & 4) { th = -th; } return std::pair<double,double>(th,overR ? rinv : r_); }
Definition at line 128 of file FastMath.h.
References atan2r(), create_public_lumi_plots::log, and mathSSE::sqrt().
Referenced by L1TdeGCT::analyze(), L1TDEMON::analyze(), L1TdeGCT::beginJob(), L1TDEMON::beginJob(), FastL1GlobalAlgo::FillL1RegionsTP(), FastL1GlobalAlgo::FillMET(), and spr::getEtaPhi().
float fastmath::invSqrt | ( | float | in | ) | [inline] |
Definition at line 11 of file FastMath.h.
References dbtoconf::out, and mathSSE::sqrt().
Referenced by atan2r().
double fastmath::invSqrt | ( | double | in | ) | [inline] |