Logo ROOT   6.30.04
Reference Guide
 All Namespaces Files Pages
TPrincipal.h
Go to the documentation of this file.
1 // @(#)root/hist:$Id$
2 // Author: Christian Holm Christensen 1/8/2000
3 
4 /*************************************************************************
5  * Copyright (C) 1995-2004, Rene Brun and Fons Rademakers. *
6  * All rights reserved. *
7  * *
8  * For the licensing terms see $ROOTSYS/LICENSE. *
9  * For the list of contributors see $ROOTSYS/README/CREDITS. *
10  *************************************************************************/
11 
12 #ifndef ROOT_TPrincipal
13 #define ROOT_TPrincipal
14 
15 #include "TNamed.h"
16 #include "TVectorD.h"
17 #include "TMatrixD.h"
18 #include "TList.h"
19 
20 class TPrincipal : public TNamed {
21 
22 protected:
23  Int_t fNumberOfDataPoints; // Number of data points
24  Int_t fNumberOfVariables; // Number of variables
25 
26  TVectorD fMeanValues; // Mean value over all data points
27  TVectorD fSigmas; // vector of sigmas
28  TMatrixD fCovarianceMatrix; // Covariance matrix
29 
30  TMatrixD fEigenVectors; // Eigenvector matrix of trans
31  TVectorD fEigenValues; // Eigenvalue vector of trans
32 
33  TVectorD fOffDiagonal; // elements of the tridiagonal
34 
35  TVectorD fUserData; // Vector of original data points
36 
37  Double_t fTrace; // Trace of covarience matrix
38 
39  TList *fHistograms; // List of histograms
40 
41  Bool_t fIsNormalised; // Normalize matrix?
42  Bool_t fStoreData; // Should we store input data?
43 
44  TPrincipal(const TPrincipal&);
45  TPrincipal& operator=(const TPrincipal&);
46 
47  void MakeNormalised();
48  void MakeRealCode(const char *filename, const char *prefix, Option_t *option="");
49 
50 public:
51  TPrincipal();
52  virtual ~TPrincipal();
53  TPrincipal(Int_t nVariables, Option_t *opt="ND");
54 
55  virtual void AddRow(const Double_t *x);
56  virtual void Browse(TBrowser *b);
57  virtual void Clear(Option_t *option="");
58  const TMatrixD *GetCovarianceMatrix() const {return &fCovarianceMatrix;}
59  const TVectorD *GetEigenValues() const {return &fEigenValues;}
60  const TMatrixD *GetEigenVectors() const {return &fEigenVectors;}
61  TList *GetHistograms() const {return fHistograms;}
62  const TVectorD *GetMeanValues() const {return &fMeanValues;}
63  const Double_t *GetRow(Int_t row);
64  const TVectorD *GetSigmas() const {return &fSigmas;}
65  const TVectorD *GetUserData() const {return &fUserData;}
66  Bool_t IsFolder() const { return kTRUE;}
67  virtual void MakeCode(const char *filename ="pca", Option_t *option=""); // *MENU*
68  virtual void MakeHistograms(const char *name = "pca", Option_t *option="epsdx"); // *MENU*
69  virtual void MakeMethods(const char *classname = "PCA", Option_t *option=""); // *MENU*
70  virtual void MakePrincipals(); // *MENU*
71  virtual void P2X(const Double_t *p, Double_t *x, Int_t nTest);
72  virtual void Print(Option_t *opt="MSE") const; // *MENU*
73  virtual void SumOfSquareResiduals(const Double_t *x, Double_t *s);
74  void Test(Option_t *option=""); // *MENU*
75  virtual void X2P(const Double_t *x, Double_t *p);
76 
77  ClassDef(TPrincipal,2) // Principal Components Analysis
78 }
79 ;
80 
81 #endif