{"id":151,"date":"2017-09-13T10:33:51","date_gmt":"2017-09-13T13:33:51","guid":{"rendered":"http:\/\/www.professores.uff.br\/diomarcesarlobao\/?page_id=151"},"modified":"2017-09-13T10:33:51","modified_gmt":"2017-09-13T13:33:51","slug":"pawsum-f","status":"publish","type":"page","link":"https:\/\/www.professores.uff.br\/diomarcesarlobao\/pawsum-f\/","title":{"rendered":"pawsum.f"},"content":{"rendered":"<pre>      program array practice\r\nc\r\nc       John Mahaffy,  Penn State University, CmpSc 201 Example\r\nc       1\/26\/96\r\nc\r\n*  We will try to utilize MAX, MIN, Implied Do-Loops, Data statements,\r\n*  and FORTRAN 90 constructs fortest preparation\r\n      IMPLICIT NONE\r\n      INTEGER I,J,K\r\n      REAL, DIMENSION(10) :: A,B,C=(\/(I,I=1,10)\/),GSUM,GM,GX\r\nc   Associating a dimension with gmult treats it as an array containing\r\nc   numbers, not a function that must be evaluated.\r\n      INTERFACE GMULT\r\n      FUNCTION GMULT (A,B)\r\n      REAL A(:),B(:)\r\n      REAL GMULT(SIZE(A))\r\n      END FUNCTION GMULT\r\n      END INTERFACE\r\n      EXTERNAL GMULT\r\n      DATA A\/3*2.5,4*2.,7.,9.,11.\/\r\n      DATA B\/4*3.,2*5.,2.,9.,1.4,3.\/\r\n      OPEN (12,FILE='ARRAY.DATA')\r\n      DO 100 J=1,10\r\n         WRITE (12,20) A(J),B(J),C(J)\r\n 20      FORMAT ('A= ',f5.2,'  B= ',f5.2,'  C= ',f5.2)\r\n 100  CONTINUE\r\n      CALL XSUM (A,B,GSUM)\r\n      GX=GMULT(A,B)\r\n      DO 110 K=1,10\r\n         WRITE (12,200) A(K),B(K),GSUM(K),GX(K)\r\n 200     FORMAT ('A= ',f5.2,'  B=',f5.2,'  GSUM=',f5.2,'  GX=',f5.2)\r\n 110  CONTINUE\r\n      STOP\r\n      END\r\n      SUBROUTINE XSUM (E,F,GSUM)\r\n      IMPLICIT NONE\r\n      REAL, DIMENSION (10) :: E,F,GSUM,G\r\n      G(1:10) = E(1:10) + F(1:10)\r\nc   SUM returns a single number.  No need to load it into an array.\r\nc   the array just gets the same number in all elements.\r\n      GSUM=SUM(G(1:10))\r\n      RETURN\r\n      END\r\n      FUNCTION GMULT(E,F)\r\n      IMPLICIT NONE\r\n      INTEGER I\r\n      REAL E(:),F(:)\r\n      REAL GMULT(SIZE(E))\r\n      DO 120 I=1,10\r\n         GMULT(I)=E(I)*F(I)\r\n  120 CONTINUE    \r\n      END<\/pre>\n","protected":false},"excerpt":{"rendered":"<p>program array practice c c John Mahaffy, Penn State University, CmpSc 201 Example c 1\/26\/96 c * We will try to utilize MAX, MIN, Implied Do-Loops, Data statements, * and FORTRAN 90 constructs fortest preparation IMPLICIT NONE INTEGER I,J,K REAL, DIMENSION(10) :: A,B,C=(\/(I,I=1,10)\/),GSUM,GM,GX c Associating a dimension with gmult treats it as an array containing [&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-151","page","type-page","status-publish","hentry"],"_links":{"self":[{"href":"https:\/\/www.professores.uff.br\/diomarcesarlobao\/wp-json\/wp\/v2\/pages\/151","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=151"}],"version-history":[{"count":1,"href":"https:\/\/www.professores.uff.br\/diomarcesarlobao\/wp-json\/wp\/v2\/pages\/151\/revisions"}],"predecessor-version":[{"id":152,"href":"https:\/\/www.professores.uff.br\/diomarcesarlobao\/wp-json\/wp\/v2\/pages\/151\/revisions\/152"}],"wp:attachment":[{"href":"https:\/\/www.professores.uff.br\/diomarcesarlobao\/wp-json\/wp\/v2\/media?parent=151"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/www.professores.uff.br\/diomarcesarlobao\/wp-json\/wp\/v2\/categories?post=151"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/www.professores.uff.br\/diomarcesarlobao\/wp-json\/wp\/v2\/tags?post=151"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}