Intel® Fortran Compiler
Build applications that can scale for the future with optimized code designed for Intel® Xeon® and compatible processors.

Optimal Code

JohnNichols
Valued Contributor III
3,027 Views
AL(I)= sqrt(XM(I)*XM(I) + YM(I)*YM(I))

Is there a faster way to solve this problem in fortran than the long method?

0 Kudos
24 Replies
mecej4
Honored Contributor III
425 Views

The solution of linear simultaneous equations using determinants is fine for application to 3 X 3 or 4 X 4 matrices, with symbolic or back-of-the-envelope calculations. This algorithm is a textbook example of a spectacularly bad choice for use on larger systems in a computer. Its complexity is n! in contrast to the n² complexity of Gaussian elimination, and we see users writing in these forums of solving systems with n as large as millions. Compare n² with n!  for n = 1 million!

0 Kudos
JohnNichols
Valued Contributor III
384 Views

Jim:

Thanks,  the cycle one is really just a modified form of go to, bit easier to understand. 

Findloc is a new one on me,  that is what I like about your posts, you learn something almost every time.  

@mecej4 

the problem is these guys would have learnt engineering in the early 1960's and so Fortran and numerical analysis would not have been high on the curricula.  Also it was 4 guys working together over ten years on small problems, the matrix size was never greater than 15, they would have had to drop the problem in card block at a central location and probably only did one run per day, as occurred at Newcastle Uni in the late 1970s. Once someone had something working, you would not change it, particularly if he was your chair. Never argue with a chair and borrow someone's cards.  So the matrix inversion had to be written before '65. 

I am really interested in the analysis of the rate of creep and change in E for concrete and steel as the beam ages, and this is a spectacularly good idea.   

My mistake is I should have substituted in PARDISO from you much earlier, but I assumed band was normal till I had typed it in.  

 

I wonder what things we do now that our grandchildren will say, why did they not know better?

JMN

0 Kudos
JohnNichols
Valued Contributor III
375 Views

The interesting numerical math error that stopped the programming running and sent it into a useless loop was 

 

 

IF (RR .eq. 0.0)   THEN

 

RR was E-19 but it did not catch it, I wonder how it worked on the old machine?   We forgot that the 1960's would have been kindergarten for computer people, think of all the things they did not know. 

 

IF (ABS(RR) .LE. 0.00001)   THEN

 

Worked a treat,  that and finding the last go to mistake with a lot of write statements, gets the initial zero time working,  their answer is only about 0.5% in error. 

Now to read and understand their time method of decay.  

Thanks for all the help. 

 

Interesting question this helps answer,  Owner:  How long will our bridge last?   Me:  What probability of failure will you accept?  Owner: You have to tell us.  Me:  Well the codes allow a Beta of 2.5, which may explain why so many buildings collapse.   Scratch head there is no real answer.  

 

0 Kudos
JohnNichols
Valued Contributor III
355 Views

There is a note in the thesis that the team tried matrix methods for solving the linear equations, but it took to many routines and was slow.  

Hindsight is very powerful. 

0 Kudos
Reply