testcov.cpp

Go to the documentation of this file.
00001 #include "Cov.h"
00002 #include "statutils.h"
00003 #include "UniformRNG.h"
00004 #include <boost/numeric/ublas/io.hpp>
00005 #include <iostream>
00006 #include <fstream>
00007 #include <itpp/base/fastica.h>
00008 #include <itpp/base/mat.h>
00009 #include <itpp/base/sigfun.h>
00010 int main()
00011 {
00012         UniformRNG Random;
00013         const size_t nobs = 300;
00014         const size_t nchan = 2;
00015         rmat input(nchan,nobs);
00016         itpp::mat ittpInput(nobs,nchan);
00017     for (size_t i = 0; i < nobs; ++i)
00018         for (size_t j = 0; j < nchan; ++j)
00019         {
00020                 input(j,i) = Random.GetNumber();
00021                 ittpInput(i,j) = input(j,i);
00022         }
00023    for (size_t j = 0; j < nchan; ++j)
00024         SubMean(row(input,j).begin(),row(input,j).end());
00025         rmat covariance(nchan,nchan);
00026         covariance = Cov(input);
00027         std::cout << "Input: " << input << std::endl;
00028         std::cout << "Cov: " << covariance << std::endl;
00029         std::cout << "Var 1: " << Variance(row(input,0).begin(),row(input,0).end()) << std::endl;
00030         std::cout << "Var 2: " << Variance(row(input,1).begin(),row(input,1).end())<< std::endl;
00031         std::cout << "Itpp: " << cov(ittpInput,false) << std::endl;
00032         
00033 }

Generated on Mon Sep 15 12:54:34 2008 for GPLIB++ by  doxygen 1.5.5