gpt4 book ai didi

c++ - BOOST block_prod 矩阵乘法

转载 作者:行者123 更新时间:2023-11-28 07:12:52 25 4
gpt4 key购买 nike

代码是

#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)’

我到处搜索,但找不到这些错误。我很欣赏任何想法。谢谢

最佳答案

将以下内容添加到您的包含

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

关于c++ - BOOST block_prod 矩阵乘法,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/20711189/

25 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com