2013-12-20 71 views
0

代碼BOOST block_prod矩陣乘法

#include <boost/numeric/ublas/matrix.hpp> 
#include <boost/numeric/ublas/io.hpp> 
#include <boost/numeric/ublas/operation.hpp> 

using namespace boost::numeric::ublas; 

int main() { 

    boost::numeric::ublas::matrix<double> m (1000, 1000); 
    boost::numeric::ublas::matrix<double> n (1000, 1000); 
    boost::numeric::ublas::matrix<double> mn (1000, 1000); 

    for (unsigned i = 0; i < m.size1(); ++ i) 
     for (unsigned j = 0; j < m.size2(); ++ j) 
      m (i, j) = 3 * i + j; 

    for (unsigned i = 0; i < n.size1(); ++ i) 
     for (unsigned j = 0; j < n.size2(); ++ j) 
      n (i, j) = 2 * i + j; 

    mn = block_prod<matrix<double>, 1024>(m, n); 

    return 0; 
} 

,但我得到這些錯誤:

newfile.cpp:88: error: ‘block_prod’ is not a member of ‘boost::numeric::ublas’ 
newfile.cpp:88: error: expected primary-expression before ‘,’ token 
newfile.cpp:88: error: no match for ‘operator>’ in ‘1024 > (0, n)’ 

我到處搜尋,但未能找到這些錯誤。我很欣賞任何想法。由於

回答

0

以下內容添加到您的包括

#include <boost/numeric/ublas/operation_blocked.hpp> 
+0

太謝謝你了 – user1450005