KHL.h
Go to the documentation of this file.00001 #ifndef KHL_H_
00002 #define KHL_H_
00003
00004 #include "miscfunc.h"
00005 #include "VecMat.h"
00006 #include <iostream>
00007
00008 namespace ublas = boost::numeric::ublas;
00009
00010 namespace gplib
00011 {
00012 void KHLExpand(const rvec &input, rmat &v, rvec &a)
00013 {
00014
00015
00016 rmat corrmat(input.size(), input.size());
00017 for (int i = 0; i < input.size(); ++i)
00018 for (int j = 0; j < input.size(); ++j)
00019 corrmat(i, j) = input((i + j) % input.size());
00020 cmat vl(input.size(), input.size()), vr(input.size(), input.size());
00021 cvec evalues(input.size());
00022 boost::numeric::bindings::lapack::geev(corrmat, evalues, &vl, &vr,
00023 boost::numeric::bindings::lapack::optimal_workspace());
00024 v = real(vr);
00025 noalias(a) = prod(trans(v), input);
00026
00027 }
00028 }
00029 #endif