How are numbers stored in F2 and F3 matrix in Fortran programming?

In summary, the user is asking for clarification on how numbers are stored in the F2 and F3 matrices in a fortran code. They provide a sample input file and their proposed method of storing the numbers. They ask for confirmation on their method and for help if they are incorrect. The expert suggests running the code to verify the storage method.
  • #1
scorzolin
1
0
Hi all,
I'm stuck on a fortran line code where I have a doubt on its interpretation.

The line is the following:

-----------------------------------------
dimension F2(4,6,2), F3(5,7,2)

...

open(77,...)

read(77, '(4I3)') F2,F3
-----------------------------------------

the file contains 118 numbers in 30 lines of 4 numbers (the last line has only 2 numbers).

considering that the file contains the numbers from 1 to 118 in this way
001 002 003 004
005 006 007 008
...
117 118

how these numbers are stored in the F2 and F3 matrix?

I suppose they are stored in the following way
F2(1,1,1)= 001
F2(2,1,1)= 002
F2(3,1,1)= 003
F2(4,1,1)= 004
F2(1,2,1)= 005
F2(2,2,1)= 006
F2(3,2,1)= 007
F2(4,2,1)= 008
...
F3(1,1,1)= 049
...

Is it correct?

or, if NOT, where I'm wrong?

thank you in advance for the help!
 
Technology news on Phys.org
  • #2
Well, since you know the order of the numbers in your input text file, you could simply run the program and print out the first few values to see if you are correct.
 

Related to How are numbers stored in F2 and F3 matrix in Fortran programming?

1. What is Fortran programming?

Fortran is a high-level programming language used for scientific and engineering applications. It stands for Formula Translation and was developed in the 1950s. It is specifically designed for numerical and scientific computing.

2. Why is Fortran programming still relevant?

Fortran is still widely used in scientific computing because of its efficient and fast processing of large data sets. It also has a rich library of pre-written functions for mathematical and scientific computations, making it an ideal choice for scientists and engineers.

3. How do I get started with Fortran programming?

To get started with Fortran programming, you will need to download a Fortran compiler, such as GFortran or Intel Fortran, and a text editor. You can then write your code in the text editor and use the compiler to convert it into machine-readable code.

4. What are the key features of Fortran programming?

Fortran programming is known for its simplicity, efficiency, and high-performance capabilities. It also has built-in support for parallel programming, making it suitable for modern computing architectures. Additionally, Fortran has a strong community support and a large number of libraries for various scientific and engineering applications.

5. Can I use Fortran programming for non-scientific applications?

While Fortran is primarily designed for scientific and engineering applications, it can also be used for other purposes such as data processing, database management, and even game development. However, there may be more suitable programming languages for these types of applications.

Similar threads

  • Programming and Computer Science
Replies
3
Views
17K
Replies
6
Views
5K
Replies
11
Views
5K
Back
Top