|
184 | 184 | \end{frame}
|
185 | 185 |
|
186 | 186 |
|
| 187 | +\begin{frame}[fragile] |
| 188 | + \frametitle{Demo: stdlib\_sorting} |
| 189 | + \begin{block}{ex\_sorting.f90} |
| 190 | + \small |
| 191 | +\begin{verbatim} |
| 192 | +use stdlib_sorting, only: sort_index |
| 193 | +use stdlib_kinds, only: int64 |
| 194 | +implicit none |
| 195 | +
|
| 196 | +integer :: digits(6) = [3,1,4,1,5,9] |
| 197 | +character :: chars(6) = ['a','b','c','d','e','f'] |
| 198 | +integer(int64) :: index(6) |
| 199 | +call sort_index(digits, index) |
| 200 | +print '(6i1)', digits ! 113459 |
| 201 | +print '(6i1)', index ! 241356 |
| 202 | +print '(6a1)', chars(index) ! bdacef |
| 203 | +end |
| 204 | +\end{verbatim} |
| 205 | + \end{block} |
| 206 | + |
| 207 | + \note{ |
| 208 | + And finally, we'll have a brief look at the new sorting module. |
| 209 | + Currently, there are three sorting subroutines. |
| 210 | + Two, called ``sort'' and ``ord_sort'' are for basic in-place sorting, with different tradeoffs. |
| 211 | + The third, ``sort_index'', is what some other languages call ``argsort''. |
| 212 | + In addition to performing a sort, it returns an array of the indices that put the original array in sorted order. |
| 213 | + You can then use this as a vector subscript to permute other arrays in the same way. |
| 214 | + All three sorting sorting routines can also sort in descending order and can take a user-supplied workspace array to allocating internal workspace. |
| 215 | + } |
| 216 | +\end{frame} |
| 217 | + |
| 218 | + |
187 | 219 | \begin{frame}
|
188 | 220 | \frametitle{New contributors have been key to stdlib's growth}
|
189 | 221 |
|
|
0 commit comments