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
1,324 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 III
1,318 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
1,261 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
1,071 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
Employee
1,244 Views

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

0 Kudos
Barbara_P_Intel
Employee
1,088 Views

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



0 Kudos
Reply