Intel® oneAPI Math Kernel Library
Ask questions and share information with other developers who use Intel® Math Kernel Library.
6980 Discussions

How to count the number of elements in a vector that satisfy some criterions?

yunfenglee13
Beginner
305 Views
Hello,
I am a beginner of MKL. In my research, I need to count the number of elements in a large vector
that satisfy somecriterion. For example, counting the number of elements whose absolute
values are less than 50. I checked all functions and didn't find the one that can do this job.
I would appreciate if you have any good suggestion. Thanks in advance.
YL
0 Kudos
2 Replies
Gennady_F_Intel
Moderator
305 Views
Hello YL.
MKL doesn't contains similar routines. That function is pretty simple and you can try to develop it by yourself.
Or I 'drecommend to tryippsCountInRange function from another Intel Performance Library - IPP. That function

computes the number of elements of the vector whose values are in the specified range.

--Gennady

0 Kudos
yunfenglee13
Beginner
305 Views
Gennady,
Thank you for your suggestion. I tested ippsCountInRange function. Except that this function only supports integer input and I have to convert the data type before calling it, it works well and it is fast. Thanks,
YL
0 Kudos
Reply