简体   繁体   中英

Matrix multiplication using Matrix Template library (MTL 4)

The program is as following:

#include <iostream>
#include <boost/numeric/mtl/mtl.hpp>
using namespace mtl;
int main(int argc, char* argv[])
{
dense_vector<double> a(5,1.0);
dense_vector<double> b(5,2.0);
a * trans(b);
}

I want to calculate a * trans(b), but there is a compling error :C2893. Will someone help me? Thanks a lot!

The vector in your program above is a column vector. The constructor you make use of takes two arguments: the size and the initial value.

The reason you're getting the compiler error is probably this:

The transposition of vector is momentarily not implemented yet. It will create a row vector view on a column vector and vice versa.

Matrix Template Library 4: Transposed

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM