数学计算库使用:armadillo 12.4(底层是OpenBlas,首先要下载OpenBlas之后才能编译)
操作系统:Ubuntu20.04
高性能计算库:Openmp
开发语言:C++17
Armadillo: C++ library for linear algebra & scientific computing - Download
#include <iostream>
#include <armadillo>
int main() {
arma::fmat in_1(32, 16, arma::fill::ones);
arma::fmat in_2(32, 16, arma::fill::ones);
arma::fmat out = in_1 + in_2;
std::cout << "rows " << out.n_rows << "\n";
std::cout << "cols " << out.n_cols << "\n";
std::cout << "value " << out.at(0) << "\n"; //第0位的值
return 0;
}
注意1、fmat二维矩阵是float类型数据,mat是double
2、与numpy和opencv不同armadillo内存空间是按照列的顺序在内存依次排布