Commit 49238a8
memopt(safe): drop dead zz/vv/ww arrays and iden in get_odd_straight_with_v4
Bitwise-identical memory optimization of get_odd_straight_with_v4.
- Remove zz(nl,nl), vv(nl*(nl+1)/2) and ww(nl): declared and allocated
but never read/written anywhere in the subroutine (verified by grep on
the v1.5 source). They were also never deallocated -> a memory leak.
zz alone is one full nl x nl array (= 1 "v4 unit").
- Remove the iden(nl,nl) scratch matrix. Instead of building iden and
copying "maux = iden", initialize maux directly:
maux = 0.0d0 ; do x=1,nl: maux(x,x)=1.0d0
Same value, same bit pattern; saves one nl x nl allocation.
No BLAS call, no operation order, no numerics changed.
Standalone Fortran test (n_mode=6, symmetrized v3/v4): max|phi_new-phi_orig| = 0.0 exactly.
Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>1 parent 084c1b2 commit 49238a8
1 file changed
Lines changed: 6 additions & 15 deletions
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
20 | 20 | | |
21 | 21 | | |
22 | 22 | | |
23 | | - | |
| 23 | + | |
24 | 24 | | |
25 | 25 | | |
26 | 26 | | |
| |||
30 | 30 | | |
31 | 31 | | |
32 | 32 | | |
33 | | - | |
34 | | - | |
35 | | - | |
36 | 33 | | |
37 | 34 | | |
38 | 35 | | |
| |||
67 | 64 | | |
68 | 65 | | |
69 | 66 | | |
70 | | - | |
71 | 67 | | |
72 | 68 | | |
73 | 69 | | |
74 | | - | |
75 | | - | |
76 | | - | |
77 | | - | |
78 | | - | |
| 70 | + | |
79 | 71 | | |
80 | 72 | | |
81 | 73 | | |
| |||
100 | 92 | | |
101 | 93 | | |
102 | 94 | | |
103 | | - | |
| 95 | + | |
| 96 | + | |
104 | 97 | | |
105 | | - | |
| 98 | + | |
106 | 99 | | |
107 | 100 | | |
108 | | - | |
| 101 | + | |
109 | 102 | | |
110 | 103 | | |
111 | 104 | | |
112 | 105 | | |
113 | 106 | | |
114 | 107 | | |
115 | 108 | | |
116 | | - | |
117 | | - | |
118 | 109 | | |
119 | 110 | | |
120 | 111 | | |
| |||
0 commit comments