源码
#include <iostream>
#include <armadillo>//包含armadillo头文件
using namespace std;
using namespace arma;//armadillo命名空间
int main(int argc, char** argv)
{
mat A = randu<mat>(4,5);//4行5列矩阵
mat B = randu<mat>(4,5);
cout << "A*B.t():\n" << A*B.t() << endl;//.t()向量或矩阵转置
(A*B.t()).print("A*B.t():");
system("pause");
return 0;
}
运行结果
A*B.t():
0.9536 1.0573 1.0669 0.9087
0.3911 0.6334 0.6719 0.7834
1.7734 2.6922 2.1078 2.4613
0.8542 1.1044 0.8725 0.9546
A*B.t():
0.9536 1.0573 1.0669 0.9087
0.3911 0.6334 0.6719 0.7834
1.7734 2.6922 2.1078 2.4613
0.8542 1.1044 0.8725 0.9546
请按任意键继续. . .
参考:armadillo库文档First time users: please see the short example program