3 ms·
I fell off my chair when I installed R for the first time, and I discovered that I needed a FORTRAN interpreter. Apparently the math libraries written in fortr
by AdrianRossouw 13y ago
I fell off my chair when I installed R for the first time, and I discovered that I needed a FORTRAN interpreter.
Apparently the math libraries written in fortran back in the day have become such a foundational part of analytics, that nobody really wants to re-implement them.
- baldfat 13y agoFORTRAN is an amazing language for some very specific jobs and is still a great tool for a specific job. It's fast does scientific and numerical calculations incredibly fast. I haven't touched Fortran in 20 years though :) I loved me Pascal except the semi-colon key broke on my keyboards.
- alephnil 13y agoThat is not really the reason. The reason is mainly BLAS, that implements some of the most commonly used linear algebra operations (matrix multiplication, matrix solvers, singular value decompositions etc). This is implemented in optimized versions for almost every CPU available. BLAS is written in FORTRAN, but it is not true that it has not been reimplemented. In fact CPU vendors frequently reimplement it tailor made for their CPU. On the other hand, the API is not something that is subject to change. A lot of software expect this to be stable, like Matlab, R, Octave, Numpy, and a lot of others.
- steveklabnik 13y agoMy vague understanding is that Fortran can actually be faster than C in certain numerical calculations because the language doesn't make the same kinds of guarantees. And therefore, Fortran will live forever.
- chromatic 13y agoFortran disallows pointer aliasing and it has some language intrinsics which operate on arrays as a whole, so the compiler can emit processor-specific SIMD instructions. I'm sure that a very clever programmer could use restrict and inline assembly in C to get similar benefits, but you know as well as I do that having the language make these guarantees for you is helpful.
- Solarsail 13y agoPicking a(n extremely small) nit (with a fine tooth comb): Fortran compiler. There are no Fortran interpreters in existence, anywhere, that I've been able to find. For FORTRAN 70, Fortran 90, or any other versions. If someone manages to find an interpreter and proves me wrong, I'd love to hear about it.
- AdrianRossouw 13y agothanks. i actually went back and forth between compiler and interpreter and didn't think to look it up. That'll show me to rely on my hazy memory of something I read five years ago on wikipedia =)
- alephnil 13y agoIt should also be mentioned that when people use Fortran, it is usually because they need the fastest numerical processing available. An interpreter would usually not meet that need. With JIT compilers embedded in interpreters, the difference is blurred, since the result is machine code, unlike traditional bytecode interpreters, that usually are an order of magnitude slower than compiled code. That said, I'm also not aware of any Fortran interpreters, and it would surprise me if there is one.