From: James Tursa on 25 May 2010 15:41 "Bruno Luong" <b.luong(a)fogale.findmycountry> wrote in message <hth502$rf2$1(a)fred.mathworks.com>... > dpb <none(a)non.net> wrote in message <hth3rh$baj$1(a)news.eternal-september.org>... > > > > > Which is the same as > > > > a(1:N) = b(1:N)/5.0 > > z(1:N) = a(1:N)^2 > > > > Woah, I haven't programmed Fortran for a while, but the syntax looks neat. > > Bruno Modern Fortran is an array based language. In many respects very similar to MATLAB. Whole array assignments, array slicing using the colon : notation, using non-unit stepping in the array slicing notation, element-wise operations when using arrays with operators (* in Fortran is equivalent to .* in MATLAB, etc.), built-in support for matrix multiplication and dot products and sums, scientific functions operate on arrays element-wise, etc etc are all part of the language. Array slices passed to subroutines can effectively be passed by reference, even when the slice dimensions use non-unit stepping so the underlying data is non-contiguous. The programmer doesn't even have to deal with it in the subroutine, the underlying memory indexing is done by the compiler for you. No unnecessary data copying is done. Fortran pointers carry not only the address of the target but also the dimensions and any non-unit stepping of the dimensions. Fortran pointers are automatically dereferenced when used in an array context and can be treated just like they were the original array (e.g, they can be passed directly to a routine expecting an array as input). Dynamically allocated variables can always be tested to see if they are currently allocated, and are automatically deallocated when they go out of scope, preventing memory leaks. And of course compiled code is very fast. For scientific programming and array manipulation it is quite nice. For example, suppose A, B, and C are all 5x5 arrays. Is the following Fortran or MATLAB? A = B + C; A(2:3,3:5) = B(1:2,2:4) + sin(C(3:4,1:3)); Answer: Both. James Tursa
From: Bruno Luong on 25 May 2010 15:55 "James Tursa" <aclassyguy_with_a_k_not_a_c(a)hotmail.com> wrote in message <hth94h$6m7$1(a)fred.mathworks.com>... > > > For example, suppose A, B, and C are all 5x5 arrays. Is the following Fortran or MATLAB? > > A = B + C; > A(2:3,3:5) = B(1:2,2:4) + sin(C(3:4,1:3)); > Nice! Hey I might convert my C program to Fortran, using lowercase variable names though. LOL. Bruno
From: Walter Roberson on 25 May 2010 16:01 Rune Allnor wrote: > OK, Fortran might *actually* have been obsolete 39 or 41 years > ago; I take for granted that your memory regarding that aera is > better than mine. It doesn't matter. No one born in the last five > decades needs have anything whatsoever to do with fortran. What language were _you_ programming in 40 years ago, and how did you debug it? What language were you programming in 30 years ago, even? And how did you debug that? Myself, I am not old enough to have been programming 40 years ago, but I took to it fairly quickly about 35 years ago. I have a fair idea of what was realistically commercially available 30 years ago, having worked on a variety of government and high-tech projects (I worked for a consulting firm in that time frame, and then for a telephony company.) 30 years ago, a good debugger was considered to be one that disassembled the machine code into machine mnemonics -- it beat the hex memory dump printouts common 35 years ago.
From: dpb on 25 May 2010 16:39 Walter Roberson wrote: > Rune Allnor wrote: > >> OK, Fortran might *actually* have been obsolete 39 or 41 years >> ago; I take for granted that your memory regarding that aera is >> better than mine. It doesn't matter. No one born in the last five >> decades needs have anything whatsoever to do with fortran. > > What language were _you_ programming in 40 years ago, and how did you > debug it? CSC version of FORTRAN IV for the Philco 2000, mostly, and feeling blessed for that level as opposed to the Philco FORTRAN II-like alternative or only machine code... > What language were you programming in 30 years ago, even? And how did > you debug that? That would've mostly been the CDC FORTRANs then; I forget the time frame of which version levels were when, precisely, w/ a little COMPASS for good measure thrown in... And, indeed debuggers weren't much of an option; it wasn't until not much before the 30-yr ago mark there was even a single user-accessible terminal to the Cyber-7600. Employer was commercial nuclear reactor vendor; the 6600 replace the Philco subsequently upgraded to the 7600. --
From: Luka Djigas on 25 May 2010 18:08
On Tue, 25 May 2010 10:52:19 -0700 (PDT), Rune Allnor <allnor(a)tele.ntnu.no> wrote: >OK, Fortran might *actually* have been obsolete 39 or 41 years >ago; I take for granted that your memory regarding that aera is >better than mine. It doesn't matter. No one born in the last five >decades needs have anything whatsoever to do with fortran. > >Rune Upon reading something like this, my mind immediatelly wonders to the immortal words of Charlie Brown and Abraham Lincoln; "Good grief!" (Charlie Brown) "It is better to be silent and be thought a fool than to speak and remove all doubt. " (Lincoln) -- Luka |