Re: MATLAB <-> FORTRAN
- From: coolidge <coolidgerob@xxxxxxxxxxx>
- Date: Wed, 6 Jun 2007 15:03:10 -0400
Oh boy, Ax=b. This is a research question even until today. Lots
(LOTS!) of algorithms have been devised depending on some properties
of the matrix you have some solvers are better (WAY BETTER!) than
others. When you do A\b it just calls the basic solvers Matlab knows,
in some cases Gauss Elimination. Matlab sometimes choose to use a
better solver by itself, however, in many cases, it is slow. Gauss
Elimination with partial pivoting is O(N^3).
I imagine your matrix is not huge, otherwise A\b could be very slow.
In this case you can find a Gauss Solver, or LU factorization solver.
Gauss with partial pivoting is the brutal force and attack-all
solution for nonsingular matrices. If your matrix is singular Matlab
actually uses least squares. In this case it is NOT a Ax=b problem
anymore.
Look at Numerical Recipes in Fortran. The book should have the
subroutine you need. btw, the best solution to your problem is, I
bet, find a pal with Matlab and compile your code there.
Ally wrote:
95.
I empathise with you.
I've been faced with the same problem several times.
In all cases, I've bitten the bullet and converted to Fortran
canActually, it's not too bad. Fortran 95 is vectorised, so you
functionsconvert most lines as they stand.
But you need to convert for..next loops to do... end do, and
if...end
to if...endif, etc.
The most difficult thing is finding equivalent built-in
thatsuchwritten
as interp1.
But if you use Google, you can find them. Mostly, they're
in
Fortran 77 or even Fortran 4, but they are usually debugged and
ready
to use.
Recently I was looking for spline interpolation and I found
usedthe
old Fortran 77 version I located is almost certainly the one
.in
Matlab.
Good Luck.
Thanks for the advice. Actually I have already started it. My
biggest
problem is "solving linear systems of n equations with n unknowns",
ie, AX=B. As you know, tihs can simply be done in MATLAB using X =
A
\ B. The operator "\" in MATLAB is super sophosticated and
powerful,
it actually can solves any system of equations that I have in my
design program, correct and fast. In FORTRAN, however and as you
said, I need a subroutine for this. I have tried the Recipes and
Netlib routines (including gauss-elimination method), but they all
gave me "singularity" error message. This is the last piece of the
chain, if I find it I am there.
I have spent a lot of time on this, searched google, etc.. but was
not able to find such a nice and decent routine for solving AX=B.
Please, if you know where I can find it, let me know. I don't care
if
it is slow, as long as it works, I am happy.
Thank you!
- Follow-Ups:
- Re: MATLAB <-> FORTRAN
- From: Scott Seidman
- Re: MATLAB <-> FORTRAN
- References:
- MATLAB <-> FORTRAN
- From: Ally
- Re: MATLAB <-> FORTRAN
- From: Scott Seidman
- Re: MATLAB <-> FORTRAN
- From: NZTideMan
- Re: MATLAB <-> FORTRAN
- From: Ally
- MATLAB <-> FORTRAN
- Prev by Date: Avoid Depth Contour lines from matlab image
- Next by Date: Re: MATLAB <-> FORTRAN
- Previous by thread: Re: MATLAB <-> FORTRAN
- Next by thread: Re: MATLAB <-> FORTRAN
- Index(es):
Relevant Pages
|