Back to home page

EIC code displayed by LXR

 
 

    


Warning, file /include/root/TPrincipal.h was not indexed or was modified since last indexation (in which case cross-reference links may be missing, inaccurate or erroneous).

0001 // @(#)root/hist:$Id$
0002 // Author: Christian Holm Christensen    1/8/2000
0003 
0004 /*************************************************************************
0005  * Copyright (C) 1995-2004, Rene Brun and Fons Rademakers.               *
0006  * All rights reserved.                                                  *
0007  *                                                                       *
0008  * For the licensing terms see $ROOTSYS/LICENSE.                         *
0009  * For the list of contributors see $ROOTSYS/README/CREDITS.             *
0010  *************************************************************************/
0011 
0012 #ifndef ROOT_TPrincipal
0013 #define ROOT_TPrincipal
0014 
0015 #include "TNamed.h"
0016 #include "TVectorD.h"
0017 #include "TMatrixD.h"
0018 
0019 class TList;
0020 
0021 class TPrincipal : public TNamed {
0022 
0023 protected:
0024    Int_t       fNumberOfDataPoints;   ///< Number of data points
0025    Int_t       fNumberOfVariables;    ///< Number of variables
0026 
0027    TVectorD    fMeanValues;           ///< Mean value over all data points
0028    TVectorD    fSigmas;               ///< vector of sigmas
0029    TMatrixD    fCovarianceMatrix;     ///< Covariance matrix
0030 
0031    TMatrixD    fEigenVectors;         ///< Eigenvector matrix of trans
0032    TVectorD    fEigenValues;          ///< Eigenvalue vector of trans
0033 
0034    TVectorD    fOffDiagonal;          ///< Elements of the tridiagonal
0035 
0036    TVectorD    fUserData;             ///< Vector of original data points
0037 
0038    Double_t    fTrace;                ///< Trace of covarience matrix
0039 
0040    TList      *fHistograms;           ///< List of histograms
0041 
0042    Bool_t      fIsNormalised;         ///< Normalize matrix?
0043    Bool_t      fStoreData;            ///< Should we store input data?
0044 
0045    TPrincipal(const TPrincipal&);
0046    TPrincipal& operator=(const TPrincipal&);
0047 
0048    void        MakeNormalised();
0049    void        MakeRealCode(const char *filename, const char *prefix, Option_t *option="");
0050 
0051 public:
0052    TPrincipal();
0053    ~TPrincipal() override;
0054    TPrincipal(Long64_t nVariables, Option_t *opt="ND");
0055 
0056    virtual void       AddRow(const Double_t *x);
0057    void       Browse(TBrowser *b) override;
0058    void       Clear(Option_t *option="") override;
0059    /// Return the covariance matrix. \note Only the lower diagonal of the covariance matrix is computed by the class
0060    const TMatrixD    *GetCovarianceMatrix() const {return &fCovarianceMatrix;}
0061    const TVectorD    *GetEigenValues() const      {return &fEigenValues;}
0062    const TMatrixD    *GetEigenVectors() const     {return &fEigenVectors;}
0063    TList             *GetHistograms() const {return fHistograms;}
0064    const TVectorD    *GetMeanValues() const       {return &fMeanValues;}
0065    const Double_t    *GetRow(Long64_t row);
0066    const TVectorD    *GetSigmas() const           {return &fSigmas;}
0067    const TVectorD    *GetUserData() const         {return &fUserData;}
0068    Bool_t             IsFolder() const override { return kTRUE;}
0069    virtual void       MakeCode(const char *filename ="pca", Option_t *option="");  // *MENU*
0070    virtual void       MakeHistograms(const char *name = "pca", Option_t *option="epsdx"); // *MENU*
0071    virtual void       MakeMethods(const char *classname = "PCA", Option_t *option=""); // *MENU*
0072    virtual void       MakePrincipals();            // *MENU*
0073    virtual void       P2X(const Double_t *p, Double_t *x, Int_t nTest);
0074    void       Print(Option_t *opt="MSE") const override;         // *MENU*
0075    virtual void       SumOfSquareResiduals(const Double_t *x, Double_t *s);
0076    void               Test(Option_t *option="");       // *MENU*
0077    virtual void       X2P(const Double_t *x, Double_t *p);
0078 
0079    ClassDefOverride(TPrincipal,2) // Principal Components Analysis
0080 }
0081 ;
0082 
0083 #endif