26 #ifndef ROOT_TMatrixTSym
29 #ifndef ROOT_TMatrixTSparse
59 TVectorT() : fNrows(0), fRowLwb(0), fElements(0), fDataStack (), fIsOwner(
kTRUE) { }
92 memcpy(fElements,elements,fNrows*
sizeof(Element)); }
117 Element
Norm1 ()
const;
121 Element
Sum ()
const;
122 Element
Min ()
const;
123 Element
Max ()
const;
139 Error(
"operator=(const TVectorT2 &)",
"vectors not compatible");
204 this->GetSub(row_lwb,row_upb,tmp,option);
213 const Int_t aind = ind-fRowLwb;
214 if (aind >= fNrows || aind < 0) {
215 Error(
"operator()",
"Request index(%d) outside vector range of %d - %d",ind,fRowLwb,fRowLwb+fNrows);
219 return fElements[aind];
226 const Int_t aind = ind-fRowLwb;
227 if (aind >= fNrows || aind < 0) {
228 Error(
"operator()",
"Request index(%d) outside vector range of %d - %d",ind,fRowLwb,fRowLwb+fNrows);
232 return fElements[aind];
243 template<
class Element>
248 template <
class Element1,
class Element2>
250 template <
class Element1,
class Element2,
class Element3>
252 template <
class Element1,
class Element2,
class Element3>
Element Sum() const
Compute sum of elements.
void SetElements(const Element *elements)
void Compare(const TVectorT< Element > &source1, const TVectorT< Element > &source2)
Compare two vectors and print out the result of the comparison.
TVectorT< Element > & ResizeTo(Int_t lwb, Int_t upb)
Resize the vector to [lwb:upb] .
TVectorT< Element > & operator-=(Element val)
Subtract val from every element of the vector.
TMatrixT< Element1 > OuterProduct(const TVectorT< Element1 > &v1, const TVectorT< Element2 > &v2)
Return the matrix M = v1 * v2'.
Element Max() const
return maximum vector element value
const Element & operator()(Int_t index) const
void Add(const TVectorT< Element > &v)
Add vector v to this vector.
void Draw(Option_t *option="")
Draw this vector The histogram is named "TVectorT" by default and no title.
TVectorT< Element > operator+(const TVectorT< Element > &source1, const TVectorT< Element > &source2)
Return source1+source2.
const Element * GetMatrixArray() const
Bool_t fIsOwner
data container
Element operator*(const TVectorT< Element > &source1, const TVectorT< Element > &source2)
Compute the scalar product.
TVectorT< Element > & Invert()
v[i] = 1/v[i]
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...
Element fDataStack[kSizeMax]
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.
TVectorT< Element > & AddElemDiv(TVectorT< Element > &target, Element scalar, const TVectorT< Element > &source1, const TVectorT< Element > &source2)
Modify addition: target += scalar * ElementDiv(source1,source2) .
Bool_t operator>(Element val) const
Are all vector elements > val?
TVectorT< Element > & Sqr()
Square each element of the vector.
void SetBit(UInt_t f, Bool_t set)
Set or unset the user status bits as specified in f.
double beta(double x, double y)
Calculates the beta function.
void Randomize(Element alpha, Element beta, Double_t &seed)
randomize vector elements value
TVectorT< Element > & Use(Int_t lwb, Int_t upb, Element *data)
Use the array data to fill the vector lwb..upb].
#define ClassDef(name, id)
TVectorT< Element > & ElementDiv(TVectorT< Element > &target, const TVectorT< Element > &source)
Divide target by the source, element-by-element.
TVectorT< Element > & SetSub(Int_t row_lwb, const TVectorT< Element > &source)
Insert vector source starting at [row_lwb], thereby overwriting the part [row_lwb..row_lwb+nrows_source];.
TObject & operator=(const TObject &rhs)
TObject assignment operator.
Element1 Mult(const TVectorT< Element1 > &v1, const TMatrixT< Element2 > &m, const TVectorT< Element3 > &v2)
Perform v1 * M * v2, a scalar result.
void Delete_m(Int_t size, Element *&)
virtual void Error(const char *method, const char *msgfmt,...) const
Issue error message.
void Clear(Option_t *="")
const TVectorT< Element > & Use(Int_t lwb, Int_t upb, const Element *data) const
TVectorT< Element > & Sqrt()
Take square root of all elements.
void Error(const char *location, const char *msgfmt,...)
const Element & operator[](Int_t index) const
void Allocate(Int_t nrows, Int_t row_lwb=0, Int_t init=0)
Allocate new vector.
TVectorT< Element > & Shift(Int_t row_shift)
Element * GetMatrixArray()
Bool_t operator==(const TVectorT< Element > &source1, const TVectorT< Element > &source2)
Check to see if two vectors are identical.
void Print(Option_t *option="") const
Print the vector as a list of elements.
Bool_t operator==(Element val) const
Are all vector elements equal to val?
Bool_t operator>=(Element val) const
Are all vector elements >= val?
Int_t NonZeros() const
Compute the number of elements != 0.0.
Element Min() const
return minimum vector element value
Element NormInf() const
Compute the infinity-norm of the vector MAX{ |v[i]| }.
Bool_t operator!=(Element val) const
Are all vector elements not equal to val?
TVectorT< Element > & operator=(const TVectorT< Element > &source)
Notice that this assignment does NOT change the ownership : if the storage space was adopted...
TVectorT< Element > & operator*=(Element val)
Multiply every element of the vector with val.
TVectorT< Element > & Zero()
Set vector elements to zero.
Bool_t TestBit(UInt_t f) const
TVectorT< Element > & ElementMult(TVectorT< Element > &target, const TVectorT< Element > &source)
Multiply target by the source, element-by-element.
Element Norm2Sqr() const
Compute the square of the 2-norm SUM{ v[i]^2 }.
TVectorT< Element > & SelectNonZeros(const TVectorT< Element > &select)
Keep only element as selected through array select non-zero.
Element Dot(const TVectorT< Element > &source1, const TVectorT< Element > &source2)
return inner-produvt v1 . v2
Element Norm1() const
Compute the 1-norm of the vector SUM{ |v[i]| }.
TVectorT< Element > & ResizeTo(const TVectorT< Element > &v)
Bool_t operator<=(Element val) const
Are all vector elements <= val?
Mother of all ROOT objects.
Int_t GetNoElements() const
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 .
TVectorT< Element > & Add(TVectorT< Element > &target, Element scalar, const TVectorT< Element > &source)
Modify addition: target += scalar * source.
TVectorT< Element > & AddElemMult(TVectorT< Element > &target, Element scalar, const TVectorT< Element > &source1, const TVectorT< Element > &source2)
Modify addition: target += scalar * ElementMult(source1,source2) .
TVectorT< Element > & Abs()
Take an absolute value of a vector, i.e. apply Abs() to each element.
Element & operator[](Int_t index)
Bool_t MatchesNonZeroPattern(const TVectorT< Element > &select)
Check if vector elements as selected through array select are non-zero.
static Element & NaNValue()
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 .
TVectorT< Element > & ResizeTo(Int_t n)
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 > operator-(const TVectorT< Element > &source1, const TVectorT< Element > &source2)
Return source1-source2.
Element * New_m(Int_t size)
default kTRUE, when Use array kFALSE
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 < val?
Bool_t SomePositive(const TVectorT< Element > &select)
Check if vector elements as selected through array select are all positive.
TVectorT(const TVectorT< Element2 > &another)
TVectorT< Element > & operator+=(Element val)
Add val to every element of the vector.
TVectorT< Element > & Apply(const TElementActionT< Element > &action)
Apply action to each element of the vector.