Back to home page

Project CMSSW displayed by LXR

 
 

    


File indexing completed on 2024-04-06 12:28:19

0001 #ifndef RecoTracker_MkFitCore_src_Matrix_h
0002 #define RecoTracker_MkFitCore_src_Matrix_h
0003 
0004 #include "RecoTracker/MkFitCore/interface/Config.h"
0005 #include "RecoTracker/MkFitCore/interface/MatrixSTypes.h"
0006 
0007 namespace mkfit {
0008 
0009   inline float hipo(float x, float y) { return std::sqrt(x * x + y * y); }
0010 
0011   inline float hipo_sqr(float x, float y) { return x * x + y * y; }
0012 
0013   inline void sincos4(const float x, float& sin, float& cos) {
0014     // Had this writen with explicit division by factorial.
0015     // The *whole* fitting test ran like 2.5% slower on MIC, sigh.
0016 
0017     const float x2 = x * x;
0018     cos = 1.f - 0.5f * x2 + 0.04166667f * x2 * x2;
0019     sin = x - 0.16666667f * x * x2;
0020   }
0021 }  // end namespace mkfit
0022 
0023 //==============================================================================
0024 
0025 // Matriplex dimensions and typedefs
0026 
0027 #include "Matriplex/MatriplexSym.h"
0028 
0029 #ifndef MPT_SIZE
0030 #if defined(__AVX512F__)
0031 #define MPT_SIZE 16
0032 #elif defined(__AVX__) || defined(__AVX2__)
0033 #define MPT_SIZE 8
0034 #elif defined(__SSE3__)
0035 #define MPT_SIZE 4
0036 #else
0037 #define MPT_SIZE 8
0038 #endif
0039 #endif
0040 
0041 namespace mkfit {
0042 
0043   constexpr Matriplex::idx_t NN = MPT_SIZE;  // "Length" of MPlex.
0044 
0045   constexpr Matriplex::idx_t LL = 6;  // Dimension of large/long  MPlex entities
0046   constexpr Matriplex::idx_t HH = 3;  // Dimension of small/short MPlex entities
0047 
0048   typedef Matriplex::Matriplex<float, LL, LL, NN> MPlexLL;
0049   typedef Matriplex::Matriplex<float, LL, 1, NN> MPlexLV;
0050   typedef Matriplex::MatriplexSym<float, LL, NN> MPlexLS;
0051 
0052   typedef Matriplex::Matriplex<float, HH, HH, NN> MPlexHH;
0053   typedef Matriplex::Matriplex<float, HH, 1, NN> MPlexHV;
0054   typedef Matriplex::MatriplexSym<float, HH, NN> MPlexHS;
0055 
0056   typedef Matriplex::Matriplex<float, 5, 5, NN> MPlex55;
0057   typedef Matriplex::Matriplex<float, 5, 6, NN> MPlex56;
0058   typedef Matriplex::Matriplex<float, 6, 5, NN> MPlex65;
0059 
0060   typedef Matriplex::Matriplex<float, 2, 2, NN> MPlex22;
0061   typedef Matriplex::Matriplex<float, 2, 1, NN> MPlex2V;
0062   typedef Matriplex::MatriplexSym<float, 2, NN> MPlex2S;
0063 
0064   typedef Matriplex::Matriplex<float, LL, HH, NN> MPlexLH;
0065   typedef Matriplex::Matriplex<float, HH, LL, NN> MPlexHL;
0066 
0067   typedef Matriplex::Matriplex<float, LL, 2, NN> MPlexL2;
0068   typedef Matriplex::Matriplex<float, HH, 2, NN> MPlexH2;
0069   typedef Matriplex::Matriplex<float, 2, HH, NN> MPlex2H;
0070 
0071   typedef Matriplex::Matriplex<float, 1, 1, NN> MPlexQF;
0072   typedef Matriplex::Matriplex<int, 1, 1, NN> MPlexQI;
0073   typedef Matriplex::Matriplex<unsigned int, 1, 1, NN> MPlexQUI;
0074   typedef Matriplex::Matriplex<short, 1, 1, NN> MPlexQH;
0075   typedef Matriplex::Matriplex<unsigned short, 1, 1, NN> MPlexQUH;
0076 
0077   typedef Matriplex::Matriplex<bool, 1, 1, NN> MPlexQB;
0078 
0079 }  // end namespace mkfit
0080 
0081 #endif