ATLAS Offline Software
AlSpaMat.h
Go to the documentation of this file.
1 /*
2  Copyright (C) 2002-2024 CERN for the benefit of the ATLAS collaboration
3 */
4 
5 #ifndef TRKALGS_ALSPAMAT_H
6 #define TRKALGS_ALSPAMAT_H
7 
9 
10 #include <exception>
11 
12 class StatusCode;
13 template<class Element> class TMatrixTSparse;
14 typedef class TMatrixTSparse<double> TMatrixDSparse;
15 
16 namespace Trk {
17 
18 class AlVec;
19 class AlSymMat;
20 class AlSymMatBase;
26 class AlSpaMat : public AlSymMatBase {
29 
30  public:
31  AlSpaMat();
32  AlSpaMat(long int N);
33  AlSpaMat(const AlSpaMat& m);
34  AlSpaMat(const AlSymMat& m);
35  ~AlSpaMat();
36 
37  // OPERATORS:
38  AlSpaMat& operator=(const double&) ;
39  AlSpaMat& operator=(const AlSpaMat&);
40  AlSpaMat& operator=(const AlSymMat&);
41  AlSpaMat& operator=(const AlMat&);
42  AlSpaMat operator+(const AlSpaMat&) const;
43  AlSpaMat& operator+=(const AlSpaMat&);
44  AlSpaMat operator-(const AlSpaMat&) const;
45  AlSpaMat& operator-=(const AlSpaMat&);
46  AlMat operator*(const AlSymMatBase&) const;
47  AlVec operator*(const AlVec&) const;
48  AlMat operator*(const AlMat&) const;
49  AlSpaMat operator*(const double&) const;
50  AlSpaMat& operator*=(const double&);
51 
52  // ADVANCED:
53  int SolveWithEigen(AlVec& RHS);
54  virtual void RemoveModule( int) override final;
55  virtual void RemoveAlignPar(int, int) override final;
56  void RemoveDoF( int, int nelem=1);
57  virtual int RemoveCollsRows(std::vector<int>) override final;
58  virtual void reSize(long int) override final;
59  virtual void SetPathBin(const std::string&) override final;
60  virtual void SetPathTxt(const std::string&) override final;
61  virtual StatusCode Write(const std::string&, bool, bool, double, float) override final;
62  virtual StatusCode CheckMatVersion(const std::string&, bool&) override final;
63  virtual StatusCode Read(const std::string&, int&, bool&, float&) override final;
64  virtual StatusCode ReadProjected(const std::string&, int&, bool&, float&) override final;
65  virtual int invert() override final;
66  virtual int diagonalize(char jobz, AlVec& w, AlMat& z) override final;
67  virtual double& elemr(long int, long int) override final;
68  virtual double elemc(long int, long int) const override final;
69  inline long int nele();
70  virtual double determinant() override final;
71 
72  inline void elem(const indices&, long int&, long int&) const;
73  inline const std::string& pathBin() const;
74  inline const std::string& pathTxt() const;
75 
76  virtual TMatrixDSparse* makeTMatrix() override final;
77  protected:
78 
79  static indices elem(long int, long int) ;
80 
81  void copy(const AlSpaMat& m);
82  void copy(const AlSymMat& m);
83  void copy(const AlMat& m);
84 
85  std::string m_pathbin;
86  std::string m_pathtxt;
87 
88  int* m_ptr_row = nullptr;
89  int* m_ptr_col = nullptr;
90 };
91 
92 // inline methods:
93 
94 inline void AlSpaMat::elem(const indices& key, long int& i, long int& j) const {
95  i = key.first;
96  j = key.second;
97  if(j>i) throw std::out_of_range( "AlSpaMat::elem: i<j ! " );
98  return;
99 }
100 
101 inline long int AlSpaMat::nele() {
102  // first check for intrinsic consistency:
103  if( int(m_ptr_map.size()) != m_nele ) throw std::range_error( "AlSpaMat::m_nele has been corrupted!" );
104  m_nele = m_ptr_map.size();
105  return m_nele;
106 }
107 
108 inline const std::string& AlSpaMat::pathBin() const {
109  return m_pathbin;
110 }
111 
112 inline const std::string& AlSpaMat::pathTxt() const {
113  return m_pathtxt;
114 }
115 
116 
117 
118 } // end namespace Trk
119 
120 #endif // TRKALGS_ALSPAMAT_H
Trk::AlSpaMat::m_ptr_row
int * m_ptr_row
Definition: AlSpaMat.h:88
Trk::AlSpaMat::SetPathBin
virtual void SetPathBin(const std::string &) override final
Definition: AlSpaMat.cxx:649
Trk::AlSpaMat::ReadProjected
virtual StatusCode ReadProjected(const std::string &, int &, bool &, float &) override final
Definition: AlSpaMat.cxx:803
python.SystemOfUnits.m
int m
Definition: SystemOfUnits.py:91
Trk::AlSpaMat::RemoveCollsRows
virtual int RemoveCollsRows(std::vector< int >) override final
Definition: AlSpaMat.cxx:532
Trk::z
@ z
global position (cartesian)
Definition: ParamDefs.h:57
Trk::AlSpaMat::Write
virtual StatusCode Write(const std::string &, bool, bool, double, float) override final
Definition: AlSpaMat.cxx:663
Trk::AlSpaMat::elemr
virtual double & elemr(long int, long int) override final
Definition: AlSpaMat.cxx:136
Trk::indices
std::pair< long int, long int > indices
Definition: AlSymMatBase.h:24
Trk::AlSpaMat::copy
void copy(const AlSpaMat &m)
Definition: AlSpaMat.cxx:85
Trk::AlSymMatBase::m_ptr_map
datamap m_ptr_map
Definition: AlSymMatBase.h:101
Trk::AlSpaMat::operator*
AlMat operator*(const AlSymMatBase &) const
Definition: AlSpaMat.cxx:329
Trk::AlSpaMat::SolveWithEigen
int SolveWithEigen(AlVec &RHS)
Definition: AlSpaMat.cxx:408
Trk::AlSpaMat::elemc
virtual double elemc(long int, long int) const override final
Definition: AlSpaMat.cxx:172
Trk::AlSpaMat::determinant
virtual double determinant() override final
Definition: AlSpaMat.cxx:403
JetTiledMap::N
@ N
Definition: TiledEtaPhiMap.h:44
Trk::AlSpaMat::m_pathbin
std::string m_pathbin
Definition: AlSpaMat.h:85
Trk::AlSpaMat::pathTxt
const std::string & pathTxt() const
Definition: AlSpaMat.h:112
const
bool const RAWDATA *ch2 const
Definition: LArRodBlockPhysicsV0.cxx:560
Trk::AlSpaMat::CheckMatVersion
virtual StatusCode CheckMatVersion(const std::string &, bool &) override final
Definition: AlSpaMat.cxx:715
Trk::AlSpaMat::operator=
AlSpaMat & operator=(const double &)
Definition: AlSpaMat.cxx:257
protected
#define protected
Definition: DetDescrConditionsDict_dict_fixes.cxx:14
Trk::AlSpaMat::elem
void elem(const indices &, long int &, long int &) const
Definition: AlSpaMat.h:94
Trk::AlSymMatBase::AlSymMatBase
AlSymMatBase()
Definition: AlSymMatBase.cxx:20
TMatrixDSparse
class TMatrixTSparse< double > TMatrixDSparse
Definition: AlSpaMat.h:14
Trk::AlSpaMat::RemoveAlignPar
virtual void RemoveAlignPar(int, int) override final
Definition: AlSpaMat.cxx:565
lumiFormat.i
int i
Definition: lumiFormat.py:85
Trk::AlSpaMat::makeTMatrix
virtual TMatrixDSparse * makeTMatrix() override final
Definition: AlSpaMat.cxx:864
Trk::AlSpaMat::diagonalize
virtual int diagonalize(char jobz, AlVec &w, AlMat &z) override final
Definition: AlSpaMat.cxx:482
EL::StatusCode
::StatusCode StatusCode
StatusCode definition for legacy code.
Definition: PhysicsAnalysis/D3PDTools/EventLoop/EventLoop/StatusCode.h:22
Trk::AlSpaMat::invert
virtual int invert() override final
Definition: AlSpaMat.cxx:488
Trk::AlSpaMat::AlSpaMat
AlSpaMat()
Definition: AlSpaMat.cxx:36
Trk::AlSpaMat::~AlSpaMat
~AlSpaMat()
Definition: AlSpaMat.cxx:77
Trk::AlSpaMat::reSize
virtual void reSize(long int) override final
Definition: AlSpaMat.cxx:628
Trk::AlSymMatBase::m_nele
long int m_nele
Definition: AlSymMatBase.h:104
Trk::AlSpaMat::RemoveDoF
void RemoveDoF(int, int nelem=1)
Definition: AlSpaMat.cxx:494
xAOD::double
double
Definition: CompositeParticle_v1.cxx:159
Trk::AlSpaMat::operator+
AlSpaMat operator+(const AlSpaMat &) const
Definition: AlSpaMat.cxx:267
Trk
Ensure that the ATLAS eigen extensions are properly loaded.
Definition: FakeTrackBuilder.h:9
AlSymMatBase.h
Trk::AlSpaMat::nele
long int nele()
Definition: AlSpaMat.h:101
TMatrixTSparse
Definition: AlSpaMat.h:13
Trk::AlSpaMat::operator+=
AlSpaMat & operator+=(const AlSpaMat &)
Definition: AlSpaMat.cxx:283
Trk::AlSpaMat::operator*=
AlSpaMat & operator*=(const double &)
Definition: AlSpaMat.cxx:382
Trk::AlSpaMat::SetPathTxt
virtual void SetPathTxt(const std::string &) override final
Definition: AlSpaMat.cxx:655
Trk::AlSpaMat::m_ptr_col
int * m_ptr_col
Definition: AlSpaMat.h:89
python.IoTestsLib.w
def w
Definition: IoTestsLib.py:200
Trk::AlSpaMat::m_pathtxt
std::string m_pathtxt
Definition: AlSpaMat.h:86
Trk::AlSpaMat::pathBin
const std::string & pathBin() const
Definition: AlSpaMat.h:108
Trk::AlSpaMat::operator-=
AlSpaMat & operator-=(const AlSpaMat &)
Definition: AlSpaMat.cxx:314
Trk::AlSpaMat
Definition: AlSpaMat.h:27
Trk::AlSpaMat::RemoveModule
virtual void RemoveModule(int) override final
Definition: AlSpaMat.cxx:618
Trk::AlSpaMat::Read
virtual StatusCode Read(const std::string &, int &, bool &, float &) override final
Definition: AlSpaMat.cxx:737
Trk::AlSpaMat::operator-
AlSpaMat operator-(const AlSpaMat &) const
Definition: AlSpaMat.cxx:298
mapkey::key
key
Definition: TElectronEfficiencyCorrectionTool.cxx:37