ATLAS Offline Software
Loading...
Searching...
No Matches
AlVec.h
Go to the documentation of this file.
1/*
2 Copyright (C) 2002-2022 CERN for the benefit of the ATLAS collaboration
3*/
4
5#ifndef TRKALGS_ALVEC_H
6#define TRKALGS_ALVEC_H
7
8// PBdR (17Apr2007)
9
10#include <exception>
11#include <map>
12#include <vector>
13
14class StatusCode;
15
16namespace Trk {
17
18class AlSymMatBase;
19class AlSymMat;
20class AlMat;
21class AlSpaMat;
22
23class AlVec {
24 public:
25 AlVec(int N);
26 AlVec();
27 AlVec(const AlVec& v);
29 : m_size (v.m_size),
31 m_pathbin ( std::move(v.m_pathbin) ),
32 m_pathtxt ( std::move(v.m_pathtxt) )
33 {
34
35 v.m_size = 0;
36 v.m_ptr_data = nullptr;
37 }
38
39 ~AlVec();
40
41 inline double& operator[](int i);
42 inline const double& operator[](int i) const;
43
44 AlVec& operator=(const AlVec& v);
46 if (&v != this ) {
47 m_pathbin = std::move(v.m_pathbin);
48 m_pathtxt = std::move(v.m_pathtxt);
49 m_size = v.m_size;
50 m_ptr_data = v.m_ptr_data;
51 v.m_size = 0;
52 v.m_ptr_data = nullptr;
53 }
54
55 return *this;
56
57 }
58
59 AlVec& operator=(const double& v);
60 AlVec operator+(const AlVec&) const;
61 AlVec& operator+=(const AlVec&);
62 AlVec operator-(const AlVec&) const;
63 AlVec& operator-=(const AlVec&);
64 double operator*(const AlVec&) const;
65 AlVec operator*(const AlMat&) const;
66 AlVec operator*(const AlSymMatBase&) const;
67 AlVec operator*(const double&) const;
68 AlVec& operator*=(const double&);
69
70 double norm() const;
71
72 void reSize(int);
73 void RemoveModule(int);
74 void RemoveAlignPar(int, int);
75 int RemoveElements(std::vector<int>);
76 void SetPathBin(const std::string&);
77 void SetPathTxt(const std::string&);
78 StatusCode Write(const std::string&, bool, double, std::map<int,unsigned long long>, float);
79 StatusCode WritePartial(const std::string&, bool, double, std::map<int,unsigned long long>, float);
80 StatusCode WritePartial(const std::string&, bool, double, std::map<int,std::string>, float);
81 StatusCode InitializeOutputVector(const std::string&, bool, double, float, std::ofstream&);
82
83 static StatusCode CheckVecVersion(const std::string&, bool&);
84 StatusCode Read(const std::string&, double&, std::map<int,unsigned long long>&, float&);
85 StatusCode ReadPartial(const std::string&, double&, std::map<int,unsigned long long>&, float&);
86 StatusCode ReadProjected(const std::string&, double&, std::map<int,unsigned long long>&, float&);
87 StatusCode ReadScalaPack(const std::string&);
88 StatusCode WriteEigenvalueVec(const std::string &, bool);
89 inline int size() const;
90 inline const double* ptrData() const;
91 inline double* ptrData();
92
93 protected:
94 int m_size;
95 double* m_ptr_data = nullptr;
96 std::string m_pathbin;
97 std::string m_pathtxt;
98
99 void copy(const AlVec&);
100
101 //friend class AlSymMatBase;
102 //friend class AlSymMat;
103 //friend class AlSpaMat;
104 //friend class AlMat;
105};
106
107// inline methods:
108
109inline int AlVec::size() const {
110 return m_size;
111}
112
113inline const double* AlVec::ptrData() const {
114 return m_ptr_data;
115}
116
117inline double* AlVec::ptrData() {
118 return m_ptr_data;
119}
120
121inline double& AlVec::operator[](int i) {
122 if( i < 0 ) {
123 throw std::out_of_range( "AlVec: Index < zero! " );
124 }
125
126 if( i >= m_size ) {
127 throw std::out_of_range( "AlVec: Index too large! ");
128 }
129
130 return *(m_ptr_data+i);
131}
132
133inline const double& AlVec::operator[](int i) const {
134 if( i < 0 ) {
135 throw std::out_of_range( "AlVec: Index < zero! " );
136 }
137
138 if( i >= m_size ) {
139 throw std::out_of_range( "AlVec: Index too large! " );
140 }
141
142 return *(m_ptr_data+i);
143}
144
145} // end namespace Trk
146
147#endif // TRKALGS_ALVEC_H
contains the implementation of the methods of class AlMat, for handling general NxM matrices
Definition AlMat.h:27
contains the implementation for handling sparse matrices
Definition AlSpaMat.h:27
contains the base implementation for handling symmertic matrices
contains the implementation for handling symmetric matrices in triangular representation
Definition AlSymMat.h:26
std::string m_pathtxt
Definition AlVec.h:97
void SetPathBin(const std::string &)
Definition AlVec.cxx:310
double & operator[](int i)
Definition AlVec.h:121
AlVec(int N)
Definition AlVec.cxx:38
AlVec & operator+=(const AlVec &)
Definition AlVec.cxx:118
AlVec & operator*=(const double &)
Definition AlVec.cxx:202
std::string m_pathbin
Definition AlVec.h:96
double norm() const
Definition AlVec.cxx:213
AlVec operator+(const AlVec &) const
Definition AlVec.cxx:102
int RemoveElements(std::vector< int >)
Definition AlVec.cxx:273
StatusCode ReadPartial(const std::string &, double &, std::map< int, unsigned long long > &, float &)
Definition AlVec.cxx:491
StatusCode WriteEigenvalueVec(const std::string &, bool)
Definition AlVec.cxx:675
AlVec & operator-=(const AlVec &)
Definition AlVec.cxx:147
const double * ptrData() const
Definition AlVec.h:113
double * m_ptr_data
Definition AlVec.h:95
StatusCode Read(const std::string &, double &, std::map< int, unsigned long long > &, float &)
Definition AlVec.cxx:567
void SetPathTxt(const std::string &)
Definition AlVec.cxx:316
AlVec & operator=(const AlVec &v)
Definition AlVec.cxx:89
AlVec(AlVec &&v)
Definition AlVec.h:28
void RemoveModule(int)
Definition AlVec.cxx:243
StatusCode WritePartial(const std::string &, bool, double, std::map< int, unsigned long long >, float)
Definition AlVec.cxx:373
int m_size
Definition AlVec.h:94
void RemoveAlignPar(int, int)
Definition AlVec.cxx:256
void reSize(int)
Definition AlVec.cxx:226
StatusCode ReadProjected(const std::string &, double &, std::map< int, unsigned long long > &, float &)
Definition AlVec.cxx:616
StatusCode ReadScalaPack(const std::string &)
Definition AlVec.cxx:654
AlVec operator-(const AlVec &) const
Definition AlVec.cxx:131
StatusCode InitializeOutputVector(const std::string &, bool, double, float, std::ofstream &)
Definition AlVec.cxx:462
void copy(const AlVec &)
Definition AlVec.cxx:67
int size() const
Definition AlVec.h:109
AlVec & operator=(AlVec &&v)
Definition AlVec.h:45
AlVec operator*(const double &) const
static StatusCode CheckVecVersion(const std::string &, bool &)
Definition AlVec.cxx:539
double operator*(const AlVec &) const
Definition AlVec.cxx:160
StatusCode Write(const std::string &, bool, double, std::map< int, unsigned long long >, float)
Definition AlVec.cxx:322
Ensure that the ATLAS eigen extensions are properly loaded.
@ v
Definition ParamDefs.h:78
STL namespace.