是否有一个 C++ 库提供 Fortran 风格的多维数组,支持切片、作为过程参数传递和体面的文档?我调查了blitz++但它死了!
最佳答案
我强烈建议 Armadillo :
Armadillo is a C++ linear algebra library (matrix maths) aiming towards a good balance between speed and ease of use
它是一个C++模板库:
A delayed evaluation approach is employed (at compile-time) to combine several operations into one and reduce (or eliminate) the need for temporaries; this is automatically accomplished through template meta-programming
网页中的一个简单例子:
#include <iostream>
#include <armadillo>
int main(int argc, char** argv)
{
arma::mat A = arma::randu<arma::mat>(4,5);
arma::mat B = arma::randu<arma::mat>(4,5);
std::cout << A*B.t() << std::endl;
return 0;
}
关于c++ - C++ 中 Fortran 风格的多维数组,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/9677288/