library: libMatrix #include "TVectorD.h"

# TVectorD

class description - source file - inheritance tree (.pdf)

## class TVectorD : public TObject

| Inheritance Chart:
`TObject`
| <- | `TVectorD` |

        protected:

               void Allocate(Int_t nrows, Int_t row_lwb = 0, Int_t init = 0)
               void Delete_m(Int_t size, Double_t*&)
              Int_t Memcpy_m(Double_t* newp, const Double_t* oldp, Int_t copySize, Int_t newSize, Int_t oldSize)
          Double_t* New_m(Int_t size)

        public:

                          TVectorD()
                          TVectorD(Int_t n)
                          TVectorD(Int_t lwb, Int_t upb)
                          TVectorD(Int_t n, const Double_t* elements)
                          TVectorD(Int_t lwb, Int_t upb, const Double_t* elements)
                          TVectorD(const TVectorD& another)
                          TVectorD(const TVectorF& another)
                          TVectorD(const TMatrixDRow_const& mr)
                          TVectorD(const TMatrixDColumn_const& mc)
                          TVectorD(const TMatrixDDiag_const& md)
                 TVectorD GetSub(Int_t row_lwb, Int_t row_upb, Option_t* option = "S") const
                  virtual ~TVectorD()
                TVectorD& Abs()
                     void AddSomeConstant(Double_t val, const TVectorD& select)
                TVectorD& Apply(const TElementActionD& action)
                TVectorD& Apply(const TElementPosActionD& action)
           static TClass* Class()
             virtual void Clear(Option_t* = "")
             virtual void Draw(Option_t* option = "")
                    Int_t GetLwb() const
                Double_t* GetMatrixArray()
          const Double_t* GetMatrixArray() const
                    Int_t GetNoElements() const
                    Int_t GetNrows() const
                TVectorD& GetSub(Int_t row_lwb, Int_t row_upb, TVectorD& target, Option_t* option = "S") const
                    Int_t GetUpb() const
                     void Invalidate()
                TVectorD& Invert()
          virtual TClass* IsA() const
                   Bool_t IsOwner() const
                   Bool_t IsValid() const
                     void MakeValid()
                   Bool_t MatchesNonZeroPattern(const TVectorD& select)
                 Double_t Max() const
                 Double_t Min() const
                    Int_t NonZeros() const
                 Double_t Norm1() const
                 Double_t Norm2Sqr() const
                 Double_t NormInf() const
                   Bool_t operator!=(Double_t val) const
          const Double_t& operator()(Int_t index) const
                Double_t& operator()(Int_t index)
                TVectorD& operator*=(Double_t val)
                TVectorD& operator*=(const TMatrixD& a)
                TVectorD& operator*=(const TMatrixDSym& a)
                TVectorD& operator*=(const TMatrixDSparse& a)
                TVectorD& operator+=(Double_t val)
                TVectorD& operator+=(const TVectorD& source)
                TVectorD& operator-=(Double_t val)
                TVectorD& operator-=(const TVectorD& source)
                   Bool_t operator<(Double_t val) const
                   Bool_t operator<=(Double_t val) const
                TVectorD& operator=(const TVectorD& source)
                TVectorD& operator=(const TVectorF& source)
                TVectorD& operator=(const TMatrixDRow_const& mr)
                TVectorD& operator=(const TMatrixDColumn_const& mc)
                TVectorD& operator=(const TMatrixDDiag_const& md)
                TVectorD& operator=(const TMatrixDSparseRow_const& md)
                TVectorD& operator=(const TMatrixDSparseDiag_const& md)
                TVectorD& operator=(Double_t val)
                   Bool_t operator==(Double_t val) const
                   Bool_t operator>(Double_t val) const
                   Bool_t operator>=(Double_t val) const
          const Double_t& operator[](Int_t index) const
                Double_t& operator[](Int_t index)
             virtual void Print(Option_t* option = "") const
                     void Randomize(Double_t alpha, Double_t beta, Double_t& seed)
                TVectorD& ResizeTo(Int_t lwb, Int_t upb)
                TVectorD& ResizeTo(Int_t n)
                TVectorD& ResizeTo(const TVectorD& v)
                TVectorD& SelectNonZeros(const TVectorD& select)
                     void SetElements(const Double_t* elements)
                TVectorD& SetSub(Int_t row_lwb, const TVectorD& source)
                TVectorD& Shift(Int_t row_shift)
             virtual void ShowMembers(TMemberInspector& insp, char* parent)
                   Bool_t SomePositive(const TVectorD& select)
                TVectorD& Sqr()
                TVectorD& Sqrt()
             virtual void Streamer(TBuffer& b)
                     void StreamerNVirtual(TBuffer& b)
                 Double_t Sum() const
                TVectorD& Use(Int_t n, Double_t* data)
                TVectorD& Use(Int_t lwb, Int_t upb, Double_t* data)
                TVectorD& Use(TVectorD& v)
                TVectorD& Zero()

### Data Members

        protected:

              Int_t fNrows         number of rows
              Int_t fRowLwb        lower bound of the row index
          Double_t* fElements      [fNrows] elements themselves
           Double_t fDataStack[5]  ! data container
             Bool_t fIsOwner       !default kTRUE, when Use array kFALSE

        public:

          static const enum TVectorD:: kSizeMax
          static const enum TVectorD:: kWorkMax

## Class Description

     TVectorD

     Implementation 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 stress_linalg.cxx file .

     Note that Constructors/assignments exists for all different matrix
     views

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

void Delete_m(Int_t size,Double_t *&m)

Double_t* New_m(Int_t size)

Int_t Memcpy_m(Double_t *newp,const Double_t *oldp,Int_t copySize, Int_t newSize,Int_t oldSize)

void Allocate(Int_t nrows,Int_t row_lwb,Int_t init)

     Allocate new vector. Arguments are number of rows and row
     lowerbound (0 default).

TVectorD(Int_t n)

TVectorD(Int_t lwb,Int_t upb)

TVectorD(Int_t n,const Double_t *elements)

TVectorD(Int_t lwb,Int_t upb,const Double_t *elements)

TVectorD(const TVectorD &another) : TObject(another)

TVectorD(const TVectorF &another) : TObject(another)

TVectorD(const TMatrixDRow_const &mr) : TObject()

TVectorD(const TMatrixDColumn_const &mc) : TObject()

TVectorD(const TMatrixDDiag_const &md) : TObject()

TVectorD(Int_t lwb,Int_t upb,Double_t va_(iv1), ...)

     Make a vector and assign initial values. Argument list should contain
     Double_t values to assign to vector elements. The list must be
     terminated by the string "END". Example:
     TVectorD foo(1,3,0.0,1.0,1.5,"END");

TVectorD& 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.

TVectorD& Use(Int_t lwb,Int_t upb,Double_t *data)

TVectorD& GetSub(Int_t row_lwb,Int_t row_upb,TVectorD &target,Option_t *option) 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]

TVectorD& SetSub(Int_t row_lwb,const TVectorD &source)

     Insert vector source starting at [row_lwb], thereby overwriting the part
     [row_lwb..row_lwb+nrows_source];

TVectorD& Zero()

TVectorD& Abs()

     Take an absolute value of a vector, i.e. apply Abs() to each element.

TVectorD& Sqr()

     Square each element of the vector.

TVectorD& Sqrt()

     Take square root of all elements.

TVectorD& Invert()

     v[i] = 1/v[i]

TVectorD& SelectNonZeros(const TVectorD &select)

Double_t Norm1() const

     Compute the 1-norm of the vector SUM{ |v[i]| }.

Double_t Norm2Sqr() const

     Compute the square of the 2-norm SUM{ v[i]^2 }.

Double_t NormInf() const

     Compute the infinity-norm of the vector MAX{ |v[i]| }.

Int_t NonZeros() const

     Compute the number of elements != 0.0

Double_t Sum() const

     Compute sum of elements

Double_t Min() const

     return minimum vector element value

Double_t Max() const

     return maximum vector element value

Bool_t MatchesNonZeroPattern(const TVectorD &select)

Bool_t SomePositive(const TVectorD &select)

void AddSomeConstant(Double_t val,const TVectorD &select)

void Randomize(Double_t alpha,Double_t beta,Double_t &seed)

     randomize vector elements value

TVectorD& Apply(const TElementActionD &action)

     Apply action to each element of the vector.

TVectorD& Apply(const TElementPosActionD &action)

     Apply action to each element of the vector. In action the location
     of the current element is known.

void Draw(Option_t *option)

     Draw this vector using an intermediate histogram
     The histogram is named "TVectorD" by default and no title

void Print(Option_t *flag) const

     Print the vector as a list of elements.

void Streamer(TBuffer &R__b)

     Stream an object of class TVectorD.

### Inline Functions

                       void ~TVectorD()
                      Int_t GetLwb() const
                      Int_t GetUpb() const
                      Int_t GetNrows() const
                      Int_t GetNoElements() const
                  Double_t* GetMatrixArray()
            const Double_t* GetMatrixArray() const
                       void Invalidate()
                       void MakeValid()
                     Bool_t IsValid() const
                     Bool_t IsOwner() const
                       void SetElements(const Double_t* elements)
                  TVectorD& Shift(Int_t row_shift)
                  TVectorD& ResizeTo(Int_t n)
                  TVectorD& ResizeTo(const TVectorD& v)
                  TVectorD& Use(Int_t lwb, Int_t upb, Double_t* data)
                  TVectorD& Use(TVectorD& v)
                   TVectorD GetSub(Int_t row_lwb, Int_t row_upb, Option_t* option = "S") const
            const Double_t& operator()(Int_t index) const
                  Double_t& operator()(Int_t index)
            const Double_t& operator[](Int_t index) const
                  Double_t& operator[](Int_t index)
                  TVectorD& operator=(const TVectorD& source)
                  TVectorD& operator=(const TVectorF& source)
                  TVectorD& operator=(const TMatrixDRow_const& mr)
                  TVectorD& operator=(const TMatrixDColumn_const& mc)
                  TVectorD& operator=(const TMatrixDDiag_const& md)
                  TVectorD& operator=(const TMatrixDSparseRow_const& md)
                  TVectorD& operator=(const TMatrixDSparseDiag_const& md)
                  TVectorD& operator=(Double_t val)
                  TVectorD& operator+=(Double_t val)
                  TVectorD& operator-=(Double_t val)
                  TVectorD& operator*=(Double_t val)
                  TVectorD& operator+=(const TVectorD& source)
                  TVectorD& operator-=(const TVectorD& source)
                  TVectorD& operator*=(const TMatrixD& a)
                  TVectorD& operator*=(const TMatrixDSym& a)
                  TVectorD& operator*=(const TMatrixDSparse& a)
                     Bool_t operator==(Double_t val) const
                     Bool_t operator!=(Double_t val) const
                     Bool_t operator<(Double_t val) const
                     Bool_t operator<=(Double_t val) const
                     Bool_t operator>(Double_t val) const
                     Bool_t operator>=(Double_t val) const
                       void Clear(Option_t* = "")
                    TClass* Class()
                    TClass* IsA() const
                       void ShowMembers(TMemberInspector& insp, char* parent)
                       void StreamerNVirtual(TBuffer& b)

Last update: root/matrix:$Name: $:$Id: TVectorD.cxx,v 1.56 2005/06/03 12:30:22 brun Exp $
Copyright (C) 1995-2000, Rene Brun and Fons Rademakers. *