5 ms·
Modern FORTRAN looks more like Matlab than FORTRAN 77. The syntax has been completely overhauled since at least ‘95. For a while I was translating my Matlab co
by thanatropism 8y ago
Modern FORTRAN looks more like Matlab than FORTRAN 77. The syntax has been completely overhauled since at least ‘95.
For a while I was translating my Matlab codes to FORTRAN; it was surprisingly easy. But I was being too naive with array resizings in Matlab and most of the speed gain (which was like 2-3 orders of magnitude) could be achieved in Matlab itself by preallocating memory.
To this day I have the nervous tick of initializing arrays with zeros even in numpy.
- rufius 8y ago> To this day I have the nervous tick of initializing arrays with zeros even in numpy. I dunno - I wouldn’t call that a nervous tick. If you know or have a good idea of how much memory you need, then it only seems polite to let the runtime/OS know ahead of time. I think of it like RSVP’ing to a dinner party. Host is very appreciative when they know how many people they’re serving.
- bobbylarrybobby 8y agoIt is a tic — if you plan to fill the array anyway there’s no need to set its values on initialization
- sgillen 8y agoNo but in dynamic languages just making the array before hand can greatly increase efficiency.
- whatshisface 8y ago>To this day I have the nervous tick of initializing arrays with zeros even in numpy. The typical way to create arrays in Numpy is with `np.zeros(size)`. What is it that you're doing?
- dreamcompiler 8y agoJust a mild FYI: That word is 'tic' without the 'k'. Pronounced the same, but a different word.