fivemack (fivemack) wrote,
fivemack
fivemack

Becoming a Proper Scientific Programmer

This week, I am mostly learning Fortran 90.

It's a language which nicely matches the sort of code I like to write; arrays as really first-class language elements are good, and the DWIM read() and write() statements avoid some of the more tiresome boilerplate that typed languages attach to I/O.

I assume there are Fortranophones among my readers; is there a nicer way to write


atomcounts(fooi(1),fooi(2),fooi(3)) = &
1+atomcounts(fooi(1),fooi(2),fooi(3))
?

The obvious
atomcounts(fooi) = atomcounts(fooi)+1
translates as
atomcounts(fooi(1)) = 1+atomcounts(fooi(1))
atomcounts(fooi(2)) = 1+atomcounts(fooi(2))
atomcounts(fooi(3)) = 1+atomcounts(fooi(3))


which is a rank error since atomcounts is a 3D array; also, is there an increment-in-place procedure that I'm missing?
Tags: fortran, geek
Subscribe
  • Post a new comment

    Error

    default userpic

    Your IP address will be recorded 

    When you submit the form an invisible reCAPTCHA check will be performed.
    You must follow the Privacy Policy and Google Terms of use.
  • 2 comments