2011-10-26 19 views
0

我有一些問題,加速蓄電池庫結合Eigen::VectorXd類型:使用Boost蓄能器徵:: vector的類型

#include <iostream> 
#include <Eigen/Core> 
#include <boost/accumulators/accumulators.hpp> 
#include <boost/accumulators/statistics/stats.hpp> 
#include <boost/accumulators/statistics/mean.hpp> 

using namespace boost::accumulators; 
using namespace Eigen; 

int main() 
{ 
    Vector2f a(1.0, 2.0), b(3.0, 10.0); 

    accumulator_set<Vector2f, stats<tag::mean> > acc(Vector2f::Zero()); 

    acc(a); 
    acc(b); 

    std::cout << mean(acc) << std::endl; 
    std::cout << ((a+b)/2.0) << std::endl; 

    return 0; 
} 

在我的系統中,這會產生:

4.41629e-39 
0 
2 
6 

因此而直接計算很好(特徵向量支持所有通常的數值運算符)Boost累加器在運行時失敗,沒有錯誤。

回答