Logo ROOT  
Reference Guide
Loading...
Searching...
No Matches
TVectorT.h
Go to the documentation of this file.
1// @(#)root/matrix:$Id$
2// Authors: Fons Rademakers, Eddy Offermann Nov 2003
3
4/*************************************************************************
5 * Copyright (C) 1995-2000, Rene Brun and Fons Rademakers. *
6 * All rights reserved. *
7 * *
8 * For the licensing terms see $ROOTSYS/LICENSE. *
9 * For the list of contributors see $ROOTSYS/README/CREDITS. *
10 *************************************************************************/
11
12#ifndef ROOT_TVectorT
13#define ROOT_TVectorT
14
15//////////////////////////////////////////////////////////////////////////
16// //
17// TVectorT //
18// //
19// Template class of Vectors in the linear algebra package //
20// //
21//////////////////////////////////////////////////////////////////////////
22
23#include "TMatrixT.h"
24#include "TMatrixTSym.h"
25#include "TMatrixTSparse.h"
26
27#include <ROOT/RSpan.hxx>
28
29template<class Element> class TVectorT : public TObject {
30
31protected:
32 Int_t fNrows{0}; // number of rows
33 Int_t fRowLwb{0}; // lower bound of the row index
34 Element *fElements{nullptr}; //[fNrows] elements themselves
35
36 enum {kSizeMax = 5}; // size data container on stack, see New_m(),Delete_m()
37 enum {kWorkMax = 100}; // size of work array's in several routines
38
39 Element fDataStack[kSizeMax]; ///<! data container
40 Bool_t fIsOwner{kTRUE}; ///<!default kTRUE, when Use array kFALSE
41
42 Element* New_m (Int_t size);
43 void Delete_m(Int_t size,Element*&);
44 Int_t Memcpy_m(Element *newp,const Element *oldp,Int_t copySize,
45 Int_t newSize,Int_t oldSize);
46
47 void Allocate(Int_t nrows,Int_t row_lwb = 0,Int_t init = 0);
48
50 kStatus = BIT(14) // set if vector object is valid
51 };
52
53public:
54
55 TVectorT() : fNrows(0), fRowLwb(0), fElements(nullptr), fDataStack (), fIsOwner(kTRUE) { }
56 explicit TVectorT(Int_t n);
58 TVectorT(Int_t n,const Element *elements);
59 TVectorT(Int_t lwb,Int_t upb,const Element *elements);
60 TVectorT(const TVectorT <Element> &another);
61 TVectorT(const TMatrixTRow_const <Element> &mr);
63 TVectorT(const TMatrixTDiag_const <Element> &md);
64 template <class Element2> TVectorT(const TVectorT<Element2> &another)
65 {
66 R__ASSERT(another.IsValid());
67 Allocate(another.GetUpb()-another.GetLwb()+1,another.GetLwb());
68 *this = another;
69 }
70 TVectorT(Int_t lwb,Int_t upb,Double_t iv1, ...);
71 ~TVectorT() override { TVectorT::Clear(); }
72
73 inline Int_t GetLwb () const { return fRowLwb; }
74 inline Int_t GetUpb () const { return fNrows+fRowLwb-1; }
75 inline Int_t GetNrows () const { return fNrows; }
76 inline Int_t GetNoElements() const { return fNrows; }
77
78 inline Element *GetMatrixArray () { return fElements; }
79 inline const Element *GetMatrixArray () const { return fElements; }
80
81 // For compatibility with STL classes
82 inline std::size_t size() const { return fNrows; }
83
84 inline Element *data() { return fElements; }
85 inline const Element *data() const { return fElements; }
86
87 // Implicit conversion of TVectorT to std::span, both non-const and const
88 // version. Can be removed once the minimum C++ standard in C++20, because
89 // then it's enough to implement the contiguous_range and sized_range
90 // concepts. This should alredy be the case since data() and size() are
91 // available.
92 inline operator std::span<Element>()
93 {
94 return std::span<Element>{data(), size()};
95 }
96 inline operator std::span<const Element>() const
97 {
98 return std::span<const Element>{data(), size()};
99 }
100
101 inline void Invalidate () { SetBit(kStatus); }
102 inline void MakeValid () { ResetBit(kStatus); }
103 inline Bool_t IsValid () const { return !TestBit(kStatus); }
104 inline Bool_t IsOwner () const { return fIsOwner; }
105 inline void SetElements(const Element *elements) { R__ASSERT(IsValid());
106 memcpy(fElements,elements,fNrows*sizeof(Element)); }
107 inline TVectorT<Element> &Shift (Int_t row_shift) { fRowLwb += row_shift; return *this; }
109 inline TVectorT<Element> &ResizeTo (Int_t n) { return ResizeTo(0,n-1); }
110 inline TVectorT<Element> &ResizeTo (const TVectorT<Element> &v) { return ResizeTo(v.GetLwb(),v.GetUpb()); }
111
112 TVectorT<Element> &Use (Int_t lwb,Int_t upb,Element *data);
113 const TVectorT<Element> &Use (Int_t lwb,Int_t upb,const Element *data) const
114 { return (const TVectorT<Element>&)(const_cast<TVectorT<Element> *>(this))->Use(lwb,upb,const_cast<Element *>(data)); }
116 const TVectorT<Element> &Use (Int_t n,const Element *data) const ;
118 const TVectorT<Element> &Use (const TVectorT<Element> &v) const ;
119
120 TVectorT<Element> &GetSub (Int_t row_lwb,Int_t row_upb,TVectorT<Element> &target,Option_t *option="S") const;
121 TVectorT<Element> GetSub (Int_t row_lwb,Int_t row_upb,Option_t *option="S") const;
123
130
131 Element Norm1 () const;
132 Element Norm2Sqr() const;
133 Element NormInf () const;
135 Element Sum () const;
136 Element Min () const;
137 Element Max () const;
138
139 inline const Element &operator()(Int_t index) const;
140 inline Element &operator()(Int_t index);
141 inline const Element &operator[](Int_t index) const { return (*this)(index); }
142 inline Element &operator[](Int_t index) { return (*this)(index); }
143
144 TVectorT<Element> &operator= (const TVectorT <Element> &source);
145 TVectorT<Element> &operator= (const TMatrixTRow_const <Element> &mr);
146 TVectorT<Element> &operator= (const TMatrixTColumn_const <Element> &mc);
147 TVectorT<Element> &operator= (const TMatrixTDiag_const <Element> &md);
148 TVectorT<Element> &operator= (const TMatrixTSparseRow_const <Element> &md);
150 template <class Element2> TVectorT<Element> &operator= (const TVectorT<Element2> &source)
151 {
152 if (!AreCompatible(*this,source)) {
153 Error("operator=(const TVectorT2 &)","vectors not compatible");
154 return *this;
155 }
156
157 TObject::operator=(source);
158 const Element2 * const ps = source.GetMatrixArray();
159 Element * const pt = GetMatrixArray();
160 for (Int_t i = 0; i < this->fNrows; i++)
161 pt[i] = ps[i];
162 return *this;
163 }
164
169
170 TVectorT<Element> &operator+=(const TVectorT <Element> &source);
171 TVectorT<Element> &operator-=(const TVectorT <Element> &source);
172 TVectorT<Element> &operator*=(const TMatrixT <Element> &a);
173 TVectorT<Element> &operator*=(const TMatrixTSym <Element> &a);
175
176 Bool_t operator==(Element val) const;
177 Bool_t operator!=(Element val) const;
178 Bool_t operator< (Element val) const;
179 Bool_t operator<=(Element val) const;
180 Bool_t operator> (Element val) const;
181 Bool_t operator>=(Element val) const;
182
185 void AddSomeConstant (Element val,const TVectorT<Element> &select);
186
187 void Randomize (Element alpha,Element beta,Double_t &seed);
188
189 TVectorT<Element> &Apply(const TElementActionT <Element> &action);
191
192 void Add(const TVectorT<Element> &v);
194 void Clear(Option_t * /*option*/ = "") override
195 {
196 if (fIsOwner)
198 else
199 fElements = nullptr;
200 fNrows = 0;
201 }
202 void Draw(Option_t *option = "") override; // *MENU*
203 void Print(Option_t *option = "") const override; // *MENU*
204
205 ClassDefOverride(TVectorT,4) // Template of Vector class
206};
207
208// When building with -fmodules, it instantiates all pending instantiations,
209// instead of delaying them until the end of the translation unit.
210// We 'got away with' probably because the use and the definition of the
211// explicit specialization do not occur in the same TU.
212//
213// In case we are building with -fmodules, we need to forward declare the
214// specialization in order to compile the dictionary G__Matrix.cxx.
216
217template<class Element> inline TVectorT<Element> &TVectorT<Element>::Use (Int_t n,Element *data) { return Use(0,n-1,data); }
218template<class Element> inline const TVectorT<Element> &TVectorT<Element>::Use (Int_t n,const Element *data) const { return Use(0,n-1,data); }
219template<class Element> inline TVectorT<Element> &TVectorT<Element>::Use (TVectorT &v)
220 {
221 R__ASSERT(v.IsValid());
222 return Use(v.GetLwb(),v.GetUpb(),v.GetMatrixArray());
223 }
224template<class Element> inline const TVectorT<Element> &TVectorT<Element>::Use (const TVectorT &v) const
225 {
226 R__ASSERT(v.IsValid());
227 return Use(v.GetLwb(),v.GetUpb(),v.GetMatrixArray());
228 }
229template<class Element> inline TVectorT<Element> TVectorT<Element>::GetSub (Int_t row_lwb,Int_t row_upb,Option_t *option) const
230 {
231 TVectorT tmp;
232 this->GetSub(row_lwb,row_upb,tmp,option);
233 return tmp;
234 }
235
236template<class Element> inline const Element &TVectorT<Element>::operator()(Int_t ind) const
237{
238 // Access a vector element.
239
241 const Int_t aind = ind-fRowLwb;
242 if (aind >= fNrows || aind < 0) {
243 Error("operator()","Request index(%d) outside vector range of %d - %d",ind,fRowLwb,fRowLwb+fNrows);
245 }
246
247 return fElements[aind];
248}
249template<class Element> inline Element &TVectorT<Element>::operator()(Int_t ind)
250{
251 // Access a vector element.
252
254 const Int_t aind = ind-fRowLwb;
255 if (aind >= fNrows || aind < 0) {
256 Error("operator()","Request index(%d) outside vector range of %d - %d",ind,fRowLwb,fRowLwb+fNrows);
258 }
259
260 return fElements[aind];
261}
262inline namespace TMatrixTAutoloadOps {
263
264template<class Element> Bool_t operator== (const TVectorT <Element> &source1,const TVectorT <Element> &source2);
265template<class Element> TVectorT<Element> operator+ (const TVectorT <Element> &source1,const TVectorT <Element> &source2);
266template<class Element> TVectorT<Element> operator- (const TVectorT <Element> &source1,const TVectorT <Element> &source2);
267template<class Element> Element operator* (const TVectorT <Element> &source1,const TVectorT <Element> &source2);
268template<class Element> TVectorT<Element> operator* (const TMatrixT <Element> &a, const TVectorT <Element> &source);
269template<class Element> TVectorT<Element> operator* (const TMatrixTSym <Element> &a, const TVectorT <Element> &source);
270template<class Element> TVectorT<Element> operator* (const TMatrixTSparse<Element> &a, const TVectorT <Element> &source);
271template<class Element> TVectorT<Element> operator* ( Element val, const TVectorT <Element> &source);
272template<class Element>
273inline
274TVectorT<Element> operator* (const TVectorT <Element> &source, Element val) { return val * source; }
275
276template<class Element> Element Dot (const TVectorT <Element> &source1,const TVectorT <Element> &source2);
277template <class Element1,class Element2>
278 TMatrixT<Element1> OuterProduct(const TVectorT <Element1> &v1, const TVectorT <Element2> &v2);
279template <class Element1,class Element2,class Element3>
280 TMatrixT<Element1> &OuterProduct( TMatrixT <Element1> &target, const TVectorT <Element2> &v1, const TVectorT <Element3> &v2);
281template <class Element1,class Element2,class Element3>
282 Element1 Mult (const TVectorT <Element1> &v1, const TMatrixT <Element2> &m, const TVectorT <Element3> &v2);
283
284template<class Element> TVectorT<Element> &Add ( TVectorT <Element> &target, Element scalar, const TVectorT <Element> &source);
285template<class Element> TVectorT<Element> &Add ( TVectorT <Element> &target, Element scalar, const TMatrixT <Element> &a,
286 const TVectorT<Element> &source);
287template<class Element> TVectorT<Element> &Add ( TVectorT <Element> &target, Element scalar, const TMatrixTSym <Element> &a,
288 const TVectorT<Element> &source);
289template<class Element> TVectorT<Element> &Add ( TVectorT <Element> &target, Element scalar, const TMatrixTSparse<Element> &a,
290 const TVectorT<Element> &source);
291template<class Element> TVectorT<Element> &AddElemMult ( TVectorT <Element> &target, Element scalar, const TVectorT <Element> &source1,
292 const TVectorT <Element> &source2);
293template<class Element> TVectorT<Element> &AddElemMult ( TVectorT <Element> &target, Element scalar, const TVectorT <Element> &source1,
294 const TVectorT <Element> &source2,const TVectorT <Element> &select);
295template<class Element> TVectorT<Element> &AddElemDiv ( TVectorT <Element> &target, Element scalar, const TVectorT <Element> &source1,
296 const TVectorT <Element> &source2);
297template<class Element> TVectorT<Element> &AddElemDiv ( TVectorT <Element> &target, Element scalar, const TVectorT <Element> &source1,
298 const TVectorT <Element> &source2,const TVectorT <Element> &select);
299template<class Element> TVectorT<Element> &ElementMult ( TVectorT <Element> &target, const TVectorT <Element> &source);
300template<class Element> TVectorT<Element> &ElementMult ( TVectorT <Element> &target, const TVectorT <Element> &source, const TVectorT <Element> &select);
301template<class Element> TVectorT<Element> &ElementDiv ( TVectorT <Element> &target, const TVectorT <Element> &source);
302template<class Element> TVectorT<Element> &ElementDiv ( TVectorT <Element> &target, const TVectorT <Element> &source, const TVectorT <Element> &select);
303
304template<class Element1,class Element2> Bool_t AreCompatible(const TVectorT<Element1> &v1,const TVectorT<Element2> &v2,Int_t verbose=0);
305// Check matrix and vector for compatibility in multiply: M * v and v * M
306template<class Element1,class Element2> Bool_t AreCompatible(const TMatrixT<Element1> &m, const TVectorT<Element2> &v, Int_t verbose=0);
307template<class Element1,class Element2> Bool_t AreCompatible(const TVectorT<Element1> &v, const TMatrixT<Element2> &m, Int_t verbose=0);
308
309template<class Element> void Compare (const TVectorT <Element> &source1,const TVectorT <Element> &source2);
310template<class Element> Bool_t VerifyVectorValue (const TVectorT <Element> &m, Element val,Int_t verbose, Element maxDevAllow);
311template<class Element> Bool_t VerifyVectorValue (const TVectorT <Element> &m, Element val,Int_t verbose)
312 { return VerifyVectorValue(m,val,verbose,Element(0.0)); }
313template<class Element> Bool_t VerifyVectorValue (const TVectorT <Element> &m, Element val)
314 { return VerifyVectorValue(m,val,1,Element(0.0)); }
315template<class Element> Bool_t VerifyVectorIdentity (const TVectorT <Element> &m1,const TVectorT <Element> &m2, Int_t verbose, Element maxDevAllow);
316template<class Element> Bool_t VerifyVectorIdentity (const TVectorT <Element> &m1,const TVectorT <Element> &m2, Int_t verbose)
317 { return VerifyVectorIdentity(m1,m2,verbose,Element(0.0)); }
318template<class Element> Bool_t VerifyVectorIdentity (const TVectorT <Element> &m1,const TVectorT <Element> &m2)
319 { return VerifyVectorIdentity(m1,m2,1,Element(0.0)); }
320} // inline namespace TMatrixTAutoloadOps
321#endif
#define a(i)
Definition RSha256.hxx:99
int Int_t
Signed integer 4 bytes (int).
Definition RtypesCore.h:59
bool Bool_t
Boolean (0=false, 1=true) (bool).
Definition RtypesCore.h:77
double Double_t
Double 8 bytes.
Definition RtypesCore.h:73
constexpr Bool_t kTRUE
Definition RtypesCore.h:107
const char Option_t
Option string (const char).
Definition RtypesCore.h:80
#define BIT(n)
Definition Rtypes.h:91
#define ClassDefOverride(name, id)
Definition Rtypes.h:348
Error("WriteTObject","The current directory (%s) is not associated with a file. The object (%s) has not been written.", GetName(), objname)
#define R__ASSERT(e)
Checks condition e and reports a fatal error if it's false.
Definition TError.h:125
TClass instances represent classes, structs and namespaces in the ROOT type system.
Definition TClass.h:84
static Element & NaNValue()
TMatrixTSparse.
TObject & operator=(const TObject &rhs) noexcept
TObject assignment operator.
Definition TObject.h:305
Bool_t TestBit(UInt_t f) const
Definition TObject.h:204
void SetBit(UInt_t f, Bool_t set)
Set or unset the user status bits as specified in f.
Definition TObject.cxx:888
virtual void Error(const char *method, const char *msgfmt,...) const
Issue error message.
Definition TObject.cxx:1098
TObject()
TObject constructor.
Definition TObject.h:259
void ResetBit(UInt_t f)
Definition TObject.h:203
TVectorT.
Definition TVectorT.h:29
TVectorT< Element > & Zero()
Set vector elements to zero.
Definition TVectorT.cxx:453
Bool_t operator>=(Element val) const
Are all vector elements >= val?
Element * New_m(Int_t size)
Return data pointer .
Definition TVectorT.cxx:67
void MakeValid()
Definition TVectorT.h:102
TVectorT< Element > & Apply(const TElementActionT< Element > &action)
Apply action to each element of the vector.
void SetElements(const Element *elements)
Definition TVectorT.h:105
const Element * data() const
Definition TVectorT.h:85
void Allocate(Int_t nrows, Int_t row_lwb=0, Int_t init=0)
Allocate new vector.
Definition TVectorT.cxx:151
TVectorT< Element > & Sqr()
Square each element of the vector.
Definition TVectorT.cxx:482
TVectorT< Element > & operator-=(const TVectorT< Element > &source)
Subtract vector source.
Definition TVectorT.cxx:931
Element & operator[](Int_t index)
Definition TVectorT.h:142
Element Min() const
return minimum vector element value
Definition TVectorT.cxx:654
void Add(const TVectorT< Element > &v1, const TVectorT< Element > &v2)
Set this vector to v1+v2.
Definition TVectorT.cxx:102
Int_t Memcpy_m(Element *newp, const Element *oldp, Int_t copySize, Int_t newSize, Int_t oldSize)
Copy copySize doubles from *oldp to *newp .
Definition TVectorT.cxx:124
Element & operator()(Int_t index)
Definition TVectorT.h:249
TVectorT< Element > & Use(TVectorT< Element > &v)
Definition TVectorT.h:219
Element Norm1() const
Compute the 1-norm of the vector SUM{ |v[i]| }.
Definition TVectorT.cxx:567
void Delete_m(Int_t size, Element *&)
Delete data pointer m, if it was assigned on the heap.
Definition TVectorT.cxx:53
TVectorT(const TVectorT< Element2 > &another)
Definition TVectorT.h:64
Element NormInf() const
Compute the infinity-norm of the vector MAX{ |v[i]| }.
Definition TVectorT.cxx:603
Element Sum() const
Compute sum of elements.
Definition TVectorT.cxx:637
TVectorT(Int_t lwb, Int_t upb, const Element *elements)
Constructor [lwb..upb]-vector with data copied from array elements.
Definition TVectorT.cxx:205
void AddSomeConstant(Element val, const TVectorT< Element > &select)
Add to vector elements as selected through array select the value val.
Bool_t operator!=(Element val) const
Are all vector elements not equal to val?
void Invalidate()
Definition TVectorT.h:101
TVectorT(const TMatrixTRow_const< Element > &mr)
Constructor : create vector from matrix row.
Definition TVectorT.cxx:226
TVectorT< Element > & operator+=(const TVectorT< Element > &source)
Add vector source.
Definition TVectorT.cxx:911
Bool_t IsOwner() const
Definition TVectorT.h:104
Bool_t MatchesNonZeroPattern(const TVectorT< Element > &select)
Check if vector elements as selected through array select are non-zero.
TVectorT< Element > & GetSub(Int_t row_lwb, Int_t row_upb, TVectorT< Element > &target, Option_t *option="S") const
Get subvector [row_lwb..row_upb]; The indexing range of the returned vector depends on the argument o...
Definition TVectorT.cxx:373
TVectorT< Element > & Shift(Int_t row_shift)
Definition TVectorT.h:107
Element * data()
Definition TVectorT.h:84
static TClass * Class()
TVectorT< Element > & Abs()
Take an absolute value of a vector, i.e. apply Abs() to each element.
Definition TVectorT.cxx:464
Bool_t operator==(Element val) const
Are all vector elements equal to val?
Bool_t operator>(Element val) const
Are all vector elements > val?
TVectorT< Element > & ResizeTo(Int_t n)
Definition TVectorT.h:109
TVectorT< Element > & ResizeTo(Int_t lwb, Int_t upb)
Resize the vector to [lwb:upb] .
Definition TVectorT.cxx:294
TVectorT< Element > & operator=(const TVectorT< Element > &source)
Notice that this assignment does NOT change the ownership : if the storage space was adopted,...
Definition TVectorT.cxx:680
Int_t GetNrows() const
Definition TVectorT.h:75
Int_t GetUpb() const
Definition TVectorT.h:74
TVectorT< Element > & SetSub(Int_t row_lwb, const TVectorT< Element > &source)
Insert vector source starting at [row_lwb], thereby overwriting the part [row_lwb....
Definition TVectorT.cxx:422
void Randomize(Element alpha, Element beta, Double_t &seed)
randomize vector elements value
TVectorT< Element > & Use(Int_t n, Element *data)
Definition TVectorT.h:217
Bool_t IsValid() const
Definition TVectorT.h:103
TVectorT(const TVectorT< Element > &another)
Copy constructor.
Definition TVectorT.cxx:215
void Add(const TVectorT< Element > &v)
Add vector v to this vector.
Definition TVectorT.cxx:84
const Element & operator()(Int_t index) const
Definition TVectorT.h:236
TVectorT< Element > & operator+=(Element val)
Add val to every element of the vector.
Definition TVectorT.cxx:863
TVectorT< Element > & Use(Int_t lwb, Int_t upb, Element *data)
Use the array data to fill the vector lwb..upb].
Definition TVectorT.cxx:349
const TVectorT< Element > & Use(Int_t lwb, Int_t upb, const Element *data) const
Definition TVectorT.h:113
TVectorT(Int_t lwb, Int_t upb)
Constructor [lwb..upb]-vector.
Definition TVectorT.cxx:186
void Clear(Option_t *="") override
Definition TVectorT.h:194
TVectorT< Element > & SelectNonZeros(const TVectorT< Element > &select)
Keep only element as selected through array select non-zero.
Definition TVectorT.cxx:544
TVectorT< Element > & operator*=(const TMatrixTSparse< Element > &a)
"Inplace" multiplication target = A*target.
Element Max() const
return maximum vector element value
Definition TVectorT.cxx:666
Bool_t operator<(Element val) const
Are all vector elements < val?
TVectorT< Element > & operator*=(const TMatrixT< Element > &a)
"Inplace" multiplication target = A*target.
Definition TVectorT.cxx:952
TVectorT(const TMatrixTDiag_const< Element > &md)
Constructor : create vector from matrix diagonal.
Definition TVectorT.cxx:250
TVectorT< Element > & Apply(const TElementPosActionT< Element > &action)
Apply action to each element of the vector.
Bool_t operator<=(Element val) const
Are all vector elements <= val?
TVectorT(Int_t n, const Element *elements)
Constructor n-vector with data copied from array elements.
Definition TVectorT.cxx:195
TVectorT< Element > & operator*=(Element val)
Multiply every element of the vector with val.
Definition TVectorT.cxx:895
const TVectorT< Element > & Use(const TVectorT< Element > &v) const
Definition TVectorT.h:224
Bool_t SomePositive(const TVectorT< Element > &select)
Check if vector elements as selected through array select are all positive.
Double_t * fElements
Definition TVectorT.h:34
const Element & operator[](Int_t index) const
Definition TVectorT.h:141
Int_t NonZeros() const
Compute the number of elements != 0.0.
Definition TVectorT.cxx:620
std::size_t size() const
Definition TVectorT.h:82
TVectorT< Element > & ResizeTo(const TVectorT< Element > &v)
Definition TVectorT.h:110
Int_t GetLwb() const
Definition TVectorT.h:73
EVectorStatusBits
Definition TVectorT.h:49
TVectorT< Element > & operator*=(const TMatrixTSym< Element > &a)
"Inplace" multiplication target = A*target.
TVectorT(Int_t n)
Constructor n-vector.
Definition TVectorT.cxx:177
const TVectorT< Element > & Use(Int_t n, const Element *data) const
Definition TVectorT.h:218
TVectorT< Element > & Invert()
v[i] = 1/v[i]
Definition TVectorT.cxx:522
TVectorT()
Definition TVectorT.h:55
Int_t GetNoElements() const
Definition TVectorT.h:76
~TVectorT() override
Definition TVectorT.h:71
TVectorT(Int_t lwb, Int_t upb, Double_t iv1,...)
Make a vector and assign initial values.
Definition TVectorT.cxx:265
Element Norm2Sqr() const
Compute the square of the 2-norm SUM{ v[i]^2 }.
Definition TVectorT.cxx:584
void Print(Option_t *option="") const override
Print the vector as a list of elements.
Element * GetMatrixArray()
Definition TVectorT.h:78
const Element * GetMatrixArray() const
Definition TVectorT.h:79
TVectorT< Element > & operator-=(Element val)
Subtract val from every element of the vector.
Definition TVectorT.cxx:879
Double_t fDataStack[kSizeMax]
Definition TVectorT.h:39
TVectorT(const TMatrixTColumn_const< Element > &mc)
Constructor : create vector from matrix column.
Definition TVectorT.cxx:238
TVectorT< Element > GetSub(Int_t row_lwb, Int_t row_upb, Option_t *option="S") const
Definition TVectorT.h:229
void Draw(Option_t *option="") override
Draw this vector The histogram is named "TVectorT" by default and no title.
TVectorT< Element > & Sqrt()
Take square root of all elements.
Definition TVectorT.cxx:500
TPaveText * pt
const Int_t n
Definition legend1.C:16
Bool_t VerifyVectorValue(const TVectorT< Element > &m, Element val, Int_t verbose, Element maxDevAllow)
Validate that all elements of vector have value val within maxDevAllow .
TVectorT< Element > & AddElemDiv(TVectorT< Element > &target, Element scalar, const TVectorT< Element > &source1, const TVectorT< Element > &source2)
Modify addition: target += scalar * ElementDiv(source1,source2) .
TMatrixT< Element > operator+(const TMatrixT< Element > &source1, const TMatrixT< Element > &source2)
operation this = source1+source2
void Compare(const TMatrixTBase< Element > &m1, const TMatrixTBase< Element > &m2)
Compare two matrices and print out the result of the comparison.
TMatrixT< Element > & ElementMult(TMatrixT< Element > &target, const TMatrixT< Element > &source)
Multiply target by the source, element-by-element.
TVectorT< Element > & AddElemMult(TVectorT< Element > &target, Element scalar, const TVectorT< Element > &source1, const TVectorT< Element > &source2)
Modify addition: target += scalar * ElementMult(source1,source2) .
TMatrixT< Element > & Add(TMatrixT< Element > &target, Element scalar, const TMatrixT< Element > &source)
Modify addition: target += scalar * source.
TMatrixT< Element1 > OuterProduct(const TVectorT< Element1 > &v1, const TVectorT< Element2 > &v2)
Return the matrix M = v1 * v2'.
Element Dot(const TVectorT< Element > &source1, const TVectorT< Element > &source2)
return inner-produvt v1 . v2
Bool_t VerifyVectorIdentity(const TVectorT< Element > &m1, const TVectorT< Element > &m2, Int_t verbose, Element maxDevAllow)
Verify that elements of the two vectors are equal within maxDevAllow .
TMatrixT< Element > & ElementDiv(TMatrixT< Element > &target, const TMatrixT< Element > &source)
Divide target by the source, element-by-element.
Element1 Mult(const TVectorT< Element1 > &v1, const TMatrixT< Element2 > &m, const TVectorT< Element3 > &v2)
Perform v1 * M * v2, a scalar result.
TMatrixT< Element > operator-(const TMatrixT< Element > &source1, const TMatrixT< Element > &source2)
operation this = source1-source2
Bool_t AreCompatible(const TVectorT< Element1 > &v1, const TVectorT< Element2 > &v2, Int_t verbose=0)
Check if v1 and v2 are both valid and have the same shape.
Bool_t operator==(const TMatrixTBase< Element > &m1, const TMatrixTBase< Element > &m2)
Check to see if two matrices are identical.
TMatrixT< Element > operator*(Element val, const TMatrixT< Element > &source)
operation this = val*source
Bool_t AreCompatible(const TMatrixTBase< Element1 > &m1, const TMatrixTBase< Element2 > &m2, Int_t verbose=0)
Check that matrice sm1 and m2 areboth valid and have identical shapes .
TMarker m
Definition textangle.C:8