Skip to main content
ZeroOne
Associate II
November 25, 2022
Question

How to use "arm_math.h" to quickly calculate logarithmic with STM32F429IGT6 (using Keil uVision5) ?

  • November 25, 2022
  • 9 replies
  • 7210 views

I try to use "arm_math.h", but I can't find any function about logarithmic operation in "arm_math.h". Is there none logarithmic in this, or am I not found? 0693W00000WJXITQA5.jpg

This topic has been closed for replies.

9 replies

ZeroOne
ZeroOneAuthor
Associate II
November 25, 2022

Do I have to use the traditional "math.h" to calculate the logarithm ? I'm worried that "math.h" will count slowly.:sad_but_relieved_face:

AScha.3
Super User
November 25, 2022
If you feel a post has answered your question, please click on " Best Answer ".
ZeroOne
ZeroOneAuthor
Associate II
November 26, 2022

No,I haven't tested it. It would definitely be slower in theory, because FPU will only optimize float-type variables, whereas traditional logarithmic algorithm are based on "double".

+

Super thanks! I think that's what I'm looking for!:smiling_face_with_heart_eyes:

ZeroOne
ZeroOneAuthor
Associate II
November 26, 2022

I feel like I've found the logarithmic operation function:backhand_index_pointing_down:?But.....how to use?What does the third parameter(blockSize) mean:astonished_face: ?

void arm_vlog_f16(const float16_t * pSrc,float16_t * pDst,uint32_t blockSize )0693W00000WJYPVQA5.jpg

AScha.3
Super User
November 26, 2022

use: search, read, learn - how to load/include cmsis lib.

vector - seem is to convert an array in -> out , as needed for fft output

If you feel a post has answered your question, please click on " Best Answer ".
ZeroOne
ZeroOneAuthor
Associate II
November 26, 2022

Yes, I just tested it, and "vector" does mean "array"! After understanding this, "blockSize" is very clear---number of samples in each array:face_with_tears_of_joy:

Piranha
Principal III
November 26, 2022

> traditional logarithmic algorithm are based on "double"

Have you looked at C documentation, which is newer than 23 years old?

https://en.cppreference.com/w/c/numeric/math/log

> What does the third parameter(blockSize) mean:astonished_face: ?

Vector means an array. DSP is not some magic, which can turn everything magically faster. The speed is mainly gained by using a SIMD style instructions and parallel calculation. For a calculation of a single number the vectored functions will probably be slower than the appropriate standard C functions.

ZeroOne
ZeroOneAuthor
Associate II
November 26, 2022

Thank you so much:* ! What you said was very thorough and clear:thumbs_up:. I didn't find out that "Vector" means "array" before, which led to a misunderstanding.:face_with_medical_mask:

Piranha
Principal III
November 26, 2022

So to sum up how to use a (single) float numbers... Use the standard C functions with "f" suffix like logf() and add "f" suffix to constants like 1.618f. Also I would recommend compiling with -Wdouble-promotion for GCC and, if available, a similar option for other compilers.