犰狳复杂矩阵乘法早期近似

armadillo complex matrix multiplication early approximation

如何提高犰狳复数矩阵乘法结果的精度。它近似于小数点后 4 位 [这是结果的一个示例 (35.9682,-150.246) ] 但我想要至少 8 位小数的精度。谢谢

因为你好像不相信我在评论里说的话:

#include <armadillo>

using namespace std;
using namespace arma;

int main(int argc, char** argv) {
  mat A = randu<mat>(4,5);
  mat B = randu<mat>(4,5);

  mat C = A*B.t();
  cout << C << endl;

  cout.precision(11);
  cout.setf(ios::fixed);
  C.raw_print(cout, "With increased precisions:");

  return 0;
}

这符合预期:

edd@max:/tmp$ g++ -o eze eze.cpp -larmadillo -lblas -llapack 
edd@max:/tmp$ ./eze  
   0.9713   1.3566   0.7946   1.6896
   1.2593   1.1457   0.9011   1.6260
   1.1954   0.8484   1.0444   1.6753
   1.6225   1.5009   1.2935   2.2019

With increased precisions:
0.97126557882 1.35660885673 0.79462856896 1.68955180769
1.25933041551 1.14565671740 0.90105251304 1.62595390611
1.19543745264 0.84844286454 1.04436441020 1.67528315350
1.62246223165 1.50087016389 1.29351914350 2.20190979625
edd@max:/tmp$ 

士气:印刷精度几乎从来没有计算精度