- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
REAL::X(100,5) INTEGER::IS,K IS=merge(MINLOC(X(:,K)),MAXLOC(X(:,-K)),K>0) ! its equivalent is IF(K>0)THEN IS=MINLOC(X(:,K)) ELSEIF(K<0)THEN IS=MAXLOC(X(:,-K)) END IF
! but it seems the later has better efficiency.
Link Copied
1 Reply
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
Did you mean to set a DIM argument for minloc and maxloc? Until the code does what you intend, talking about efficiency seems pointless.
The strength of MERGE is not for cases as complicated as array operations. Performance would depend on the expansion of minloc and maxloc and whether the compiler is able to optimize without making temporary arrays. The size you quote is marginal on whether vectorization would be useful, and that depends (with recent released ifort) on whether you have set the old_maxminloc. What do your optreports say?
Reply
Topic Options
- Subscribe to RSS Feed
- Mark Topic as New
- Mark Topic as Read
- Float this Topic for Current User
- Bookmark
- Subscribe
- Printer Friendly Page