espressif / esp-dsp

DSP library for ESP-IDF
Apache License 2.0
465 stars 87 forks source link

Fix: use cmath instead of math.h in mat.cpp #10

Closed madislutter closed 4 years ago

madislutter commented 4 years ago

With math.h the compiler does not know which implementation to choose when abs() is called with a float.

The error message seen during compilation: ../components/esp-dsp/modules/matrix/mat/mat.cpp:288:37: error: 'abs' is not a member of 'std' while ((k < A.cols) && (std::abs(A(j,k)) > abs_tol)) { ^ ../components/esp-dsp/modules/matrix/mat/mat.cpp:288:37: note: suggested alternative: In file included from /espressif_sdk/esp-adf/esp-idf/components/newlib/include/wchar.h:4:0, from /opt/esp/tools/xtensa-esp32-elf/1.22.0-80-g6c4433a-5.2.0/xtensa-esp32-elf/xtensa-esp32-elf/include/c++/5.2.0/cwchar:44, from /opt/esp/tools/xtensa-esp32-elf/1.22.0-80-g6c4433a-5.2.0/xtensa-esp32-elf/xtensa-esp32-elf/include/c++/5.2.0/bits/postypes.h:40, from /opt/esp/tools/xtensa-esp32-elf/1.22.0-80-g6c4433a-5.2.0/xtensa-esp32-elf/xtensa-esp32-elf/include/c++/5.2.0/bits/char_traits.h:40, from /opt/esp/tools/xtensa-esp32-elf/1.22.0-80-g6c4433a-5.2.0/xtensa-esp32-elf/xtensa-esp32-elf/include/c++/5.2.0/string:40, from /opt/esp/tools/xtensa-esp32-elf/1.22.0-80-g6c4433a-5.2.0/xtensa-esp32-elf/xtensa-esp32-elf/include/c++/5.2.0/stdexcept:39, from ../components/esp-dsp/modules/matrix/mat/mat.cpp:16: /espressif_sdk/esp-adf/esp-idf/components/newlib/include/stdlib.h:72:12: note: 'abs' int _EXFUN(abs,(int)); ^