www.digitalmars.com         C & C++   DMDScript  

digitalmars.D - Why Physicists Still Use Fortran

reply Walter Bright <newshound2 digitalmars.com> writes:
http://moreisdifferent.com/2015/07/16/why-physicsts-still-use-fortran/

Some good information there!
Oct 15 2017
next sibling parent 12345swordy <alexanderheistermann gmail.com> writes:
On Sunday, 15 October 2017 at 22:09:21 UTC, Walter Bright wrote:
 http://moreisdifferent.com/2015/07/16/why-physicsts-still-use-fortran/

 Some good information there!
A language similar to matlab when handling arrays? I recall hating the damn thing when using it for graphics programming, it certainly doesn't help when you have a terrible teacher who should have retire already. Alex
Oct 15 2017
prev sibling next sibling parent reply "H. S. Teoh" <hsteoh quickfur.ath.cx> writes:
On Sun, Oct 15, 2017 at 03:09:21PM -0700, Walter Bright via Digitalmars-d wrote:
 http://moreisdifferent.com/2015/07/16/why-physicsts-still-use-fortran/
 
 Some good information there!
1-based array indexing... I don't know, but I've become so accustomed to 0-based indexing that I doubt I'll ever be able to get used to a language with 1-based indexing. Or whether D will ever be able to challenge Fortran in this respect. :P T -- Questions are the beginning of intelligence, but the fear of God is the beginning of wisdom.
Oct 15 2017
next sibling parent reply Walter Bright <newshound2 digitalmars.com> writes:
On 10/15/2017 5:26 PM, H. S. Teoh wrote:
 1-based array indexing...  I don't know, but I've become so accustomed
 to 0-based indexing that I doubt I'll ever be able to get used to a
 language with 1-based indexing.  Or whether D will ever be able to
 challenge Fortran in this respect. :P
I don't want to even try 1 based. All my learned behaviors with arrays would just produce corrupt code. It's why I don't dare try driving in England.
Oct 15 2017
next sibling parent reply Manu <turkeyman gmail.com> writes:
On 15 Oct. 2017 6:40 pm, "Walter Bright via Digitalmars-d" <
digitalmars-d puremagic.com> wrote:

On 10/15/2017 5:26 PM, H. S. Teoh wrote:

 1-based array indexing...  I don't know, but I've become so accustomed
 to 0-based indexing that I doubt I'll ever be able to get used to a
 language with 1-based indexing.  Or whether D will ever be able to
 challenge Fortran in this respect. :P
I don't want to even try 1 based. All my learned behaviors with arrays would just produce corrupt code. It's why I don't dare try driving in England. Haha, incidentally, I've just moved to LA, and I'm failing to convince myself I won't die if I try and drive here ;) .. I'm still chickening out.
Oct 15 2017
next sibling parent reply Walter Bright <newshound2 digitalmars.com> writes:
On 10/15/2017 10:09 PM, Manu wrote:
 Haha, incidentally, I've just moved to LA, and I'm failing to convince myself
I 
 won't die if I try and drive here ;) .. I'm still chickening out.
LA? Cool! (Don't watch "To Live and Die in LA") Or just get a used "Yank Tank" and you'll be fine.
Oct 15 2017
parent reply Manu <turkeyman gmail.com> writes:
On 15 Oct. 2017 11:50 pm, "Walter Bright via Digitalmars-d" <
digitalmars-d puremagic.com> wrote:

On 10/15/2017 10:09 PM, Manu wrote:

 Haha, incidentally, I've just moved to LA, and I'm failing to convince
 myself I won't die if I try and drive here ;) .. I'm still chickening out.
LA? Cool! (Don't watch "To Live and Die in LA") Or just get a used "Yank Tank" and you'll be fine. Hah. That would violate every principle I hold ;) And besides, I'm pretty sure I'm only allowed to have an all-electric in Southern California!
Oct 16 2017
parent Stefan Koch <uplink.coder googlemail.com> writes:
On Monday, 16 October 2017 at 15:22:30 UTC, Manu wrote:
 On 15 Oct. 2017 11:50 pm, "Walter Bright via Digitalmars-d" < 
 digitalmars-d puremagic.com> wrote:

 On 10/15/2017 10:09 PM, Manu wrote:

 Haha, incidentally, I've just moved to LA, and I'm failing to 
 convince myself I won't die if I try and drive here ;) .. I'm 
 still chickening out.
LA? Cool! (Don't watch "To Live and Die in LA") Or just get a used "Yank Tank" and you'll be fine. Hah. That would violate every principle I hold ;) And besides, I'm pretty sure I'm only allowed to have an all-electric in Southern California!
You hold principles ?
Oct 16 2017
prev sibling parent codephantom <me noyb.com> writes:
On Monday, 16 October 2017 at 05:09:04 UTC, Manu wrote:
 Haha, incidentally, I've just moved to LA, and I'm failing to 
 convince myself I won't die if I try and drive here ;) .. I'm 
 still chickening out.
Someone once said, that the biggest problem with Fortran, is that people actually use it. Perhaps the same can be said for L.A ;-)
Oct 20 2017
prev sibling next sibling parent "H. S. Teoh" <hsteoh quickfur.ath.cx> writes:
On Sun, Oct 15, 2017 at 10:09:04PM -0700, Manu via Digitalmars-d wrote:
    On 15 Oct. 2017 6:40 pm, "Walter Bright via Digitalmars-d"
    <[1]digitalmars-d puremagic.com> wrote:
[...]
      I don't want to even try 1 based. All my learned behaviors with
      arrays would just produce corrupt code.
 
      It's why I don't dare try driving in England.
 
    Haha, incidentally, I've just moved to LA, and I'm failing to
    convince myself I won't die if I try and drive here ;) .. I'm still
    chickening out.
[...] I've driven in LA before, even though I don't live there. It's not half as bad as people make it sound. You just have to know the driving culture of the place and act accordingly, that is, be assertive and clear exactly what your intention is, and do not hesitate once you make a decision. Or, in more practical terms, know what you want, and *take* it. LA drivers know how to read the cues -- as long as you follow through with what they think you will do. It's when you waver and send mixed signals that it gets dangerous. They hate it when you look like you're unsure, and it tends to make them angry and more aggressive. Of course, this does not preclude safety considerations; in fact, it means that you have to be absolutely sure what you want (and the safety of what you want) before you even begin, lest you find yourself in a dangerous situation with no safe way out. T -- What do you call optometrist jokes? Vitreous humor.
Oct 16 2017
prev sibling next sibling parent reply Manu <turkeyman gmail.com> writes:
On 16 October 2017 at 10:56, H. S. Teoh via Digitalmars-d <
digitalmars-d puremagic.com> wrote:

 On Sun, Oct 15, 2017 at 10:09:04PM -0700, Manu via Digitalmars-d wrote:
    On 15 Oct. 2017 6:40 pm, "Walter Bright via Digitalmars-d"
    <[1]digitalmars-d puremagic.com> wrote:
[...]
      I don't want to even try 1 based. All my learned behaviors with
      arrays would just produce corrupt code.

      It's why I don't dare try driving in England.

    Haha, incidentally, I've just moved to LA, and I'm failing to
    convince myself I won't die if I try and drive here ;) .. I'm still
    chickening out.
[...] I've driven in LA before, even though I don't live there. It's not half as bad as people make it sound. You just have to know the driving culture of the place and act accordingly, that is, be assertive and clear exactly what your intention is, and do not hesitate once you make a decision. Or, in more practical terms, know what you want, and *take* it. LA drivers know how to read the cues -- as long as you follow through with what they think you will do. It's when you waver and send mixed signals that it gets dangerous. They hate it when you look like you're unsure, and it tends to make them angry and more aggressive. Of course, this does not preclude safety considerations; in fact, it means that you have to be absolutely sure what you want (and the safety of what you want) before you even begin, lest you find yourself in a dangerous situation with no safe way out.
That... and they drive on the wrong side of the road! ;)
Oct 16 2017
parent Steven Schveighoffer <schveiguy yahoo.com> writes:
On 10/16/17 2:42 PM, Manu wrote:

 That... and they drive on the wrong side of the road! ;)
We drive on the right side. Both literally and philosophically :) Seriously though, driving in LA is nothing compared to an eastern city where everything was determined by horse-cart paths. I drove a car in England once. The most difficult thing to do was coming back home. There, I was acutely aware of the awkwardness, given that the shifter was on my left and not the right. When I came back, going to make turns, I was second guessing everything! -Steve
Oct 16 2017
prev sibling next sibling parent Jonathan M Davis <newsgroup.d jmdavisprog.com> writes:
On Monday, October 16, 2017 11:42:56 Manu via Digitalmars-d wrote:
 That... and they drive on the wrong side of the road! ;)
http://jokes.cc.com/funny-lookin--good/yn3vw9/the-wrong-way - Jonathan M Davis
Oct 16 2017
prev sibling next sibling parent reply "H. S. Teoh" <hsteoh quickfur.ath.cx> writes:
On Mon, Oct 16, 2017 at 11:42:56AM -0700, Manu wrote:
[...]
    That... and they drive on the wrong side of the road! ;)
[...] Ah! Well, that is a different story, then. :D My hometown also drives on the wrong side of the road (I learnt driving after I left), and I'm also still chickening out, in spite of having driven in LA. :P Well, that, and over there there are no driving laws -- the so-called "laws" are in practice only rarely-heeded recommendations. You find 3 lanes of moving cars on a 2-lane road, and people parallel-park leaving only 2 inches between cars. Nope, not for me. :D I suppose this is like Walter not daring to write code with 1-based arrays. :D On that note, though, in D I only rarely actually need to specify explicit indices. Foreach and generic code alleviates most cases of explicit indexing I'd normally write in C/C++ code, and I wouldn't be surprised if much of my code could actually be ported to 1-based indexing with only minor changes. But I suppose if you're doing matrix/tensor math, you can't really avoid this. T -- Democracy: The triumph of popularity over principle. -- C.Bond
Oct 16 2017
parent jmh530 <john.michael.hall gmail.com> writes:
On Monday, 16 October 2017 at 18:56:03 UTC, H. S. Teoh wrote:
 I suppose this is like Walter not daring to write code with 
 1-based arrays. :D  On that note, though, in D I only rarely 
 actually need to specify explicit indices.  Foreach and generic 
 code alleviates most cases of explicit indexing I'd normally 
 write in C/C++ code, and I wouldn't be surprised if much of my 
 code could actually be ported to 1-based indexing with only 
 minor changes.

 But I suppose if you're doing matrix/tensor math, you can't 
 really avoid this.
I always thought slicing was a more important difference for 0 or 1-based indexing, rather than loops. Consider D's A[m..n] vs. Matlab's A[m:n]. Matlab's is easier to explain to someone with a math background because you get A[m] through A[n, instead of A[m] through A[n-1] in Ds. However, D's A[m..n].length = n - m, whereas Matlab's length(A[m:n])= n - m + 1. Thus, you often find yourself adjusting formulae all over the place to account for the extra "+1". Nevertheless, if you have more of a mathematics background, you always need to remember that if you wanted A[m:n] in Matlab, you need A[(m - 1)..n] to get the equivalent in D.
Oct 16 2017
prev sibling parent reply XavierAP <n3minis-git yahoo.es> writes:
Good read, and totally agree there's no point in trying to 
convince programmers to use a new tool other than their own 
choice. C++ evangelists should read this.

On Monday, 16 October 2017 at 01:36:57 UTC, Walter Bright wrote:
 On 10/15/2017 5:26 PM, H. S. Teoh wrote:
 1-based array indexing...  I don't know, but I've become so 
 accustomed
 to 0-based indexing that I doubt I'll ever be able to get used 
 to a
 language with 1-based indexing.  Or whether D will ever be 
 able to
 challenge Fortran in this respect. :P
I don't want to even try 1 based. All my learned behaviors with arrays would just produce corrupt code. It's why I don't dare try driving in England.
We are all stuck with 0-based and I don't think I could easily change either or that it would be worth it... But I do think 1-based would have been superior, if we could go way back in time. Dennis Ritchie did only two things wrong: placing the * at the wrong side in pointer declarations; and making arrays as unsafe, raw pointers -- and in consequence providing two redundant ways to do one same thing: &arr[2] or arr+2
Oct 18 2017
parent Stefan Koch <uplink.coder googlemail.com> writes:
On Wednesday, 18 October 2017 at 13:42:04 UTC, XavierAP wrote:
 Dennis Ritchie did only two things wrong: placing the * at the 
 wrong side in pointer declarations; and making arrays as 
 unsafe, raw pointers -- and in consequence providing two 
 redundant ways to do one same thing: &arr[2] or arr+2
You missed one :) &2[arr]
Oct 18 2017
prev sibling parent reply qznc <qznc web.de> writes:
On Monday, 16 October 2017 at 00:26:20 UTC, H. S. Teoh wrote:
 On Sun, Oct 15, 2017 at 03:09:21PM -0700, Walter Bright via 
 Digitalmars-d wrote:
 http://moreisdifferent.com/2015/07/16/why-physicsts-still-use-fortran/
 
 Some good information there!
1-based array indexing... I don't know, but I've become so accustomed to 0-based indexing that I doubt I'll ever be able to get used to a language with 1-based indexing. Or whether D will ever be able to challenge Fortran in this respect. :P
Dijkstra made a good argument for zero-based: https://www.cs.utexas.edu/users/EWD/transcriptions/EWD08xx/EWD831.html
Oct 16 2017
parent kdevel <kdevel vogtner.de> writes:
On Monday, 16 October 2017 at 09:06:01 UTC, qznc wrote:
 Dijkstra made a good argument for zero-based:
 https://www.cs.utexas.edu/users/EWD/transcriptions/EWD08xx/EWD831.html
Donald Knuth on that proposal ;-) Edsger Dijkstra's Retirement Banquet - Part 8 of 13 https://www.youtube.com/watch?v=6gH4bWuMUEs&t=1m23s
Oct 17 2017
prev sibling next sibling parent Jonathan M Davis <newsgroup.d jmdavisprog.com> writes:
On Sunday, October 15, 2017 17:26:20 H. S. Teoh via Digitalmars-d wrote:
 On Sun, Oct 15, 2017 at 03:09:21PM -0700, Walter Bright via Digitalmars-d 
wrote:
 http://moreisdifferent.com/2015/07/16/why-physicsts-still-use-fortran/

 Some good information there!
1-based array indexing... I don't know, but I've become so accustomed to 0-based indexing that I doubt I'll ever be able to get used to a language with 1-based indexing. Or whether D will ever be able to challenge Fortran in this respect. :P
For an algorithms class that I took in college, the book used 1-based indexing for everything, and it drove me nuts. I guess that it was written for mathematicians and not programmers. - Jonathan M Davis
Oct 15 2017
prev sibling next sibling parent jmh530 <john.michael.hall gmail.com> writes:
On Sunday, 15 October 2017 at 22:09:21 UTC, Walter Bright wrote:
 http://moreisdifferent.com/2015/07/16/why-physicsts-still-use-fortran/

 Some good information there!
The article could have mentioned the restrict annotation in C. They mention the issue indirectly because Fortran programmers don't worry about pointers compared to C programmers. The crucial issue is that Fortran guarantees one variable can't alias another by default. There are compiler optimizations from ensuring this is the case. That's the reason restrict was created for C, so that it could make the same guarantee as Fortran. The whole 0-based vs. 1-based is a small issue. If all your doing is matrix math, then 1-based is fine (esp. for a first language), but 0-based is better for a general purpose language.
Oct 15 2017
prev sibling next sibling parent reply crimaniak <crimaniak gmail.com> writes:
On Sunday, 15 October 2017 at 22:09:21 UTC, Walter Bright wrote:
 http://moreisdifferent.com/2015/07/16/why-physicsts-still-use-fortran/

 Some good information there!
Especially comments: George Michaelson • a day ago One of the saddest moments of my career in computer centre helpdesk was talking to a chemical engineering student whose PhD basically evaporated in smoke, as I showed them the 'interesting' experimental results of their model were the outcome of using un-initialized global common in a huge fortran program they'd written.
Oct 17 2017
parent reply Steven Schveighoffer <schveiguy yahoo.com> writes:
On 10/17/17 4:40 AM, crimaniak wrote:
 On Sunday, 15 October 2017 at 22:09:21 UTC, Walter Bright wrote:
 http://moreisdifferent.com/2015/07/16/why-physicsts-still-use-fortran/

 Some good information there!
Especially comments: George Michaelson • a day ago One of the saddest moments of my career in computer centre helpdesk was talking to a chemical engineering student whose PhD basically evaporated in smoke, as I showed them the 'interesting' experimental results of their model were the outcome of using un-initialized global common in a huge fortran program they'd written.
Ouch! I had an experience like that once. I worked at a company that bought a one-man show's company who had an impressive load-balancing software we wanted to incorporate in our system. About 1-2 years into him working at our company, one of our developers tested it using webbench (all testing had been done by this guy previously), and was getting terrible numbers. But his tests always showed really good numbers. Turns out he was "timing" his benchmarks by starting a separate thread, then sleeping for 1 second, and then measuring how many requests he handled in that "1 second". But of course, the system was super-loaded, so the sleep was going way longer than 1 second, and his numbers looked great! After we fixed it, the numbers looked horrific and matched webbench. When this was found out, we kind of moved away from that software, as we were moving our focus to hardware. I can't imagine how that must have felt, though. -Steve
Oct 17 2017
parent reply Meta <jared771 gmail.com> writes:
On Tuesday, 17 October 2017 at 13:09:37 UTC, Steven Schveighoffer 
wrote:
 Ouch! I had an experience like that once.

 I worked at a company that bought a one-man show's company who 
 had an impressive load-balancing software we wanted to 
 incorporate in our system.

 About 1-2 years into him working at our company, one of our 
 developers tested it using webbench (all testing had been done 
 by this guy previously), and was getting terrible numbers. But 
 his tests always showed really good numbers.

 Turns out he was "timing" his benchmarks by starting a separate 
 thread, then sleeping for 1 second, and then measuring how many 
 requests he handled in that "1 second". But of course, the 
 system was super-loaded, so the sleep was going way longer than 
 1 second, and his numbers looked great! After we fixed it, the 
 numbers looked horrific and matched webbench.

 When this was found out, we kind of moved away from that 
 software, as we were moving our focus to hardware. I can't 
 imagine how that must have felt, though.

 -Steve
This is just plain negligence on upper management's part. I can't believe they got that far without doing due diligence to verify his results.
Oct 17 2017
parent jmh530 <john.michael.hall gmail.com> writes:
On Tuesday, 17 October 2017 at 16:31:07 UTC, Meta wrote:
 This is just plain negligence on upper management's part. I 
 can't believe they got that far without doing due diligence to 
 verify his results.
Of course you're supposed to perform due diligence before buying something. Not 1-2 years after...
Oct 17 2017
prev sibling next sibling parent reply Kagamin <spam here.lot> writes:
 Arrays (or in physics-speak, matrices)
 multiplied together quite intuitively as:
 C = A*B gives an element-by-element multiplication of A and B, 
 assuming A and B are the same size.
Ehhh?
Oct 17 2017
parent Ilya Yaroshenko <ilyayaroshenko gmail.com> writes:
On Tuesday, 17 October 2017 at 13:36:59 UTC, Kagamin wrote:
 Arrays (or in physics-speak, matrices)
 multiplied together quite intuitively as:
 C = A*B gives an element-by-element multiplication of A and B, 
 assuming A and B are the same size.
Ehhh?
The same true for ndslice. ndslice returns lazy result.
Oct 17 2017
prev sibling parent Kagamin <spam here.lot> writes:
Also: https://losc.ligo.org/software/
Oct 19 2017