cancel
Showing results for
Did you mean:

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

Associate III

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?

9 REPLIES 9
Associate III

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:

Principal
Associate III

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!😍

Associate III

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 )

Principal

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

Chief II

> 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.

Associate III

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

Associate III

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

Chief II

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.