Write a description (maximum four sentences) for the below subroutine. Specify what exactly the subroutine does, and what are the input/output arguments of the subroutine.  [0.5] subroutine TakeLnEq(A,B) !=====================================================================================================! !                                                                                                     ! !                              Write your description here in this box                                ! !                                                                                                     ! !                                                                                                     ! !                                                                                                     ! !=====================================================================================================! integer:: i,ix,iy,iz,ieq real (kind=8), dimension(3,3), intent(out)::A real (kind=8), dimension(3), intent(out)::B character (len=80):: str character (len=3), dimension(3):: eqn_num eqn_num(1)='1st'; eqn_num(2)='2nd'; eqn_num(3)='3rd' A=0.0; B=0.0 Do i=1,3    print*, 'Enter your ',eqn_num(i),' 3-variable linear equation.'    print*, 'NOTE:'    print*, '1- use real numbers for the variable coefficients (i.e. 1.0X+0.234Y+158.98Z=22.1),'    print*, '2- the left side of the equation must have 3 terms (one term for each variable),'    print*, '3- use capital letters for variables, and do not use any comma or space in your entry,'    print*, '4- right side of the equation must be a real number only.'    read(*,*) str    ix=index(str,'X'); iy=index(str,'Y'); iz=index(str,'Z'); ieq=index(str,'=')    if (ixiy .and. (ixiz)) read(str(iy+1:ix-1),*) A(i,1)    if (ix>iz .and. (ixiy)) read(str(iz+1:ix-1),*) A(i,1)    if (iyix .and. (iyiz)) read(str(ix+1:iy-1),*) A(i,2)    if (iy>iz .and. (iyix)) read(str(iz+1:iy-1),*) A(i,2)    if (iziy .and. (izix)) read(str(iy+1:iz-1),*) A(i,3)    if (iz>ix .and. (iziy)) read(str(ix+1:iz-1),*) A(i,3)    read(str(ieq+1:len_trim(str)),*) B(i) enddo end subroutine TakeLnEq

Computer Networking: A Top-Down Approach (7th Edition)
7th Edition
ISBN:9780133594140
Author:James Kurose, Keith Ross
Publisher:James Kurose, Keith Ross
Chapter1: Computer Networks And The Internet
Section: Chapter Questions
Problem R1RQ: What is the difference between a host and an end system? List several different types of end...
icon
Related questions
Question

Write a description (maximum four sentences) for the below subroutine. Specify what exactly the subroutine does, and what are the input/output arguments of the subroutine.  [0.5]

subroutine TakeLnEq(A,B)

!=====================================================================================================!

!                                                                                                     !

!                              Write your description here in this box                                !

!                                                                                                     !

!                                                                                                     !

!                                                                                                     !

!=====================================================================================================!

integer:: i,ix,iy,iz,ieq

real (kind=8), dimension(3,3), intent(out)::A

real (kind=8), dimension(3), intent(out)::B

character (len=80):: str

character (len=3), dimension(3):: eqn_num

eqn_num(1)='1st'; eqn_num(2)='2nd'; eqn_num(3)='3rd'

A=0.0; B=0.0

Do i=1,3

   print*, 'Enter your ',eqn_num(i),' 3-variable linear equation.'

   print*, 'NOTE:'

   print*, '1- use real numbers for the variable coefficients (i.e. 1.0X+0.234Y+158.98Z=22.1),'

   print*, '2- the left side of the equation must have 3 terms (one term for each variable),'

   print*, '3- use capital letters for variables, and do not use any comma or space in your entry,'

   print*, '4- right side of the equation must be a real number only.'

   read(*,*) str

   ix=index(str,'X'); iy=index(str,'Y'); iz=index(str,'Z'); ieq=index(str,'=')

   if (ix<iy .and. ix<iz) read(str(1:ix-1),*) A(i,1)

   if (ix>iy .and. (ix<iz.or.iy>iz)) read(str(iy+1:ix-1),*) A(i,1)

   if (ix>iz .and. (ix<iy.or.iz>iy)) read(str(iz+1:ix-1),*) A(i,1)

   if (iy<ix .and. iy<iz) read(str(1:iy-1),*) A(i,2)

   if (iy>ix .and. (iy<iz.or.ix>iz)) read(str(ix+1:iy-1),*) A(i,2)

   if (iy>iz .and. (iy<ix.or.iz>ix)) read(str(iz+1:iy-1),*) A(i,2)

   if (iz<iy .and. iz<ix) read(str(1:iz-1),*) A(i,3)

   if (iz>iy .and. (iz<ix.or.iy>ix)) read(str(iy+1:iz-1),*) A(i,3)

   if (iz>ix .and. (iz<iy.or.ix>iy)) read(str(ix+1:iz-1),*) A(i,3)

   read(str(ieq+1:len_trim(str)),*) B(i)

enddo

end subroutine TakeLnEq

Expert Solution
trending now

Trending now

This is a popular solution!

steps

Step by step

Solved in 2 steps

Blurred answer
Recommended textbooks for you
Computer Networking: A Top-Down Approach (7th Edi…
Computer Networking: A Top-Down Approach (7th Edi…
Computer Engineering
ISBN:
9780133594140
Author:
James Kurose, Keith Ross
Publisher:
PEARSON
Computer Organization and Design MIPS Edition, Fi…
Computer Organization and Design MIPS Edition, Fi…
Computer Engineering
ISBN:
9780124077263
Author:
David A. Patterson, John L. Hennessy
Publisher:
Elsevier Science
Network+ Guide to Networks (MindTap Course List)
Network+ Guide to Networks (MindTap Course List)
Computer Engineering
ISBN:
9781337569330
Author:
Jill West, Tamara Dean, Jean Andrews
Publisher:
Cengage Learning
Concepts of Database Management
Concepts of Database Management
Computer Engineering
ISBN:
9781337093422
Author:
Joy L. Starks, Philip J. Pratt, Mary Z. Last
Publisher:
Cengage Learning
Prelude to Programming
Prelude to Programming
Computer Engineering
ISBN:
9780133750423
Author:
VENIT, Stewart
Publisher:
Pearson Education
Sc Business Data Communications and Networking, T…
Sc Business Data Communications and Networking, T…
Computer Engineering
ISBN:
9781119368830
Author:
FITZGERALD
Publisher:
WILEY