ATLAS Offline Software
Loading...
Searching...
No Matches
AlVec.h
Go to the documentation of this file.
1/*
2 Copyright (C) 2002-2026 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 <stdexcept>
11#include <map>
12#include <vector>
13#include <string>
14#include <string_view>
15#include <fstream>
16
17class StatusCode;
18
19namespace Trk {
20
21class AlSymMatBase;
22class AlSymMat;
23class AlMat;
24class AlSpaMat;
25
26class AlVec {
27 public:
28 AlVec(int N);
29 AlVec();
30 AlVec(const AlVec& v);
32 : m_size (v.m_size),
34 m_pathbin ( std::move(v.m_pathbin) ),
35 m_pathtxt ( std::move(v.m_pathtxt) )
36 {
37
38 v.m_size = 0;
39 v.m_ptr_data = nullptr;
40 }
41
42 ~AlVec();
43
44 inline double& operator[](int i);
45 inline const double& operator[](int i) const;
46
47 AlVec& operator=(const AlVec& v);
49 if (&v != this ) {
50 m_pathbin = std::move(v.m_pathbin);
51 m_pathtxt = std::move(v.m_pathtxt);
52 m_size = v.m_size;
53 m_ptr_data = v.m_ptr_data;
54 v.m_size = 0;
55 v.m_ptr_data = nullptr;
56 }
57
58 return *this;
59
60 }
61
62 AlVec& operator=(const double& v);
63 AlVec operator+(const AlVec&) const;
64 AlVec& operator+=(const AlVec&);
65 AlVec operator-(const AlVec&) const;
66 AlVec& operator-=(const AlVec&);
67 double operator*(const AlVec&) const;
68 AlVec operator*(const AlMat&) const;
69 AlVec operator*(const AlSymMatBase&) const;
70 AlVec operator*(const double&) const;
71 AlVec& operator*=(const double&);
72
73 double norm() const;
74
75 void reSize(int);
76 void RemoveModule(int);
77 void RemoveAlignPar(int, int);
78 int RemoveElements(std::vector<int>);
79 void SetPathBin(const std::string&);
80 void SetPathTxt(const std::string&);
81 StatusCode Write(std::string_view, bool, double, const std::map<int,unsigned long long>&, float);
82 StatusCode WritePartial(std::string_view, bool, double, const std::map<int,unsigned long long>&, float);
83 StatusCode WritePartial(std::string_view, bool, double, const std::map<int,std::string>&, float);
84 StatusCode InitializeOutputVector(std::string_view, bool, double, float, std::ofstream&);
85
86 static StatusCode CheckVecVersion(const std::string&, bool&);
87 StatusCode Read(const std::string&, double&, std::map<int,unsigned long long>&, float&);
88 StatusCode ReadPartial(const std::string&, double&, std::map<int,unsigned long long>&, float&);
89 StatusCode ReadProjected(const std::string&, double&, std::map<int,unsigned long long>&, float&);
90 StatusCode ReadScalaPack(const std::string&);
91 StatusCode WriteEigenvalueVec(const std::string &, bool);
92 inline int size() const;
93 inline const double* ptrData() const;
94 inline double* ptrData();
95
96 protected:
97 int m_size;
98 double* m_ptr_data = nullptr;
99 std::string m_pathbin;
100 std::string m_pathtxt;
101
102 void copy(const AlVec&);
103
104 //friend class AlSymMatBase;
105 //friend class AlSymMat;
106 //friend class AlSpaMat;
107 //friend class AlMat;
108};
109
110// inline methods:
111
112inline int AlVec::size() const {
113 return m_size;
114}
115
116inline const double* AlVec::ptrData() const {
117 return m_ptr_data;
118}
119
120inline double* AlVec::ptrData() {
121 return m_ptr_data;
122}
123
124inline double& AlVec::operator[](int i) {
125 if( i < 0 ) {
126 throw std::out_of_range( "AlVec: Index < zero! " );
127 }
128
129 if( i >= m_size ) {
130 throw std::out_of_range( "AlVec: Index too large! ");
131 }
132
133 return *(m_ptr_data+i);
134}
135
136inline const double& AlVec::operator[](int i) const {
137 if( i < 0 ) {
138 throw std::out_of_range( "AlVec: Index < zero! " );
139 }
140
141 if( i >= m_size ) {
142 throw std::out_of_range( "AlVec: Index too large! " );
143 }
144
145 return *(m_ptr_data+i);
146}
147
148} // end namespace Trk
149
150#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:100
void SetPathBin(const std::string &)
Definition AlVec.cxx:308
double & operator[](int i)
Definition AlVec.h:124
StatusCode Write(std::string_view, bool, double, const std::map< int, unsigned long long > &, float)
Definition AlVec.cxx:320
AlVec(int N)
Definition AlVec.cxx:36
AlVec & operator+=(const AlVec &)
Definition AlVec.cxx:116
AlVec & operator*=(const double &)
Definition AlVec.cxx:200
std::string m_pathbin
Definition AlVec.h:99
double norm() const
Definition AlVec.cxx:211
StatusCode InitializeOutputVector(std::string_view, bool, double, float, std::ofstream &)
Definition AlVec.cxx:435
AlVec operator+(const AlVec &) const
Definition AlVec.cxx:100
int RemoveElements(std::vector< int >)
Definition AlVec.cxx:271
StatusCode ReadPartial(const std::string &, double &, std::map< int, unsigned long long > &, float &)
Definition AlVec.cxx:464
StatusCode WriteEigenvalueVec(const std::string &, bool)
Definition AlVec.cxx:648
AlVec & operator-=(const AlVec &)
Definition AlVec.cxx:145
const double * ptrData() const
Definition AlVec.h:116
double * m_ptr_data
Definition AlVec.h:98
StatusCode Read(const std::string &, double &, std::map< int, unsigned long long > &, float &)
Definition AlVec.cxx:540
void SetPathTxt(const std::string &)
Definition AlVec.cxx:314
AlVec & operator=(const AlVec &v)
Definition AlVec.cxx:87
AlVec(AlVec &&v)
Definition AlVec.h:31
void RemoveModule(int)
Definition AlVec.cxx:241
int m_size
Definition AlVec.h:97
StatusCode WritePartial(std::string_view, bool, double, const std::map< int, unsigned long long > &, float)
Definition AlVec.cxx:374
void RemoveAlignPar(int, int)
Definition AlVec.cxx:254
void reSize(int)
Definition AlVec.cxx:224
StatusCode ReadProjected(const std::string &, double &, std::map< int, unsigned long long > &, float &)
Definition AlVec.cxx:589
StatusCode ReadScalaPack(const std::string &)
Definition AlVec.cxx:627
AlVec operator-(const AlVec &) const
Definition AlVec.cxx:129
void copy(const AlVec &)
Definition AlVec.cxx:65
int size() const
Definition AlVec.h:112
AlVec & operator=(AlVec &&v)
Definition AlVec.h:48
AlVec operator*(const double &) const
static StatusCode CheckVecVersion(const std::string &, bool &)
Definition AlVec.cxx:512
::StatusCode StatusCode
StatusCode definition for legacy code.
Ensure that the ATLAS eigen extensions are properly loaded.
@ v
Definition ParamDefs.h:78
STL namespace.