AME 20214, Homework 9
-
- Site Admin
- Posts: 1596
- Joined: Tue Aug 24, 2004 4:54 pm
- Location: 376 Fitzpatrick
- Contact:
AME 20214, Homework 9
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.
Individual Promlem: Do the same as the collaborative problem, but switch two columns instead.
Bill Goodwine, 376 Fitzpatrick
Re: AME 20214, Homework 9
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
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
-
- Site Admin
- Posts: 1596
- Joined: Tue Aug 24, 2004 4:54 pm
- Location: 376 Fitzpatrick
- Contact:
Re: AME 20214, Homework 9
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.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?
Bill Goodwine, 376 Fitzpatrick
Re: AME 20214, Homework 9
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?
-
- Site Admin
- Posts: 1596
- Joined: Tue Aug 24, 2004 4:54 pm
- Location: 376 Fitzpatrick
- Contact:
Re: AME 20214, Homework 9
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.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?
Bill Goodwine, 376 Fitzpatrick
Re: AME 20214, Homework 9
Tim Wallace
hw9.f - collaborative problem
hw9ind.f - individual problem
hw9.f - collaborative problem
hw9ind.f - individual problem
You do not have the required permissions to view the files attached to this post.
Re: AME 20214, Homework 9
Adam Letcher
Homework 9
Homework 9
You do not have the required permissions to view the files attached to this post.
Re: AME 20214, Homework 9
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?
-
- Site Admin
- Posts: 1596
- Joined: Tue Aug 24, 2004 4:54 pm
- Location: 376 Fitzpatrick
- Contact:
Re: AME 20214, Homework 9
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.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?
Bill Goodwine, 376 Fitzpatrick
Re: AME 20214, Homework 9
Julian Corona
Hmwrk 9
Hmwrk 9
You do not have the required permissions to view the files attached to this post.
Re: AME 20214, Homework 9
Eras Noel III
Homework nine
Homework nine
You do not have the required permissions to view the files attached to this post.