PCA.h 2.4 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273
  1. #ifndef _PCA_h_
  2. #define _PCA_h_
  3. /* PCA.h
  4. *
  5. * Principal Component Analysis
  6. *
  7. * Copyright (C) 1993-2012, 2015-2018 David Weenink
  8. *
  9. * This code is free software; you can redistribute it and/or modify
  10. * it under the terms of the GNU General Public License as published by
  11. * the Free Software Foundation; either version 2 of the License, or (at
  12. * your option) any later version.
  13. *
  14. * This code is distributed in the hope that it will be useful, but
  15. * WITHOUT ANY WARRANTY; without even the implied warranty of
  16. * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
  17. * General Public License for more details.
  18. *
  19. * You should have received a copy of the GNU General Public License
  20. * along with this work. If not, see <http://www.gnu.org/licenses/>.
  21. */
  22. /*
  23. djmw 20020813 GPL header
  24. djmw 20110306 Latest modification.
  25. */
  26. #include "Matrix.h"
  27. #include "TableOfReal.h"
  28. #include "Configuration.h"
  29. #include "Eigen.h"
  30. #include "PCA_def.h"
  31. autoPCA PCA_create (integer numberOfComponents, integer dimension);
  32. void PCA_setNumberOfObservations (PCA me, integer numberOfObservations);
  33. integer PCA_getNumberOfObservations (PCA me);
  34. autoPCA TableOfReal_to_PCA_byRows (TableOfReal me);
  35. autoEigen PCA_to_Eigen (PCA me);
  36. /* Calculate PCA of M'M */
  37. autoPCA Matrix_to_PCA_byRows (Matrix me);
  38. autoPCA Matrix_to_PCA_byColumns (Matrix me);
  39. /* Calculate PCA of M'M */
  40. void PCA_getEqualityOfEigenvalues (PCA me, integer from, integer to, int conservative, double *p_prob, double *p_chisq, double *p_df);
  41. /* Morrison, Multivariate statistical methods, page 336 */
  42. autoTableOfReal PCA_TableOfReal_to_TableOfReal_projectRows (PCA me, TableOfReal thee, integer numberOfDimensionsToKeep);
  43. autoConfiguration PCA_TableOfReal_to_Configuration (PCA me, TableOfReal thee, integer numberOfDimensions);
  44. autoTableOfReal PCA_TableOfReal_to_TableOfReal_zscores (PCA me, TableOfReal thee, integer numberOfDimensions);
  45. double PCA_TableOfReal_getFractionVariance (PCA me, TableOfReal thee, integer from, integer to);
  46. /* Get fraction variance of the table projected in the pca-space.
  47. Shorthand for projecting the Covariance of the TableOfReal on the PCA-space
  48. and quering the projected Covariance for 'fraction variance'.
  49. */
  50. autoTableOfReal PCA_Configuration_to_TableOfReal_reconstruct (PCA me, Configuration thee);
  51. /* Reconstruct the original TableOfReal from the PCA and the Configuration */
  52. autoTableOfReal PCA_to_TableOfReal_reconstruct1 (PCA me, conststring32 numstring);
  53. #endif /* _PCA_h_ */