How to use "arm_math.h" to quickly calculate logarithmic with STM32F429IGT6 (using Keil uVision5) ?
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Email to a Friend
- Report Inappropriate Content
‎2022-11-25 11:16 AM
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?
- Labels:
-
DSP
-
STM32F4 Series
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Email to a Friend
- Report Inappropriate Content
‎2022-11-25 11:19 AM
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:
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Email to a Friend
- Report Inappropriate Content
‎2022-11-25 1:21 PM
who knows...did you test real speed ?
+
https://arm-software.github.io/CMSIS_5/DSP/html/group__vlog.html
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Email to a Friend
- Report Inappropriate Content
‎2022-11-26 2:45 AM
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:
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Email to a Friend
- Report Inappropriate Content
‎2022-11-26 3:25 AM
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 )
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Email to a Friend
- Report Inappropriate Content
‎2022-11-26 3:40 AM
use: search, read, learn - how to load/include cmsis lib.
vector - seem is to convert an array in -> out , as needed for fft output
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Email to a Friend
- Report Inappropriate Content
‎2022-11-26 3:47 AM
> 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.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Email to a Friend
- Report Inappropriate Content
‎2022-11-26 9:15 AM
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:
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Email to a Friend
- Report Inappropriate Content
‎2022-11-26 9:19 AM
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:
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Email to a Friend
- Report Inappropriate Content
‎2022-11-26 10:12 AM
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.
