- Als neu kennzeichnen
- Lesezeichen
- Abonnieren
- Stummschalten
- RSS-Feed abonnieren
- Kennzeichnen
- Anstößigen Inhalt melden
h(1:3) = TriShell%h(1:3)
em = TriShell%em
h and em are both arrays, which method of assignment is Fortran preferred now?
Link kopiert
- Als neu kennzeichnen
- Lesezeichen
- Abonnieren
- Stummschalten
- RSS-Feed abonnieren
- Kennzeichnen
- Anstößigen Inhalt melden
Simpler is better. The first version makes the compiler work harder to optimize the assignment. It is also much clearer to the human reading the code. I touched on this in Doctor, it hurts when I do this! - Doctor Fortran (stevelionel.com)
- Als neu kennzeichnen
- Lesezeichen
- Abonnieren
- Stummschalten
- RSS-Feed abonnieren
- Kennzeichnen
- Anstößigen Inhalt melden
The newer Fortran standards default to realloc_lhs = .true.
When the destination array is allocatable, for example your em on lhs,
this may result in em being deallocated (if allocated) then allocated to the size of TriShell%em
This may (used to) occur even though em is the same size as TriShell%em.
Intel may have fixed this (tested for same size and bounds then avoid reallocation) with the newer ifort and/or ifx.
You can use:
em(:) = TriShell%em
or
em(:) = TriShell%em(:)
or
use the explicit bounds for each array
This will assure no reallocation of lhs (should em be allocatable).
But expect error should em not be allocated .OR. size not the same.
Jim Dempsey
- Als neu kennzeichnen
- Lesezeichen
- Abonnieren
- Stummschalten
- RSS-Feed abonnieren
- Kennzeichnen
- Anstößigen Inhalt melden
Steve:
https://www-cs-faculty.stanford.edu/~knuth/address.html
was more fun to read, you should definitely rewrite BIM or SIM or whatever.
If you know any of these people let them know.
Jim:
It is English right? LOL
use the explicit bounds for each array === I will.
- Als neu kennzeichnen
- Lesezeichen
- Abonnieren
- Stummschalten
- RSS-Feed abonnieren
- Kennzeichnen
- Anstößigen Inhalt melden
@JohnNichols wrote:
Steve:
https://www-cs-faculty.stanford.edu/~knuth/address.html
was more fun to read, you should definitely rewrite BIM or SIM or whatever.
I wrote an extended MIX interpreter (I called it XIM, in IBM 360 assembler) in college (mid-70s), supporting floating point and all of the extensions he had proposed. Wrote a letter to Knuth about it, he wrote back with encouragement. I had also asked when volume 4 of TAOCP was coming out, he basically said "don't hold your breath". I do now have the set that includes "volume 4A". Brings back memories, it does.
- Als neu kennzeichnen
- Lesezeichen
- Abonnieren
- Stummschalten
- RSS-Feed abonnieren
- Kennzeichnen
- Anstößigen Inhalt melden
@Steve_Lionel Wasn't MIX replaced by MMIX (a RISC machine)?
Also, in a letter I received in February 1990 from Knuth regarding volume 4 being published, he said "soon".
Doc (not an Intel employee or contractor)
[Maybe Windows 12 will be better]
- Als neu kennzeichnen
- Lesezeichen
- Abonnieren
- Stummschalten
- RSS-Feed abonnieren
- Kennzeichnen
- Anstößigen Inhalt melden
- Als neu kennzeichnen
- Lesezeichen
- Abonnieren
- Stummschalten
- RSS-Feed abonnieren
- Kennzeichnen
- Anstößigen Inhalt melden
- Als neu kennzeichnen
- Lesezeichen
- Abonnieren
- Stummschalten
- RSS-Feed abonnieren
- Kennzeichnen
- Anstößigen Inhalt melden
Yes.
Doc (not an Intel employee or contractor)
[Maybe Windows 12 will be better]
- Als neu kennzeichnen
- Lesezeichen
- Abonnieren
- Stummschalten
- RSS-Feed abonnieren
- Kennzeichnen
- Anstößigen Inhalt melden
No - that was 45 years ago!
- RSS-Feed abonnieren
- Thema als neu kennzeichnen
- Thema als gelesen kennzeichnen
- Diesen Thema für aktuellen Benutzer floaten
- Lesezeichen
- Abonnieren
- Drucker-Anzeigeseite