Fortran DO loop syntax help

Fortran90 programming simple syntax understanding. I want to write a simple do loop which takes in a text file of integers (32 integers one after the other) and reads the integers 2 at a time. Any help on this?
do i = 1, 32 !Should I put in 64 and increment by 2 or...? 
		read(11,*) n
		print*, n
	 enddo

Open in new window


Ultimately I want to take two of those integers and multiply them with a 2x2 matrix. On other words, the two integers being read in are like a 2x1 matrix. Help?
The attached text file includes the encryption matrix at the top, just ignore it. For now, I am just focusing on the integers that follow (starting with 1488 and below).

THqnks!
Cynthia JoubiAsked:
Who is Participating?

[Product update] Infrastructure Analysis Tool is now available with Business Accounts.Learn More

x
I wear a lot of hats...

"The solutions and answers provided on Experts Exchange have been extremely helpful to me over the last few years. I wear a lot of hats - Developer, Database Administrator, Help Desk, etc., so I know a lot of things but not a lot about one thing. Experts Exchange gives me answers from people who do know a lot about one thing, in a easy to use platform." -Todd S.

Bill PrewIT / Software Engineering ConsultantCommented:
I didn't see the sample file attached?


»bp
0
Bill PrewIT / Software Engineering ConsultantCommented:
Okay, not sure how your input is formatted, so I'll assume two values per line for now.  Here is a simple example of reading the 32 pairs of values into a 2 dimensional array in a loop, and inside the loop you can process each pair (I just printed them).

Depending on the input file you might want to read until end of file, etc, but it sounded like the input file might be more complicated so I didn't take that approach for now.

Here's a demo reading from STDIN that might give you an idea...



»bp
1
Cynthia JoubiAuthor Commented:
Bill, please find the file attached. The file is actually quite simple.
Data3.txt
0
Big Business Goals? Which KPIs Will Help You

The most successful MSPs rely on metrics – known as key performance indicators (KPIs) – for making informed decisions that help their businesses thrive, rather than just survive. This eBook provides an overview of the most important KPIs used by top MSPs.

Cynthia JoubiAuthor Commented:
And I mentioned above, but you'll see when you open the text file, but it's 1 value per row to help clarify. Thanks!
0
Bill PrewIT / Software Engineering ConsultantCommented:
Okay, see if this gives you the idea...

http://rextester.com/edit/WWXDZ90497


»bp
1

Experts Exchange Solution brought to you by

Your issues matter to us.

Facing a tech roadblock? Get the help and guidance you need from experienced professionals who care. Ask your question anytime, anywhere, with no hassle.

Start your 7-day free trial
Cynthia JoubiAuthor Commented:
Yes, thank you, this is what I was looking for. However, when I try to compile it on my terminal (using macOS) it is extremely slow. Any particular reason why?

And while I have you, do you mind giving some guidance on how to take these two integers (termed 'v' now I'm assuming) and multiply them to a matrix and have the product assigned as a new matrix. Do I need to allocate memory for the new matrix (i.e. taking a 2x2 * 2x1 = 2x1)?

Thank you for your help! I appreciate it!!
0
Bill PrewIT / Software Engineering ConsultantCommented:
I'm not a MacOS person, so can't speak to Fortran performance there, sorry.

As far as matrix multiplication, you should be able to use the intrinsic MATMUL() function.


»bp
0
Cynthia JoubiAuthor Commented:
Thank You for the explanation(s)! You helped with my problem!
0
It's more than this solution.Get answers and train to solve all your tech problems - anytime, anywhere.Try it for free Edge Out The Competitionfor your dream job with proven skills and certifications.Get started today Stand Outas the employee with proven skills.Start learning today for free Move Your Career Forwardwith certification training in the latest technologies.Start your trial today
Encryption

From novice to tech pro — start learning today.