AME 20214, Homework 9

Due Thursday, December 4, 2008.
Post Reply
goodwine
Site Admin
Posts: 1596
Joined: Tue Aug 24, 2004 4:54 pm
Location: 376 Fitzpatrick
Contact:

AME 20214, Homework 9

Post by goodwine »

Collaborative Problem: Write a program with a subroutine called switchrows that will switch two rows in a matrix. If the matrix is called A, then switchrows(A,2,3) should switch rows two and three in the matrix. Your subroutine should work with any size matrix. If you need to have other arguments to the subroutine that give the dimensions for the matrix, that is o.k. Your main program should only have the data for the matrix, print the original matrix and then print the matrix after the subroutine is called, showing that the rows were switched. Test it on at least two matrices of with different dimensions. Your subroutine should check that the the numbers that are sent to switch the rows are valid, i.e., that neither is zero or less or greater than the number of rows.

Individual Promlem: Do the same as the collaborative problem, but switch two columns instead.
Bill Goodwine, 376 Fitzpatrick
jcockerh

Re: AME 20214, Homework 9

Post by jcockerh »

Professor,

I know Fortran 90 has built in functions to find the dimensions of an array. Does Fortran 77 have anything similar or are we forced to explicitly pass the array size to the subroutine?

-Casey Cockerham
goodwine
Site Admin
Posts: 1596
Joined: Tue Aug 24, 2004 4:54 pm
Location: 376 Fitzpatrick
Contact:

Re: AME 20214, Homework 9

Post by goodwine »

jcockerh wrote:I know Fortran 90 has built in functions to find the dimensions of an array. Does Fortran 77 have anything similar or are we forced to explicitly pass the array size to the subroutine?
To the best of my knowledge, you have to explicitly pass it to the subroutine. If you find a way to do it that's built-in, please let me know.
Bill Goodwine, 376 Fitzpatrick
mbohnert

Re: AME 20214, Homework 9

Post by mbohnert »

So do you want us to have the user set the size of the array and enter variables or do you just want the matrix values within the program?
goodwine
Site Admin
Posts: 1596
Joined: Tue Aug 24, 2004 4:54 pm
Location: 376 Fitzpatrick
Contact:

Re: AME 20214, Homework 9

Post by goodwine »

mbohnert wrote:So do you want us to have the user set the size of the array and enter variables or do you just want the matrix values within the program?
Either way is fine. You might as well do it in the program since it would be unwieldy for the user to enter the whole matrix. Just use a data statement for that.
Bill Goodwine, 376 Fitzpatrick
twallac1

Re: AME 20214, Homework 9

Post by twallac1 »

Tim Wallace
hw9.f - collaborative problem
hw9ind.f - individual problem
You do not have the required permissions to view the files attached to this post.
AL089

Re: AME 20214, Homework 9

Post by AL089 »

Adam Letcher
Homework 9
You do not have the required permissions to view the files attached to this post.
cmikkels

Re: AME 20214, Homework 9

Post by cmikkels »

My code compiles fine but when I run it, I get a segmentation fault when it should be calling the subroutine. What does this mean and what would this problem be stemming from?
goodwine
Site Admin
Posts: 1596
Joined: Tue Aug 24, 2004 4:54 pm
Location: 376 Fitzpatrick
Contact:

Re: AME 20214, Homework 9

Post by goodwine »

cmikkels wrote:My code compiles fine but when I run it, I get a segmentation fault when it should be calling the subroutine. What does this mean and what would this problem be stemming from?
Lots of things can produce a segmentation fault. Some common ones are when a subscript has a value bigger than an array or when you call a subroutine with a number of variables that doesn't match.
Bill Goodwine, 376 Fitzpatrick
jcorona

Re: AME 20214, Homework 9

Post by jcorona »

Julian Corona
Hmwrk 9
You do not have the required permissions to view the files attached to this post.
enoel

Re: AME 20214, Homework 9

Post by enoel »

Eras Noel III
Homework nine
You do not have the required permissions to view the files attached to this post.
Post Reply

Return to “AME 20214, Homework 9”