File indexing completed on 2025-08-05 08:18:28
0001
0002
0003
0004
0005
0006
0007
0008
0009
0010
0011
0012
0013
0014
0015
0016
0017
0018
0019
0020
0021
0022
0023
0024 #ifndef genfit_RKTools_h
0025 #define genfit_RKTools_h
0026
0027 #include <stddef.h>
0028 #include <algorithm>
0029 #include <initializer_list>
0030
0031 namespace genfit {
0032
0033 template <size_t nRows, size_t nCols>
0034 struct RKMatrix {
0035 double vals[nRows * nCols];
0036
0037 RKMatrix() = default;
0038 RKMatrix(const RKMatrix&) = default;
0039 RKMatrix(std::initializer_list<double> initList) {
0040 std::copy(initList.begin(), initList.end(), vals);
0041 };
0042
0043 double& operator()(size_t iRow, size_t iCol) {
0044 return vals[nCols*iRow + iCol];
0045 }
0046 double& operator[](size_t n) {
0047 return vals[n];
0048 }
0049 const double& operator[](size_t n) const {
0050 return vals[n];
0051 }
0052
0053 double* begin() { return vals; }
0054 double* end() { return vals + nRows * nCols; }
0055 const double* begin() const { return vals; }
0056 const double* end() const { return vals + nRows * nCols; }
0057
0058 RKMatrix<nRows, nCols>& operator=(const RKMatrix<nRows, nCols>& o) {
0059 std::copy(o.begin(), o.end(), this->begin());
0060 return *this;
0061 }
0062
0063 void print();
0064 };
0065
0066 typedef RKMatrix<1, 3> M1x3;
0067 typedef RKMatrix<1, 4> M1x4;
0068 typedef RKMatrix<1, 7> M1x7;
0069 typedef RKMatrix<5, 5> M5x5;
0070 typedef RKMatrix<6, 6> M6x6;
0071 typedef RKMatrix<7, 7> M7x7;
0072 typedef RKMatrix<6, 5> M6x5;
0073 typedef RKMatrix<7, 5> M7x5;
0074 typedef RKMatrix<5, 6> M5x6;
0075 typedef RKMatrix<5, 7> M5x7;
0076
0077
0078
0079
0080 namespace RKTools {
0081
0082 void J_pMTxcov5xJ_pM(const M5x7& J_pM, const M5x5& cov5, M7x7& out7);
0083 void J_pMTxcov5xJ_pM(const M5x6& J_pM, const M5x5& cov5, M6x6& out6);
0084
0085 void J_MpTxcov7xJ_Mp(const M7x5& J_Mp, const M7x7& cov7, M5x5& out5);
0086 void J_MpTxcov6xJ_Mp(const M6x5& J_Mp, const M6x6& cov6, M5x5& out5);
0087
0088 void J_pMTTxJ_MMTTxJ_MpTT(const M7x5& J_pMT, const M7x7& J_MMT, const M5x7& J_MpT, M5x5& J_pp);
0089
0090 void Np_N_NpT(const M7x7& Np, M7x7& N);
0091
0092 void printDim(const double* mat, unsigned int dimX, unsigned int dimY);
0093
0094 }
0095
0096 template<size_t nRows, size_t nCols>
0097 inline void
0098 RKMatrix<nRows, nCols>::print() {
0099 RKTools::printDim(this->vals, nRows, nCols);
0100 }
0101
0102 }
0103
0104
0105 #endif
0106