Fortran Can You Use Nested Subroutines in Fortran95 and How Do You Link Them?

  • Thread starter Thread starter dichotomy
  • Start date Start date
  • Tags Tags
    Fortran Program
AI Thread Summary
In Fortran 95, subroutines cannot be nested within other subroutines. However, it is possible to return arrays from subroutines. To link subroutines in the main program, the INTERFACE-END INTERFACE construction is necessary. The discussion centers around a program designed to solve linear equations using methods like Gauss-Seidel iteration and Gauss-Jordan elimination. The user seeks to rearrange rows within the Gauss-Seidel subroutine to achieve a diagonally dominant matrix and needs to pass this modified matrix back to the subroutine for further processing.
dichotomy
Messages
24
Reaction score
0
basic question really...can you have subroutines nested within subroutines? or are there any other types of subprograms within fortran95 other than functions and subroutines? (need one that can pass back an array)

if you can [use subs within subs], how do you link them? like in the main program you have to use an INTERFACE-END INTERFACE construction to link to the subroutine...

ta in advance
 
Technology news on Phys.org
Not sure about subroutines within a subroutine, gut feeling is that it won't work. As for returning an array, that is possible.
 
erm...could you elaborate? I'm writing a program that solves linear equations with gauss seidel iteration (and gauss/gauss jordan elimination), so there's a main program which calls the various methods as subroutines...

except within the gauss seidel subroutine I want to separate a bit which makes the matrix diagonally dominant(ish)...obviously after rearranging the rows the matrix needs to be passed back to the gauss seidel subroutine.
 
Dear Peeps I have posted a few questions about programing on this sectio of the PF forum. I want to ask you veterans how you folks learn program in assembly and about computer architecture for the x86 family. In addition to finish learning C, I am also reading the book From bits to Gates to C and Beyond. In the book, it uses the mini LC3 assembly language. I also have books on assembly programming and computer architecture. The few famous ones i have are Computer Organization and...
I have a quick questions. I am going through a book on C programming on my own. Afterwards, I plan to go through something call data structures and algorithms on my own also in C. I also need to learn C++, Matlab and for personal interest Haskell. For the two topic of data structures and algorithms, I understand there are standard ones across all programming languages. After learning it through C, what would be the biggest issue when trying to implement the same data...

Similar threads

Replies
59
Views
11K
Replies
5
Views
8K
Replies
5
Views
3K
Replies
4
Views
2K
Replies
22
Views
4K
Replies
6
Views
4K
Replies
5
Views
5K
Back
Top