Intel® Fortran Compiler
Build applications that can scale for the future with optimized code designed for Intel® Xeon® and compatible processors.

Why isn't SORTQQ pure?

Karanta__Antti
New Contributor I
911 Views

In a pure routine I would need to sort a real array. However, I can't call SORTQQ without removing the pure modifier from the calling procedure as SORTQQ is not marked to be pure. 

Is there a reason it is not pure or is it just by accident?

https://www.intel.com/content/www/us/en/develop/documentation/fortran-compiler-oneapi-dev-guide-and-reference/top/language-reference/a-to-z-reference/s-1/sortqq.html

 

Using ifort 2020.4 on Windows

 

     .::Antti::.

 

 

0 Kudos
5 Replies
andrew_4619
Honored Contributor II
905 Views

Sortqq is some really old legacy routine. There are many freely available sorting routines that can be downloaded. I would suggest picking one that suits your needs. 

JohnNichols
Valued Contributor III
848 Views

https://www.intel.com/content/www/us/en/develop/documentation/fortran-compiler-oneapi-dev-guide-and-reference/top/language-reference/a-to-z-reference/s-1/sortqq.html 

 

!
 !    Sort a 1-D array
  USE IFPORT
 INTEGER(2) array(10)
 INTEGER(2) i 
 DATA ARRAY /143, 99, 612, 61, 712, 9112, 6, 555, 2223, 67/
 !    Sort the array
 Call SORTQQ (LOC(array), 10, SRT$INTEGER2)
 !    Display the sorted array
 DO i = 1, 10
   WRITE (*, 9000) i, array (i) 
9000 FORMAT(1X, ' Array(',I2, '): ', I5)
 END DO
 END

The sortqq sample does not work as published.  This works ok.   Mainly missing carriage returns in original.   

Karanta__Antti
New Contributor I
658 Views

Ok, thanks for the info. I was looking at sortqq as something already provided by the compiler / runtime is in my mind preferable to something I need to get from elsewhere. 

0 Kudos
Barbara_P_Intel
Moderator
831 Views

@JohnNichols, Good Catch! I filed a bug report, DOC-10880.

0 Kudos
Barbara_P_Intel
Moderator
675 Views

The error in the example that John reported is fixed in the next release later this spring.



0 Kudos
Reply