opencv-4.5.3-lapack-3.10.patch 6.6 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109
  1. diff --git a/modules/core/src/hal_internal.cpp b/modules/core/src/hal_internal.cpp
  2. index 483281d1f7..05239e98f4 100644
  3. --- a/modules/core/src/hal_internal.cpp
  4. +++ b/modules/core/src/hal_internal.cpp
  5. @@ -163,9 +163,9 @@ lapack_Cholesky(fptype* a, size_t a_step, int m, fptype* b, size_t b_step, int n
  6. if(n == 1 && b_step == sizeof(fptype))
  7. {
  8. if(typeid(fptype) == typeid(float))
  9. - sposv_(L, &m, &n, (float*)a, &lda, (float*)b, &m, &lapackStatus);
  10. + LAPACK_sposv(L, &m, &n, (float*)a, &lda, (float*)b, &m, &lapackStatus);
  11. else if(typeid(fptype) == typeid(double))
  12. - dposv_(L, &m, &n, (double*)a, &lda, (double*)b, &m, &lapackStatus);
  13. + LAPACK_dposv(L, &m, &n, (double*)a, &lda, (double*)b, &m, &lapackStatus);
  14. }
  15. else
  16. {
  17. @@ -174,9 +174,9 @@ lapack_Cholesky(fptype* a, size_t a_step, int m, fptype* b, size_t b_step, int n
  18. transpose(b, ldb, tmpB, m, m, n);
  19. if(typeid(fptype) == typeid(float))
  20. - sposv_(L, &m, &n, (float*)a, &lda, (float*)tmpB, &m, &lapackStatus);
  21. + LAPACK_sposv(L, &m, &n, (float*)a, &lda, (float*)tmpB, &m, &lapackStatus);
  22. else if(typeid(fptype) == typeid(double))
  23. - dposv_(L, &m, &n, (double*)a, &lda, (double*)tmpB, &m, &lapackStatus);
  24. + LAPACK_dposv(L, &m, &n, (double*)a, &lda, (double*)tmpB, &m, &lapackStatus);
  25. transpose(tmpB, m, b, ldb, n, m);
  26. delete[] tmpB;
  27. @@ -185,9 +185,9 @@ lapack_Cholesky(fptype* a, size_t a_step, int m, fptype* b, size_t b_step, int n
  28. else
  29. {
  30. if(typeid(fptype) == typeid(float))
  31. - spotrf_(L, &m, (float*)a, &lda, &lapackStatus);
  32. + LAPACK_spotrf(L, &m, (float*)a, &lda, &lapackStatus);
  33. else if(typeid(fptype) == typeid(double))
  34. - dpotrf_(L, &m, (double*)a, &lda, &lapackStatus);
  35. + LAPACK_dpotrf(L, &m, (double*)a, &lda, &lapackStatus);
  36. }
  37. if(lapackStatus == 0) *info = true;
  38. @@ -227,17 +227,17 @@ lapack_SVD(fptype* a, size_t a_step, fptype *w, fptype* u, size_t u_step, fptype
  39. }
  40. if(typeid(fptype) == typeid(float))
  41. - sgesdd_(mode, &m, &n, (float*)a, &lda, (float*)w, (float*)u, &ldu, (float*)vt, &ldv, (float*)&work1, &lwork, iworkBuf, info);
  42. + LAPACK_sgesdd(mode, &m, &n, (float*)a, &lda, (float*)w, (float*)u, &ldu, (float*)vt, &ldv, (float*)&work1, &lwork, iworkBuf, info);
  43. else if(typeid(fptype) == typeid(double))
  44. - dgesdd_(mode, &m, &n, (double*)a, &lda, (double*)w, (double*)u, &ldu, (double*)vt, &ldv, (double*)&work1, &lwork, iworkBuf, info);
  45. + LAPACK_dgesdd(mode, &m, &n, (double*)a, &lda, (double*)w, (double*)u, &ldu, (double*)vt, &ldv, (double*)&work1, &lwork, iworkBuf, info);
  46. lwork = (int)round(work1); //optimal buffer size
  47. fptype* buffer = new fptype[lwork + 1];
  48. if(typeid(fptype) == typeid(float))
  49. - sgesdd_(mode, &m, &n, (float*)a, &lda, (float*)w, (float*)u, &ldu, (float*)vt, &ldv, (float*)buffer, &lwork, iworkBuf, info);
  50. + LAPACK_sgesdd(mode, &m, &n, (float*)a, &lda, (float*)w, (float*)u, &ldu, (float*)vt, &ldv, (float*)buffer, &lwork, iworkBuf, info);
  51. else if(typeid(fptype) == typeid(double))
  52. - dgesdd_(mode, &m, &n, (double*)a, &lda, (double*)w, (double*)u, &ldu, (double*)vt, &ldv, (double*)buffer, &lwork, iworkBuf, info);
  53. + LAPACK_dgesdd(mode, &m, &n, (double*)a, &lda, (double*)w, (double*)u, &ldu, (double*)vt, &ldv, (double*)buffer, &lwork, iworkBuf, info);
  54. if(!(flags & CV_HAL_SVD_NO_UV))
  55. transpose_square_inplace(vt, ldv, n);
  56. @@ -288,18 +288,18 @@ lapack_QR(fptype* a, size_t a_step, int m, int n, int k, fptype* b, size_t b_ste
  57. if (k == 1 && b_step == sizeof(fptype))
  58. {
  59. if (typeid(fptype) == typeid(float))
  60. - sgels_(mode, &m, &n, &k, (float*)tmpA, &ldtmpA, (float*)b, &m, (float*)&work1, &lwork, info);
  61. + LAPACK_sgels(mode, &m, &n, &k, (float*)tmpA, &ldtmpA, (float*)b, &m, (float*)&work1, &lwork, info);
  62. else if (typeid(fptype) == typeid(double))
  63. - dgels_(mode, &m, &n, &k, (double*)tmpA, &ldtmpA, (double*)b, &m, (double*)&work1, &lwork, info);
  64. + LAPACK_dgels(mode, &m, &n, &k, (double*)tmpA, &ldtmpA, (double*)b, &m, (double*)&work1, &lwork, info);
  65. lwork = cvRound(work1); //optimal buffer size
  66. std::vector<fptype> workBufMemHolder(lwork + 1);
  67. fptype* buffer = &workBufMemHolder.front();
  68. if (typeid(fptype) == typeid(float))
  69. - sgels_(mode, &m, &n, &k, (float*)tmpA, &ldtmpA, (float*)b, &m, (float*)buffer, &lwork, info);
  70. + LAPACK_sgels(mode, &m, &n, &k, (float*)tmpA, &ldtmpA, (float*)b, &m, (float*)buffer, &lwork, info);
  71. else if (typeid(fptype) == typeid(double))
  72. - dgels_(mode, &m, &n, &k, (double*)tmpA, &ldtmpA, (double*)b, &m, (double*)buffer, &lwork, info);
  73. + LAPACK_dgels(mode, &m, &n, &k, (double*)tmpA, &ldtmpA, (double*)b, &m, (double*)buffer, &lwork, info);
  74. }
  75. else
  76. {
  77. @@ -309,18 +309,18 @@ lapack_QR(fptype* a, size_t a_step, int m, int n, int k, fptype* b, size_t b_ste
  78. transpose(b, ldb, tmpB, m, m, k);
  79. if (typeid(fptype) == typeid(float))
  80. - sgels_(mode, &m, &n, &k, (float*)tmpA, &ldtmpA, (float*)tmpB, &m, (float*)&work1, &lwork, info);
  81. + LAPACK_sgels(mode, &m, &n, &k, (float*)tmpA, &ldtmpA, (float*)tmpB, &m, (float*)&work1, &lwork, info);
  82. else if (typeid(fptype) == typeid(double))
  83. - dgels_(mode, &m, &n, &k, (double*)tmpA, &ldtmpA, (double*)tmpB, &m, (double*)&work1, &lwork, info);
  84. + LAPACK_dgels(mode, &m, &n, &k, (double*)tmpA, &ldtmpA, (double*)tmpB, &m, (double*)&work1, &lwork, info);
  85. lwork = cvRound(work1); //optimal buffer size
  86. std::vector<fptype> workBufMemHolder(lwork + 1);
  87. fptype* buffer = &workBufMemHolder.front();
  88. if (typeid(fptype) == typeid(float))
  89. - sgels_(mode, &m, &n, &k, (float*)tmpA, &ldtmpA, (float*)tmpB, &m, (float*)buffer, &lwork, info);
  90. + LAPACK_sgels(mode, &m, &n, &k, (float*)tmpA, &ldtmpA, (float*)tmpB, &m, (float*)buffer, &lwork, info);
  91. else if (typeid(fptype) == typeid(double))
  92. - dgels_(mode, &m, &n, &k, (double*)tmpA, &ldtmpA, (double*)tmpB, &m, (double*)buffer, &lwork, info);
  93. + LAPACK_dgels(mode, &m, &n, &k, (double*)tmpA, &ldtmpA, (double*)tmpB, &m, (double*)buffer, &lwork, info);
  94. transpose(tmpB, m, b, ldb, k, m);
  95. }