{"id":219,"date":"2017-09-13T11:18:17","date_gmt":"2017-09-13T14:18:17","guid":{"rendered":"http:\/\/www.professores.uff.br\/diomarcesarlobao\/?page_id=219"},"modified":"2017-09-13T11:18:17","modified_gmt":"2017-09-13T14:18:17","slug":"sort1-f","status":"publish","type":"page","link":"https:\/\/www.professores.uff.br\/diomarcesarlobao\/sort1-f\/","title":{"rendered":"sort1.f"},"content":{"rendered":"<pre>c&lt;html&gt;\r\nc&lt;head&gt;&lt;title&gt;sort1.f&lt;\/title&gt;&lt;\/head&gt;\r\nc&lt;body&gt;\r\nc&lt;pre&gt;      \r\n\tSUBROUTINE SSORT (X, IY, N, KFLAG)\r\n      IMPLICIT NONE\r\nc\r\nc    Example of a Selection Sort   Using a Fortran 90 Intrinsic Function\r\nc\r\nC***BEGIN PROLOGUE  SSORT\r\nC***PURPOSE  Sort an array and make the same interchanges in\r\nC            an auxiliary array.  The array is sorted in\r\nC            decreasing order.\r\nC***TYPE      SINGLE PRECISION\r\nC***KEYWORDS  SORT, SORTING\r\nC\r\nC   Description of Parameters\r\nC      X - array of values to be sorted   (usually abscissas)\r\nC      IY - array to be carried with X (all swaps of X elements are\r\nC          matched in IY .  After the sort IY(J) contains the original\r\nC          postition of the value X(J) in the unsorted X array.\r\nC      N - number of values in array X to be sorted\r\nC      KFLAG - Not used in this implementation\r\nC\r\nC***REVISION HISTORY  (YYMMDD)\r\nC   950310  DATE WRITTEN\r\nC   John Mahaffy\r\nC***END PROLOGUE  SSORT\r\nC     .. Scalar Arguments ..\r\n      INTEGER KFLAG, N\r\nC     .. Array Arguments ..  -----NOTE the 2 new ways of declaring array size\r\n      REAL X(1:N)\r\n      INTEGER IY(N)\r\nC     .. Local Scalars ..\r\n      REAL TEMP\r\n      INTEGER I, ISWAP(1), ITEMP, ISWAP1\r\nC     .. External Subroutines ..\r\nC     None\r\nC     .. Intrinsic Functions ..\r\n      INTRINSIC MAXLOC\r\nc\r\nc\r\nc    MAXLOC is a FORTRAN 90 function that returns the index value for the\r\nc    maximum element in the array\r\nC***FIRST EXECUTABLE STATEMENT  SSORT\r\nC\r\n      DO 200 I=1,N-1\r\nc&lt;a name=1&gt;&lt;font color=FF0000&gt;\r\n         ISWAP=MAXLOC(X(I:N))\r\n\r\nc&lt;\/font&gt;\r\n         ISWAP1=ISWAP(1)+I-1\r\n         IF(ISWAP1.NE.I) THEN\r\n           TEMP=X(I)\r\n            X(I)=X(ISWAP1)\r\n            X(ISWAP1)=TEMP\r\n            ITEMP=IY(I)\r\n            IY(I)=IY(ISWAP1)\r\n            IY(ISWAP1)=ITEMP\r\n         ENDIF\r\n  200 CONTINUE\r\n      RETURN\r\n      END\r\nc&lt;\/pre&gt;\r\nc&lt;\/body&gt;\r\nc&lt;\/html&gt;<\/pre>\n","protected":false},"excerpt":{"rendered":"<p>c&lt;html&gt; c&lt;head&gt;&lt;title&gt;sort1.f&lt;\/title&gt;&lt;\/head&gt; c&lt;body&gt; c&lt;pre&gt; SUBROUTINE SSORT (X, IY, N, KFLAG) IMPLICIT NONE c c Example of a Selection Sort Using a Fortran 90 Intrinsic Function c C***BEGIN PROLOGUE SSORT C***PURPOSE Sort an array and make the same interchanges in C an auxiliary array. The array is sorted in C decreasing order. C***TYPE SINGLE PRECISION C***KEYWORDS [&hellip;]<\/p>\n","protected":false},"author":22,"featured_media":0,"parent":0,"menu_order":0,"comment_status":"closed","ping_status":"closed","template":"","meta":{"_exactmetrics_skip_tracking":false,"_exactmetrics_sitenote_active":false,"_exactmetrics_sitenote_note":"","_exactmetrics_sitenote_category":0,"footnotes":""},"categories":[],"tags":[],"class_list":["post-219","page","type-page","status-publish","hentry"],"_links":{"self":[{"href":"https:\/\/www.professores.uff.br\/diomarcesarlobao\/wp-json\/wp\/v2\/pages\/219","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/www.professores.uff.br\/diomarcesarlobao\/wp-json\/wp\/v2\/pages"}],"about":[{"href":"https:\/\/www.professores.uff.br\/diomarcesarlobao\/wp-json\/wp\/v2\/types\/page"}],"author":[{"embeddable":true,"href":"https:\/\/www.professores.uff.br\/diomarcesarlobao\/wp-json\/wp\/v2\/users\/22"}],"replies":[{"embeddable":true,"href":"https:\/\/www.professores.uff.br\/diomarcesarlobao\/wp-json\/wp\/v2\/comments?post=219"}],"version-history":[{"count":1,"href":"https:\/\/www.professores.uff.br\/diomarcesarlobao\/wp-json\/wp\/v2\/pages\/219\/revisions"}],"predecessor-version":[{"id":220,"href":"https:\/\/www.professores.uff.br\/diomarcesarlobao\/wp-json\/wp\/v2\/pages\/219\/revisions\/220"}],"wp:attachment":[{"href":"https:\/\/www.professores.uff.br\/diomarcesarlobao\/wp-json\/wp\/v2\/media?parent=219"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/www.professores.uff.br\/diomarcesarlobao\/wp-json\/wp\/v2\/categories?post=219"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/www.professores.uff.br\/diomarcesarlobao\/wp-json\/wp\/v2\/tags?post=219"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}