fivemack: (Default)
[personal profile] fivemack
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?

Date: 2007-07-02 01:27 pm (UTC)
fanf: (Default)
From: [personal profile] fanf
If you want to borrow my copy of the F programming language, feel free to pop round and pick it up. F is a fairly sane subset of Fortran 90; there are F-specific compilers available, but you can also use it as a style guide for using Fortran in a modern style. (The most obvious oddity is that they omitted DO WHILE (?!) but some others are mentioned in http://www.swcp.com/~walt/FJ/9611/issue.html#giants)

March 2024

S M T W T F S
     12
3456789
10111213141516
17181920212223
24 252627282930
31      

Most Popular Tags

Page Summary

Style Credit

Expand Cut Tags

No cut tags
Page generated Sep. 26th, 2025 11:36 pm
Powered by Dreamwidth Studios