-
Notifications
You must be signed in to change notification settings - Fork 16
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Sorting #101
Comments
@jacobwilliams indeed. We had to implement our own (https://github.com/certik/fortran-utils/blob/b43bd24cd421509a5bc6d3b9c3eeae8ce856ed88/src/sorting.f90) and it's not very efficient. This would be a great addition. |
agree 100% about the need for sorting routines. Since there are numerous examples of quicksort etc. in the literature, implementing this in a standard library should be a no-brainer. I would point to the code in Robin Vowels excellent book "Algorithms and Data Structures in F and Fortran", Dick Hanson and Tim Hopkins book "Numerical Computing with Modern Fortran", and Ajen Markus's FLIBS implementation of quicksort. Also, if Robin Vowels is following this and the other issues on this site, I would love an updated version of your book focused on Modern Fortran implementations of the algorithms and data structures with additional coverage of things like octrees etc. I would buy it yesterday. |
Let's implement good sorting routines in |
I have a decent introspection sort in Coretran. !! Uses an introspective sort on a set of numbers. See this "http://www.geeksforgeeks.org/know- The stable merge sort doesn't really matter for numbers, will be important if used for arbitrary types though. |
Also related, maybe it should be a separate issue. Should searching algorithms be part of the stdlib? Binary search or interval search? |
I think searching algorithm would also fit into stdlib. |
I wonder if sorting should be built into the language? This is such a fundamental thing that currently take a staggering amount of code to make it work with all intrinsic types and user-defined types (see for example here). I think C++ has sorting built in to its standard library.
Features:
integer(kind=*)
andreal(kind=*)
)I think it goes without saying that any well-designed future generic/templating feature should also allow one to apply a sorting algorithm (either one from a third-party library or maybe even the hypothetical intrinsic one) to a user-defined type with a minimum of code.
The text was updated successfully, but these errors were encountered: