library: libMatrix #include "TVectorF.h"

# TVectorF

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

## class TVectorF : public TObject

| Inheritance Chart:
`TObject`
| <- | `TVectorF` |
<- |
`TVector` |

        protected:

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

        public:

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

### Data Members

        protected:

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

        public:

          static const enum TVectorF:: kSizeMax
          static const enum TVectorF:: kWorkMax

## Class Description

     TVectorF

     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,Float_t *&m)

Float_t* New_m(Int_t size)

Int_t Memcpy_m(Float_t *newp,const Float_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).

TVectorF(Int_t n)

TVectorF(Int_t lwb,Int_t upb)

TVectorF(Int_t n,const Float_t *elements)

TVectorF(Int_t lwb,Int_t upb,const Float_t *elements)

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

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

TVectorF(const TMatrixFRow_const &mr) : TObject()

TVectorF(const TMatrixFColumn_const &mc) : TObject()

TVectorF(const TMatrixFDiag_const &md) : TObject()

TVectorF(Int_t lwb,Int_t upb,Float_t va_(iv1), ...)

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

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

TVectorF& Use(Int_t lwb,Int_t upb,Float_t *data)

TVectorF& GetSub(Int_t row_lwb,Int_t row_upb,TVectorF &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]

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

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

TVectorF& Zero()

TVectorF& Abs()

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

TVectorF& Sqr()

     Square each element of the vector.

TVectorF& Sqrt()

     Take square root of all elements.

TVectorF& Invert()

     v[i] = 1/v[i]

TVectorF& SelectNonZeros(const TVectorF &select)

Float_t Norm1() const

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

Float_t Norm2Sqr() const

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

Float_t NormInf() const

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

Int_t NonZeros() const

     Compute the number of elements != 0.0

Float_t Sum() const

     Compute sum of elements

Float_t Min() const

     return minimum vector element value

Float_t Max() const

     return maximum vector element value

Bool_t MatchesNonZeroPattern(const TVectorF &select)

Bool_t SomePositive(const TVectorF &select)

void AddSomeConstant(Float_t val,const TVectorF &select)

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

     randomize vector elements value

TVectorF& Apply(const TElementActionF &action)

     Apply action to each element of the vector.

TVectorF& Apply(const TElementPosActionF &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 "TVectorF" 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 TVectorF.

### Inline Functions

                      void ~TVectorF()
                     Int_t GetLwb() const
                     Int_t GetUpb() const
                     Int_t GetNrows() const
                     Int_t GetNoElements() const
                  Float_t* GetMatrixArray()
            const Float_t* GetMatrixArray() const
                      void Invalidate()
                      void MakeValid()
                    Bool_t IsValid() const
                    Bool_t IsOwner() const
                      void SetElements(const Float_t* elements)
                 TVectorF& Shift(Int_t row_shift)
                 TVectorF& ResizeTo(Int_t n)
                 TVectorF& ResizeTo(const TVectorF& v)
                 TVectorF& Use(Int_t lwb, Int_t upb, Float_t* data)
                 TVectorF& Use(TVectorF& v)
                  TVectorF GetSub(Int_t row_lwb, Int_t row_upb, Option_t* option = "S") const
            const Float_t& operator()(Int_t index) const
                  Float_t& operator()(Int_t index)
            const Float_t& operator[](Int_t index) const
                  Float_t& operator[](Int_t index)
                 TVectorF& operator=(const TVectorF& source)
                 TVectorF& operator=(const TVectorD& source)
                 TVectorF& operator=(const TMatrixFRow_const& mr)
                 TVectorF& operator=(const TMatrixFColumn_const& mc)
                 TVectorF& operator=(const TMatrixFDiag_const& md)
                 TVectorF& operator=(Float_t val)
                 TVectorF& operator+=(Float_t val)
                 TVectorF& operator-=(Float_t val)
                 TVectorF& operator*=(Float_t val)
                 TVectorF& operator+=(const TVectorF& source)
                 TVectorF& operator-=(const TVectorF& source)
                 TVectorF& operator*=(const TMatrixF& a)
                 TVectorF& operator*=(const TMatrixFSym& a)
                    Bool_t operator==(Float_t val) const
                    Bool_t operator!=(Float_t val) const
                    Bool_t operator<(Float_t val) const
                    Bool_t operator<=(Float_t val) const
                    Bool_t operator>(Float_t val) const
                    Bool_t operator>=(Float_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: TVectorF.cxx,v 1.29 2005/06/03 12:30:22 brun Exp $
Copyright (C) 1995-2000, Rene Brun and Fons Rademakers. *