TPrincipal.h

Go to the documentation of this file.
00001 // @(#)root/hist:$Id: TPrincipal.h 20882 2007-11-19 11:31:26Z rdm $
00002 // Author: Christian Holm Christensen    1/8/2000
00003 
00004 /*************************************************************************
00005  * Copyright (C) 1995-2004, Rene Brun and Fons Rademakers.               *
00006  * All rights reserved.                                                  *
00007  *                                                                       *
00008  * For the licensing terms see $ROOTSYS/LICENSE.                         *
00009  * For the list of contributors see $ROOTSYS/README/CREDITS.             *
00010  *************************************************************************/
00011 
00012 #ifndef ROOT_TPrincipal
00013 #define ROOT_TPrincipal
00014 
00015 #ifndef ROOT_TNamed
00016 #include "TNamed.h"
00017 #endif
00018 #ifndef ROOT_TVectorD
00019 #include "TVectorD.h"
00020 #endif
00021 #ifndef ROOT_TMatrixD
00022 #include "TMatrixD.h"
00023 #endif
00024 #ifndef ROOT_TList
00025 #include "TList.h"
00026 #endif
00027 
00028 class TPrincipal : public TNamed {
00029 
00030 protected:
00031    Int_t       fNumberOfDataPoints;   // Number of data points
00032    Int_t       fNumberOfVariables;    // Number of variables
00033 
00034    TVectorD    fMeanValues;           // Mean value over all data points
00035    TVectorD    fSigmas;               // vector of sigmas
00036    TMatrixD    fCovarianceMatrix;     // Covariance matrix
00037 
00038    TMatrixD    fEigenVectors;         // Eigenvector matrix of trans
00039    TVectorD    fEigenValues;          // Eigenvalue vector of trans
00040 
00041    TVectorD    fOffDiagonal;          // elements of the tridiagonal
00042 
00043    TVectorD    fUserData;             // Vector of original data points
00044 
00045    Double_t    fTrace;                // Trace of covarience matrix
00046 
00047    TList      *fHistograms;           // List of histograms
00048 
00049    Bool_t      fIsNormalised;         // Normalize matrix?
00050    Bool_t      fStoreData;            // Should we store input data?
00051 
00052    TPrincipal(const TPrincipal&);
00053    TPrincipal& operator=(const TPrincipal&);
00054 
00055    void        MakeNormalised();
00056    void        MakeRealCode(const char *filename, const char *prefix, Option_t *option="");
00057 
00058 public:
00059    TPrincipal();
00060    virtual ~TPrincipal();
00061    TPrincipal(Int_t nVariables, Option_t *opt="ND");
00062 
00063    virtual void       AddRow(const Double_t *x);
00064    virtual void       Browse(TBrowser *b);
00065    virtual void       Clear(Option_t *option="");
00066    const TMatrixD    *GetCovarianceMatrix() const {return &fCovarianceMatrix;}
00067    const TVectorD    *GetEigenValues() const      {return &fEigenValues;}
00068    const TMatrixD    *GetEigenVectors() const     {return &fEigenVectors;}
00069    TList             *GetHistograms() const {return fHistograms;}
00070    const TVectorD    *GetMeanValues() const       {return &fMeanValues;}
00071    const Double_t    *GetRow(Int_t row);
00072    const TVectorD    *GetSigmas() const           {return &fSigmas;}
00073    const TVectorD    *GetUserData() const         {return &fUserData;}
00074    Bool_t             IsFolder() const { return kTRUE;}
00075    virtual void       MakeCode(const char *filename ="pca", Option_t *option="");  // *MENU*
00076    virtual void       MakeHistograms(const char *name = "pca", Option_t *option="epsdx"); // *MENU*
00077    virtual void       MakeMethods(const char *classname = "PCA", Option_t *option=""); // *MENU*
00078    virtual void       MakePrincipals();            // *MENU*
00079    virtual void       P2X(const Double_t *p, Double_t *x, Int_t nTest);
00080    virtual void       Print(Option_t *opt="MSE") const;         // *MENU*
00081    virtual void       SumOfSquareResiduals(const Double_t *x, Double_t *s);
00082    void               Test(Option_t *option="");       // *MENU*
00083    virtual void       X2P(const Double_t *x, Double_t *p);
00084 
00085    ClassDef(TPrincipal,2) // Principal Components Analysis
00086 }
00087 ;
00088 
00089 #endif

Generated on Tue Jul 5 14:22:57 2011 for ROOT_528-00b_version by  doxygen 1.5.1