Uses MtxExpr, Statistics; procedure Example; var Data, PC: Matrix; Variances, ZS: Vector; begin Data.SetIt(2,4,false,[1,3,5,2, 2,5,7,9]); Covariance(data,covMat,false); PCA(covMat,PC,ZS,Variances); //requires cov matrix // Z = [29 , 0, 0 ,0 ] //variance = [100, 0, 0 ,0 ] end;
#include "MtxExpr.hpp" #include "Statistics.hpp" void __fastcall Example() { sMatrix data, PC, covMat; sVector Z,variances; data.SetIt(2,4,false,OPENARRAY(double,(1,3,5,2, 2,5,7,9))); Covariance(data,covMat,false); PCA(covMat,PC,Z,variances); //requires cov matrix // Z = [29 , 0, 0 ,0 ] //variance = [100, 0, 0 ,0 ] }
Copyright (c) 1999-2024 by Dew Research. All rights reserved.
|