Turn on suggestions

Auto-suggest helps you quickly narrow down your search results by suggesting possible matches as you type.

Showing results for

- Intel Community
- Software Development SDKs and Libraries
- Intel® oneAPI Math Kernel Library & Intel® Math Kernel Library
- How to count the number of elements in a vector that satisfy so

- Subscribe to RSS Feed
- Mark Topic as New
- Mark Topic as Read
- Float this Topic for Current User
- Bookmark
- Subscribe
- Mute
- Printer Friendly Page

Highlighted
##

Hello,

yunfenglee13

Beginner

- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Email to a Friend
- Report Inappropriate Content

01-23-2011
05:33 PM

28 Views

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

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

2 Replies

Highlighted
##

Hello YL.

Gennady_F_Intel

Moderator

- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Email to a Friend
- Report Inappropriate Content

01-23-2011
10:55 PM

28 Views

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

Highlighted
##

Gennady,

yunfenglee13

Beginner

- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Email to a Friend
- Report Inappropriate Content

01-24-2011
07:00 PM

28 Views

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

For more complete information about compiler optimizations, see our Optimization Notice.