- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
Hi my friends,
Could anyone tell me what the following two commands do?
IMAX = SUM(J=1,NB):NG(J)
NF = MAX(J=1,NB):SUM(I=IBEGIN(J),IEND(J)):NFG(I)*NPF(I)
In what FORTRAN version are they available?
Thanks.
Could anyone tell me what the following two commands do?
IMAX = SUM(J=1,NB):NG(J)
NF = MAX(J=1,NB):SUM(I=IBEGIN(J),IEND(J)):NFG(I)*NPF(I)
In what FORTRAN version are they available?
Thanks.
1 Solution
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
In your first post, you wrote "command" where, if you had written "comment", you would have transferred much less confusion to your readers.
The author of the comments seems to be transcribing standard mathematical notation to ASCII text in a straightforward way. For example,
IMAX = SUM(J=1,NB):NG(J)
should perhaps be read as
nb
IMAX = ngj
j=1
and is by no means to be thought of as Fortran syntax.
Knuth proposed Literate Programming as a solution for such infelicities. The idea was that when you ran the compiler on your source code, there were two output files produced: i) an object file, to be linked with other object files and libraries, as usual, and ii) a document file, such as a Postscript or PDF file, which could be displayed to view mathematical comments in universal notation.
The author of the comments seems to be transcribing standard mathematical notation to ASCII text in a straightforward way. For example,
IMAX = SUM(J=1,NB):NG(J)
should perhaps be read as
nb
IMAX = ngj
j=1
and is by no means to be thought of as Fortran syntax.
Knuth proposed Literate Programming as a solution for such infelicities. The idea was that when you ran the compiler on your source code, there were two output files produced: i) an object file, to be linked with other object files and libraries, as usual, and ii) a document file, such as a Postscript or PDF file, which could be displayed to view mathematical comments in universal notation.
Link Copied
6 Replies
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
Are you certain you've quoted this accurately? Colon has been given some non-standard meanings by certain past compilers, and has a standard meaning in syntax somewhat close to what you quoted.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
Actually I want to modify a code which is previously written by somebody else. It is said as a comment in the code that:
IMAX = SUM(J=1,NB):NG(J)
NF = MAX(J=1,NB):SUM(I=IBEGIN(J),IEND(J)):NFG(I)*NPF(I)
I am kind of confused. I haven't seen such a thing. I would appreciate it if you could let me know what you understand from that.
IMAX = SUM(J=1,NB):NG(J)
NF = MAX(J=1,NB):SUM(I=IBEGIN(J),IEND(J)):NFG(I)*NPF(I)
I am kind of confused. I haven't seen such a thing. I would appreciate it if you could let me know what you understand from that.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
In your first post, you wrote "command" where, if you had written "comment", you would have transferred much less confusion to your readers.
The author of the comments seems to be transcribing standard mathematical notation to ASCII text in a straightforward way. For example,
IMAX = SUM(J=1,NB):NG(J)
should perhaps be read as
nb
IMAX = ngj
j=1
and is by no means to be thought of as Fortran syntax.
Knuth proposed Literate Programming as a solution for such infelicities. The idea was that when you ran the compiler on your source code, there were two output files produced: i) an object file, to be linked with other object files and libraries, as usual, and ii) a document file, such as a Postscript or PDF file, which could be displayed to view mathematical comments in universal notation.
The author of the comments seems to be transcribing standard mathematical notation to ASCII text in a straightforward way. For example,
IMAX = SUM(J=1,NB):NG(J)
should perhaps be read as
nb
IMAX = ngj
j=1
and is by no means to be thought of as Fortran syntax.
Knuth proposed Literate Programming as a solution for such infelicities. The idea was that when you ran the compiler on your source code, there were two output files produced: i) an object file, to be linked with other object files and libraries, as usual, and ii) a document file, such as a Postscript or PDF file, which could be displayed to view mathematical comments in universal notation.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
Thanks a lot. That is a very good explanation. Literate programming is interesting.
Do you know what the MAX(J=1,NB) is in the second comment: NF = MAX(J=1,NB):SUM(I=IBEGIN(J),IEND(J)):NFG(I)*NPF(I) Can it be equivalent to the following?
DO J=1,NB

END DO
Then pick NF as the maximum element of NF1 array? Is this what you also understand from it?
I have another question that whether IFORT can make the document file such as a Postscript or PDF?
Thank you.
Do you know what the MAX(J=1,NB) is in the second comment: NF = MAX(J=1,NB):SUM(I=IBEGIN(J),IEND(J)):NFG(I)*NPF(I) Can it be equivalent to the following?
DO J=1,NB
END DO
Then pick NF as the maximum element of NF1 array? Is this what you also understand from it?
I have another question that whether IFORT can make the document file such as a Postscript or PDF?
Thank you.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
Quoting Ahmad Falahatpisheh
Thanks a lot. That is a very good explanation. Literate programming is interesting.
See here for Knuth's ideas. In that paper he make this cynical comment: "..some of us are glad that traditional programming languages have comparatively primitive capabilities for inserted comments, because such difficulties provide a good excuse for not documenting programs well."
Do you know what the MAX(J=1,NB) is in the second comment: NF = MAX(J=1,NB):SUM(I=IBEGIN(J),IEND(J)):NFG(I)*NPF(I) Can it be equivalent to the following?
DO J=1,NB

END DO
Then pick NF as the maximum element of NF1 array? Is this what you also understand from it?
That is a reasonable conclusion. Only the author of the comment can confirm. Another, if less likely, interpretation is that NF is to be given the index value of the element in your array NF1 that contains the maximal value.
I have another question that whether IFORT can make the document file such as a Postscript or PDF?
That would make a Swiss Army Knife out of a compiler. There are third party tools to print program text with syntax highlighting, in HTML, PS, PDF, etc., but almost none that can do full-fledged mathematical typesetting. You would need more mark-up information in the source file than that which you have shown to make this possible.
See here for Knuth's ideas. In that paper he make this cynical comment: "..some of us are glad that traditional programming languages have comparatively primitive capabilities for inserted comments, because such difficulties provide a good excuse for not documenting programs well."
Do you know what the MAX(J=1,NB) is in the second comment: NF = MAX(J=1,NB):SUM(I=IBEGIN(J),IEND(J)):NFG(I)*NPF(I) Can it be equivalent to the following?
DO J=1,NB
END DO
Then pick NF as the maximum element of NF1 array? Is this what you also understand from it?
That is a reasonable conclusion. Only the author of the comment can confirm. Another, if less likely, interpretation is that NF is to be given the index value of the element in your array NF1 that contains the maximal value.
I have another question that whether IFORT can make the document file such as a Postscript or PDF?
That would make a Swiss Army Knife out of a compiler. There are third party tools to print program text with syntax highlighting, in HTML, PS, PDF, etc., but almost none that can do full-fledged mathematical typesetting. You would need more mark-up information in the source file than that which you have shown to make this possible.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
A tool like doxygen is well capable of transforming specially formatted comments into mathematical
formulae. Perhaps that isclose enoughto what you want?
Regards,
Arjen
formulae. Perhaps that isclose enoughto what you want?
Regards,
Arjen

Reply
Topic Options
- Subscribe to RSS Feed
- Mark Topic as New
- Mark Topic as Read
- Float this Topic for Current User
- Bookmark
- Subscribe
- Printer Friendly Page