ROOT logo
ROOT » MATH » MATRIX » TVectorT<double>

class TVectorT<double>: public TObject


TVectorT

Template class of Vectors in the linear algebra package

Unless otherwise specified, vector indices always start with 0,
spanning up to the specified limit-1.

For (n) vectors where n <= kSizeMax (5 currently) storage space is
available on the stack, thus avoiding expensive allocation/
deallocation of heap space . However, this introduces of course
kSizeMax overhead for each vector object . If this is an issue
recompile with a new appropriate value (>=0) for kSizeMax

Another way to assign and store vector data is through Use
see for instance stressLinear.cxx file .

Note that Constructors/assignments exists for all different matrix
views

For usage examples see $ROOTSYS/test/stressLinear.cxx


This class is also known as (typedefs to this class)

TVectorT<Double_t>, TVectorD

Function Members (Methods)

public:
TVectorT<double>()
TVectorT<double>(Int_t n)
TVectorT<double>(const TVectorT<double>& another)
TVectorT<double>(const TMatrixTRow_const<double>& mr)
TVectorT<double>(const TMatrixTColumn_const<double>& mc)
TVectorT<double>(const TMatrixTDiag_const<double>& md)
TVectorT<double>(const TVectorT<float>& another)
TVectorT<double>(Int_t lwb, Int_t upb)
TVectorT<double>(Int_t n, const double* elements)
TVectorT<double>(Int_t lwb, Int_t upb, const double* elements)
virtual~TVectorT<double>()
TVectorT<double>&Abs()
voidTObject::AbstractMethod(const char* method) const
voidAdd(const TVectorT<double>& v)
voidAdd(const TVectorT<double>& v1, const TVectorT<double>& v2)
voidAddSomeConstant(double val, const TVectorT<double>& select)
virtual voidTObject::AppendPad(Option_t* option = "")
TVectorT<double>&Apply(const TElementActionT<double>& action)
TVectorT<double>&Apply(const TElementPosActionT<double>& action)
virtual voidTObject::Browse(TBrowser* b)
static TClass*Class()
virtual const char*TObject::ClassName() const
virtual voidClear(Option_t* = "")
virtual TObject*TObject::Clone(const char* newname = "") const
virtual Int_tTObject::Compare(const TObject* obj) const
virtual voidTObject::Copy(TObject& object) const
virtual voidTObject::Delete(Option_t* option = "")MENU
virtual Int_tTObject::DistancetoPrimitive(Int_t px, Int_t py)
virtual voidDraw(Option_t* option = "")MENU
virtual voidTObject::DrawClass() constMENU
virtual TObject*TObject::DrawClone(Option_t* option = "") constMENU
virtual voidTObject::Dump() constMENU
virtual voidTObject::Error(const char* method, const char* msgfmt) const
virtual voidTObject::Execute(const char* method, const char* params, Int_t* error = 0)
virtual voidTObject::Execute(TMethod* method, TObjArray* params, Int_t* error = 0)
virtual voidTObject::ExecuteEvent(Int_t event, Int_t px, Int_t py)
virtual voidTObject::Fatal(const char* method, const char* msgfmt) const
virtual TObject*TObject::FindObject(const char* name) const
virtual TObject*TObject::FindObject(const TObject* obj) const
virtual Option_t*TObject::GetDrawOption() const
static Long_tTObject::GetDtorOnly()
virtual const char*TObject::GetIconName() const
Int_tGetLwb() const
double*GetMatrixArray()
const double*GetMatrixArray() const
virtual const char*TObject::GetName() const
Int_tGetNoElements() const
Int_tGetNrows() const
virtual char*TObject::GetObjectInfo(Int_t px, Int_t py) const
static Bool_tTObject::GetObjectStat()
virtual Option_t*TObject::GetOption() const
TVectorT<double>GetSub(Int_t row_lwb, Int_t row_upb, Option_t* option = "S") const
TVectorT<double>&GetSub(Int_t row_lwb, Int_t row_upb, TVectorT<double>& target, Option_t* option = "S") const
virtual const char*TObject::GetTitle() const
virtual UInt_tTObject::GetUniqueID() const
Int_tGetUpb() const
virtual Bool_tTObject::HandleTimer(TTimer* timer)
virtual ULong_tTObject::Hash() const
virtual voidTObject::Info(const char* method, const char* msgfmt) const
virtual Bool_tTObject::InheritsFrom(const char* classname) const
virtual Bool_tTObject::InheritsFrom(const TClass* cl) const
virtual voidTObject::Inspect() constMENU
voidInvalidate()
TVectorT<double>&Invert()
voidTObject::InvertBit(UInt_t f)
virtual TClass*IsA() const
virtual Bool_tTObject::IsEqual(const TObject* obj) const
virtual Bool_tTObject::IsFolder() const
Bool_tTObject::IsOnHeap() const
Bool_tIsOwner() const
virtual Bool_tTObject::IsSortable() const
Bool_tIsValid() const
Bool_tTObject::IsZombie() const
virtual voidTObject::ls(Option_t* option = "") const
voidMakeValid()
Bool_tMatchesNonZeroPattern(const TVectorT<double>& select)
doubleMax() const
voidTObject::MayNotUse(const char* method) const
doubleMin() const
Int_tNonZeros() const
doubleNorm1() const
doubleNorm2Sqr() const
doubleNormInf() const
virtual Bool_tTObject::Notify()
static voidTObject::operator delete(void* ptr)
static voidTObject::operator delete(void* ptr, void* vp)
static voidTObject::operator delete[](void* ptr)
static voidTObject::operator delete[](void* ptr, void* vp)
void*TObject::operator new(size_t sz)
void*TObject::operator new(size_t sz, void* vp)
void*TObject::operator new[](size_t sz)
void*TObject::operator new[](size_t sz, void* vp)
Bool_toperator!=(double val) const
const double&operator()(Int_t ind) const
double&operator()(Int_t ind)
TVectorT<double>&operator*=(double val)
TVectorT<double>&operator*=(const TMatrixT<double>& a)
TVectorT<double>&operator*=(const TMatrixTSym<double>& a)
TVectorT<double>&operator*=(const TMatrixTSparse<double>& a)
TVectorT<double>&operator+=(double val)
TVectorT<double>&operator+=(const TVectorT<double>& source)
TVectorT<double>&operator-=(double val)
TVectorT<double>&operator-=(const TVectorT<double>& source)
Bool_toperator<(double val) const
Bool_toperator<=(double val) const
TVectorT<double>&operator=(const TVectorT<double>& source)
TVectorT<double>&operator=(const TMatrixTRow_const<double>& mr)
TVectorT<double>&operator=(const TMatrixTColumn_const<double>& mc)
TVectorT<double>&operator=(const TMatrixTDiag_const<double>& md)
TVectorT<double>&operator=(const TMatrixTSparseRow_const<double>& md)
TVectorT<double>&operator=(const TMatrixTSparseDiag_const<double>& md)
TVectorT<double>&operator=(double val)
Bool_toperator==(double val) const
Bool_toperator>(double val) const
Bool_toperator>=(double val) const
const double&operator[](Int_t index) const
double&operator[](Int_t index)
virtual voidTObject::Paint(Option_t* option = "")
virtual voidTObject::Pop()
virtual voidPrint(Option_t* option = "") constMENU
voidRandomize(double alpha, double beta, Double_t& seed)
virtual Int_tTObject::Read(const char* name)
virtual voidTObject::RecursiveRemove(TObject* obj)
voidTObject::ResetBit(UInt_t f)
TVectorT<double>&ResizeTo(Int_t n)
TVectorT<double>&ResizeTo(const TVectorT<double>& v)
TVectorT<double>&ResizeTo(Int_t lwb, Int_t upb)
virtual voidTObject::SaveAs(const char* filename = "", Option_t* option = "") constMENU
virtual voidTObject::SavePrimitive(basic_ostream<char,char_traits<char> >& out, Option_t* option = "")
TVectorT<double>&SelectNonZeros(const TVectorT<double>& select)
voidTObject::SetBit(UInt_t f)
voidTObject::SetBit(UInt_t f, Bool_t set)
virtual voidTObject::SetDrawOption(Option_t* option = "")MENU
static voidTObject::SetDtorOnly(void* obj)
voidSetElements(const double* elements)
static voidTObject::SetObjectStat(Bool_t stat)
TVectorT<double>&SetSub(Int_t row_lwb, const TVectorT<double>& source)
virtual voidTObject::SetUniqueID(UInt_t uid)
TVectorT<double>&Shift(Int_t row_shift)
virtual voidShowMembers(TMemberInspector& insp, char* parent)
Bool_tSomePositive(const TVectorT<double>& select)
TVectorT<double>&Sqr()
TVectorT<double>&Sqrt()
virtual voidStreamer(TBuffer& b)
voidStreamerNVirtual(TBuffer& b)
doubleSum() const
virtual voidTObject::SysError(const char* method, const char* msgfmt) const
Bool_tTObject::TestBit(UInt_t f) const
Int_tTObject::TestBits(UInt_t f) const
TVectorT<double>&Use(TVectorT<double>& v)
const TVectorT<double>&Use(const TVectorT<double>& v) const
TVectorT<double>&Use(Int_t n, double* data)
const TVectorT<double>&Use(Int_t n, const double* data) const
TVectorT<double>&Use(Int_t lwb, Int_t upb, double* data)
const TVectorT<double>&Use(Int_t lwb, Int_t upb, const double* data) const
virtual voidTObject::UseCurrentStyle()
virtual voidTObject::Warning(const char* method, const char* msgfmt) const
virtual Int_tTObject::Write(const char* name = 0, Int_t option = 0, Int_t bufsize = 0)
virtual Int_tTObject::Write(const char* name = 0, Int_t option = 0, Int_t bufsize = 0) const
TVectorT<double>&Zero()
protected:
voidAllocate(Int_t nrows, Int_t row_lwb = 0, Int_t init = 0)
voidDelete_m(Int_t size, double*&)
virtual voidTObject::DoError(int level, const char* location, const char* fmt, va_list va) const
voidTObject::MakeZombie()
Int_tMemcpy_m(double* newp, const double* oldp, Int_t copySize, Int_t newSize, Int_t oldSize)
double*New_m(Int_t size)

Data Members

public:
enum { kSizeMax
kWorkMax
};
enum EVectorStatusBits { kStatus
};
enum TObject::EStatusBits { kCanDelete
kMustCleanup
kObjInCanvas
kIsReferenced
kHasUUID
kCannotPick
kNoContextMenu
kInvalidObject
};
enum TObject::[unnamed] { kIsOnHeap
kNotDeleted
kZombie
kBitMask
kSingleKey
kOverwrite
kWriteDelete
};
protected:
doublefDataStack[5]! data container
double*fElements[fNrows] elements themselves
Bool_tfIsOwner!default kTRUE, when Use array kFALSE
Int_tfNrowsnumber of rows
Int_tfRowLwblower bound of the row index

Class Charts

Inheritance Inherited Members Includes Libraries
Class Charts

Function documentation

void TVectorT<Element> Delete_m(Int_t size, double*& )
 Delete data pointer m, if it was assigned on the heap
Element* TVectorT<Element> New_m(Int_t size)
 Return data pointer . if requested size <= kSizeMax, assign pointer
 to the stack space
void TVectorT<Element> Add(const TVectorT<double>& v)
 Add vector v to this vector
void TVectorT<Element> Add(const TVectorT<double>& v1, const TVectorT<double>& v2)
 Set this vector to v1+v2
Int_t TVectorT<Element> Memcpy_m(double* newp, const double* oldp, Int_t copySize, Int_t newSize, Int_t oldSize)
 Copy copySize doubles from *oldp to *newp . However take care of the
 situation where both pointers are assigned to the same stack space
void TVectorT<Element> Allocate(Int_t nrows, Int_t row_lwb = 0, Int_t init = 0)
 Allocate new vector. Arguments are number of rows and row
 lowerbound (0 default).
TVectorT<Element> &TVectorT<Element> ResizeTo(Int_t lwb, Int_t upb)
 Resize the vector to [lwb:upb] .
 New dynamic elemenst are created, the overlapping part of the old ones are
 copied to the new structures, then the old elements are deleleted.
TVectorT<Element> &TVectorT<Element> Use(Int_t lwb,Int_t upb,Element *data)
 Use the array data to fill the vector lwb..upb]
TVectorT<Element> &TVectorT<Element> GetSub(Int_t row_lwb, Int_t row_upb, TVectorT<double>& target, Option_t* option = "S") const
 Get subvector [row_lwb..row_upb]; The indexing range of the
 returned vector depends on the argument option:

 option == "S" : return [0..row_upb-row_lwb+1] (default)
 else          : return [row_lwb..row_upb]
TVectorT<Element> &TVectorT<Element> SetSub(Int_t row_lwb, const TVectorT<double>& source)
 Insert vector source starting at [row_lwb], thereby overwriting the part
 [row_lwb..row_lwb+nrows_source];
TVectorT<Element> &TVectorT<Element> Zero()
 Set vector elements to zero
TVectorT<Element> &TVectorT<Element> Abs()
 Take an absolute value of a vector, i.e. apply Abs() to each element.
TVectorT<Element> &TVectorT<Element> Sqr()
 Square each element of the vector.
TVectorT<Element> &TVectorT<Element> Sqrt()
 Take square root of all elements.
TVectorT<Element> &TVectorT<Element> Invert()
 v[i] = 1/v[i]
TVectorT<Element> &TVectorT<Element> SelectNonZeros(const TVectorT<double>& select)
 Keep only element as selected through array select non-zero
Element TVectorT<Element> Norm1() const
 Compute the 1-norm of the vector SUM{ |v[i]| }.
Element TVectorT<Element> Norm2Sqr() const
 Compute the square of the 2-norm SUM{ v[i]^2 }.
Element TVectorT<Element> NormInf() const
 Compute the infinity-norm of the vector MAX{ |v[i]| }.
Int_t TVectorT<Element> NonZeros() const
 Compute the number of elements != 0.0
Element TVectorT<Element> Sum() const
 Compute sum of elements
Element TVectorT<Element> Min() const
 return minimum vector element value
Element TVectorT<Element> Max() const
 return maximum vector element value
TVectorT<Element> &TVectorT<Element> operator=(const TVectorT<Element> &source)
 Notice that this assignment does NOT change the ownership :
 if the storage space was adopted, source is copied to
 this space .
TVectorT<Element> &TVectorT<Element> operator=(const TMatrixTRow_const<Element> &mr)
 Assign a matrix row to a vector.
TVectorT<Element> &TVectorT<Element> operator=(const TMatrixTColumn_const<Element> &mc)
 Assign a matrix column to a vector.
TVectorT<Element> &TVectorT<Element> operator=(const TMatrixTDiag_const<Element> &md)
 Assign the matrix diagonal to a vector.
TVectorT<Element> &TVectorT<Element> operator=(const TMatrixTSparseRow_const<Element> &mr)
 Assign a sparse matrix row to a vector. The matrix row is implicitly transposed
 to allow the assignment in the strict sense.
TVectorT<Element> &TVectorT<Element> operator=(const TMatrixTSparseDiag_const<Element> &md)
 Assign a sparse matrix diagonal to a vector.
TVectorT<Element> &TVectorT<Element> operator=(Element val)
 Assign val to every element of the vector.
TVectorT<Element> &TVectorT<Element> operator+=(Element val)
 Add val to every element of the vector.
TVectorT<Element> &TVectorT<Element> operator-=(Element val)
 Subtract val from every element of the vector.
TVectorT<Element> &TVectorT<Element> operator*=(Element val)
 Multiply every element of the vector with val.
TVectorT<Element> &TVectorT<Element> operator+=(const TVectorT<Element> &source)
 Add vector source
TVectorT<Element> &TVectorT<Element> operator-=(const TVectorT<Element> &source)
 Subtract vector source
TVectorT<Element> &TVectorT<Element> operator*=(const TMatrixT<Element> &a)
 "Inplace" multiplication target = A*target. A needn't be a square one
 If target has to be resized, it should own the storage: fIsOwner = kTRUE
TVectorT<Element> &TVectorT<Element> operator*=(const TMatrixTSparse<Element> &a)
 "Inplace" multiplication target = A*target. A needn't be a square one
 If target has to be resized, it should own the storage: fIsOwner = kTRUE
TVectorT<Element> &TVectorT<Element> operator*=(const TMatrixTSym<Element> &a)
 "Inplace" multiplication target = A*target. A is symmetric .
 vector size will not change
Bool_t TVectorT<Element> operator==(double val) const
 Are all vector elements equal to val?
Bool_t TVectorT<Element> operator!=(double val) const
 Are all vector elements not equal to val?
Bool_t TVectorT<Element> operator<(double val) const
 Are all vector elements < val?
Bool_t TVectorT<Element> operator<=(double val) const
 Are all vector elements <= val?
Bool_t TVectorT<Element> operator>(double val) const
 Are all vector elements > val?
Bool_t TVectorT<Element> operator>=(double val) const
 Are all vector elements >= val?
Bool_t TVectorT<Element> MatchesNonZeroPattern(const TVectorT<double>& select)
 Check if vector elements as selected through array select are non-zero
Bool_t TVectorT<Element> SomePositive(const TVectorT<double>& select)
 Check if vector elements as selected through array select are all positive
void TVectorT<Element> AddSomeConstant(double val, const TVectorT<double>& select)
 Add to vector elements as selected through array select the value val
void TVectorT<Element> Randomize(double alpha, double beta, Double_t& seed)
 randomize vector elements value
TVectorT<Element> &TVectorT<Element> Apply(const TElementActionT<Element> &action)
 Apply action to each element of the vector.
TVectorT<Element> &TVectorT<Element> Apply(const TElementPosActionT<Element> &action)
 Apply action to each element of the vector. In action the location
 of the current element is known.
void TVectorT<Element> Draw(Option_t* option = "")
 Draw this vector
 The histogram is named "TVectorT" by default and no title
void TVectorT<Element> Print(Option_t* option = "") const
 Print the vector as a list of elements.
void TVectorT<Element> Streamer(TBuffer& b)
 Stream an object of class TVectorT.
template<class Element> inline TVectorT<Element> &TVectorT<Element> Use(Int_t n,Element *data)
{ return Use(0,n-1,data); }
template<class Element> inline const TVectorT<Element> &TVectorT<Element> Use(Int_t n,const Element *data)
{ return Use(0,n-1,data); }
template<class Element> inline TVectorT<Element> &TVectorT<Element> Use(TVectorT &v)
template<class Element> inline const TVectorT<Element> &TVectorT<Element> Use(const TVectorT &v)
template<class Element> inline TVectorT<Element> TVectorT<Element> GetSub(Int_t row_lwb, Int_t row_upb, Option_t* option = "S") const
template<class Element> inline const Element &TVectorT<Element> operator()(Int_t ind)
 Access a vector element.
template<class Element> inline Element &TVectorT<Element> operator()(Int_t ind)
 Access a vector element.
Int_t GetLwb() const
{ return fRowLwb; }
Int_t GetUpb() const
{ return fNrows+fRowLwb-1; }
Int_t GetNrows() const
{ return fNrows; }
Int_t GetNoElements() const
{ return fNrows; }
Element * GetMatrixArray()
{ return fElements; }
const Element * GetMatrixArray()
{ return fElements; }
void Invalidate()
void MakeValid()
Bool_t IsValid() const
{ return !TestBit(kStatus); }
Bool_t IsOwner() const
{ return fIsOwner; }
void SetElements(const double* elements)
TVectorT<Element> & Shift(Int_t row_shift)
{ fRowLwb += row_shift; return *this; }
TVectorT<Element> & ResizeTo(Int_t lwb, Int_t upb)
TVectorT<Element> & ResizeTo(Int_t n)
{ return ResizeTo(0,n-1); }
TVectorT<Element> & Use(Int_t lwb,Int_t upb,Element *data)
const Element & operator[](Int_t index)
{ return (*this)(index); }
Element & operator[](Int_t index)
{ return (*this)(index); }
void Clear(Option_t* = "")