linear solver, and some questions on Fortran_C++

Dear Friends,

I am trying to convert my code from FORTRAN (CVF6.6) into C++ visual studio 2005, because i need to link my code to other languages (e.g, Matlab) and i found that it is easier to write my codes in C++ if i want to call foreign languages(?).
I have some questions:
1- which linear solver do you recommend to solve matrix: Ax=b, which is real, almost symmetric, highly sparse (at most 13 diagonal) with a very BIG size (e.g., 1000000 rows and 1000000 cols).

2- I found some programs on the web which could INTERFACE C anf Fortran. I was doubtful that maybe I can start to write my codes from now in C++ and do not convert the old codes and just interface them to my new C++ codes. Do you think it is a better decision? my old code in FORTRAN is almost 1500 lines.

Best regards,
Amir


I know nothing about FORTRAN, so I don't know how much those lines are worth. I also don't know how complex the program is and, therefore, how much effort it would be to translate.

If the program is so short, you might want to try translating it to C++. I'm pretty sure for a language as old as FORTRAN, the line count should go down.

You should definitely consider an interpreter or compiling your FORTRAN code to object files or to libraries, though. Translation, and all coding, could introduce new bugs to your supposedly working code.
An interpreter would run the old, portable, code directly, so if you ever changed platform you'd just have to change the interpreter. But it's slower.
Compiling the code and linking to it would be faster, but you'd need to recompile it if you needed to change to a different platform.
Translation seems like a more long-lasting solution, but it has its downsides.

Based on what I just told you, see what is the solution that better fits your needs.
I think one thing you should do before converting is to create a number of unit tests on your old code so that you are 100% certain that they new code behaves exactly as the old.

In general you can keep the FORTRAN code and create a library using the MS FORTRAN but if it is as you only 1500 lines then converting it may be the better alternative. Especially true if you are more familiar with C++ than FORTRAN.

There is a FOR_C converter I saw some 15 years back but the code that comes out is just crap so better not go that way. OK maybe that works better nowadays ;)

That said FORTRAN's strength is that type of calculations solving matrix etc. It maybe be a bit of a struggle to convert to pure C++ so you should check out other libraries like boost(.org) to see what math libraries they got to avoid reinventing the wheel again.

Topic archived. No new replies allowed.