Matrices with banded structure are a type of sparse matrices that often arise in computational science...
Fantastic news! We've Found the answer you've been seeking!
Question:
Transcribed Image Text:
Matrices with banded structure are a type of sparse matrices that often arise in computational science applications, especially discretizing differential equations (you will see this later). Banded structure means that the nonzero entries are not too far off the diagonal. The constant k = max{i-j: Aj #0} is called the bandwidth. While you could solve Ax = b with Gaussian elimination, which takes O(n³) elementary operations, it would be very inefficient. A matrix of bandwidth 1 looks like L = m12 m21 M22 m23 feed m32 m33 m34 mn,n-1 mnn, where the empty entries are zeros. The LU factors for A look like 1 A = ull U12 and U = 4)-[*) Inn-1 121 1 mil 132 1 U22 U23 U33 U34 Unn, In general, the LU factors for a matrix A of bandwidth k will also have bandwidth k (assuming no pivoting). Activate Window In this problem, you will write a banded LU solver that takes advantage of the structure of A. You will be given a list of matrices, along with the associated right-acti hand side vectors b, as well as the bandwith, k. These are stored in A_list, b_list, and k_list, respectively. Write functions to compute the LU factorization of a banded matrix and solve the linear systems by using banded forward and banded backward substitution. In taking advantage of the banded structure, make sure that your code doesn't perform any operations on the parts of the matrix that are zero No pivoting is required. You should not use scipy. Linalg. lu or the like. Note: In practice, L and U are stored in-place, overwriting A banded to reduce storage cost. If you want to re-use the storage space of a particular A matrix to hold L in the lower triangular portion (without the main diagonal) and U in the upper triangular portion, that is fine. The autograder will only check the important diagonals of each L and U inside L_list and U_list. To demonstrate the performance benefits from using the banded structure of a given matrix, you will time the execution of your banded solver for each matrix in A_list. You will also compute the time required to solve Ax=b for each matrix in A_list using la. solve. Make a plot comparing both sets of your timing data versus the size (number of rows) of each matrix from A_list using the function plot_times (dims, times_banded, times_full). The function accepts dims, a list of integers of size of linear systems, times_banded, a list of integers for times for solving the system using your banded solver and times_full, a list of integers for times for solving the system using la.solve. You may time code execution in Python as follows import time start_time = time.process_time() #INSERT CODE TO BE TIMED HERE end_time = time.process_time() total_time = end_time-start_time 1.For each of the matrices in A_list and right-hand sides in b_list with bandwidth in k_list: • Compute a banded L and U and store it in the lists L_11st and U_list. • Solve LU = b for a and store the solution in x_lists, taking advantage of the banded structure of Land U. • Compute the time it takes to both compute LU and solve for a. • Compute the time it takes to execute la. solve (A,b) 2.Generate a plot containing the timing data for your banded solver and la. solve using plot_times (dims, times_banded, times_full). Your banded solver should scale linearly with the dimension of the banded matrix. INPUT: A_list: A list of numpy arrays . b_list: List right hand sides k_list: The bandwidth, an integer constant . OUTPUT: L_list, U_list: List of L and U factors from each of the matrices in A_list. x_list: List of solutions to each system from A_list and b_list. . Matrices with banded structure are a type of sparse matrices that often arise in computational science applications, especially discretizing differential equations (you will see this later). Banded structure means that the nonzero entries are not too far off the diagonal. The constant k = max{i-j: Aj #0} is called the bandwidth. While you could solve Ax = b with Gaussian elimination, which takes O(n³) elementary operations, it would be very inefficient. A matrix of bandwidth 1 looks like L = m12 m21 M22 m23 feed m32 m33 m34 mn,n-1 mnn, where the empty entries are zeros. The LU factors for A look like 1 A = ull U12 and U = 4)-[*) Inn-1 121 1 mil 132 1 U22 U23 U33 U34 Unn, In general, the LU factors for a matrix A of bandwidth k will also have bandwidth k (assuming no pivoting). Activate Window In this problem, you will write a banded LU solver that takes advantage of the structure of A. You will be given a list of matrices, along with the associated right-acti hand side vectors b, as well as the bandwith, k. These are stored in A_list, b_list, and k_list, respectively. Write functions to compute the LU factorization of a banded matrix and solve the linear systems by using banded forward and banded backward substitution. In taking advantage of the banded structure, make sure that your code doesn't perform any operations on the parts of the matrix that are zero No pivoting is required. You should not use scipy. Linalg. lu or the like. Note: In practice, L and U are stored in-place, overwriting A banded to reduce storage cost. If you want to re-use the storage space of a particular A matrix to hold L in the lower triangular portion (without the main diagonal) and U in the upper triangular portion, that is fine. The autograder will only check the important diagonals of each L and U inside L_list and U_list. To demonstrate the performance benefits from using the banded structure of a given matrix, you will time the execution of your banded solver for each matrix in A_list. You will also compute the time required to solve Ax=b for each matrix in A_list using la. solve. Make a plot comparing both sets of your timing data versus the size (number of rows) of each matrix from A_list using the function plot_times (dims, times_banded, times_full). The function accepts dims, a list of integers of size of linear systems, times_banded, a list of integers for times for solving the system using your banded solver and times_full, a list of integers for times for solving the system using la.solve. You may time code execution in Python as follows import time start_time = time.process_time() #INSERT CODE TO BE TIMED HERE end_time = time.process_time() total_time = end_time-start_time 1.For each of the matrices in A_list and right-hand sides in b_list with bandwidth in k_list: • Compute a banded L and U and store it in the lists L_11st and U_list. • Solve LU = b for a and store the solution in x_lists, taking advantage of the banded structure of Land U. • Compute the time it takes to both compute LU and solve for a. • Compute the time it takes to execute la. solve (A,b) 2.Generate a plot containing the timing data for your banded solver and la. solve using plot_times (dims, times_banded, times_full). Your banded solver should scale linearly with the dimension of the banded matrix. INPUT: A_list: A list of numpy arrays . b_list: List right hand sides k_list: The bandwidth, an integer constant . OUTPUT: L_list, U_list: List of L and U factors from each of the matrices in A_list. x_list: List of solutions to each system from A_list and b_list. .
Expert Answer:
Answer rating: 100% (QA)
The problem involves implementing a banded LU solver and comparing its performance with the builtin ... View the full answer
Related Book For
Posted Date:
Students also viewed these programming questions
-
Suppose the following balance sheet for Winbnb after second round of venture financing. Second Stage Market Value Balance Sheet ($mil) Assets Cash from new Equity Fixed Assets Liabilities and Equity...
-
You need to Read the discussion "Lynne Scholz" and give response: No company ever plans on having to deal with a public scandal. Unfortunately for Volkswagen, the actions of a few individuals at a...
-
A remodeling contractor located in a small community had developed a relatively inexpensive type of storage shed and wanted to determine the likely level of demand for the sheds among local...
-
A module can be considered a(n) object or unit that can be combined or bound together to form a application. a. Dependent, big and complex b. Dependent, small and easier c. Independent, big and...
-
Draw the bode plot for the network function. Briefly.
-
Pop Corporation purchased 480,000 shares of Son Corporation's common stock (an 80 percent interest) for $10,600,000 on January 1, 2016. The $1,000,000 excess of investment fair value over book value...
-
What is the short-run impact of immigration on the wage of native workers? What is the long-run impact?
-
Selected transactions for Gourmet Company during January of the current year are listed in Problem 6-4A. Instructions Journalize the entries to record the transactions of Gourmet Company for January...
-
A colleague claims that the flow resistance (shear stress) of channel surfaces can be neglected in the analysis of rapidly varied flow but should be considered in the analysis of gradually varied...
-
The AGRI Venture: An Integrated Marketing Communications Program. Chapter 16 states that there are three major forms of cooperative advertising: horizontal, ingredient-sponsored and vertical. Discuss...
-
Inspectors have conveniently walked into a shop and chosen 30 packets of Allens Party Mix Lollies. The mean weight of the packets is 181.2 grams with a standard deviation of 3.2 grams. (a) (5 marks)...
-
Hit or Miss Sports is introducing a new product this year. If its see-at-night soccer balls are a hit, the firm expects to be able to sell 42,800 units a year at a price of $70 each. If the new...
-
How do diverse teams contribute to innovation, creativity, and problem-solving within organizational contexts, and what leadership approaches are most conducive to leveraging the full potential of...
-
After reviewing the differences between managers and leaders, what do you think is your own leadership and management potential?
-
2.3 Version 1 The source file of your program should be named prog03v1.c. For a given image and pattern your program should look for every occurrence of the pattern in the image and report in an...
-
_____ redirects a user from a legitimate website to a malicious website by changing hosts files on a DNS server. A. Exploitation framework B. ARP poisoning C. DDoS DNS attack D. DNS...
-
The % by volume of C4H0 in a gaseous mixture of C4H10, CH4 and CO is 40. When 200 ml of the mixture is burnt in excess of O. Find volume (in ml) of CO produced. (a) 220 (b) 340 (c) 440 (d) 560
-
Synthesize the products by drawing out reagents and intermediates along the way. `N H. OH HO HO
-
1. Find values for S and R that satisfy S = 0.3R and 0.2 (100 + S) = R. Show that these solutions give the same stipend and rent as found by summing the infinite series. 2. Suppose that instead of a...
-
Use a graph of (x) = ln x to answer the following questions. (a) Find (b) Where does the function ln x have a vertical asymptote? lim In x. x->0*
-
In Exercises, sketch the graph of a single function that has all of the properties listed. (a) Continuous for all real numbers (b) f'(x) > 0 on (-, -2) and (0, 3) (c) f'(x) < 0 on (-2, 0) and (3, 0)...
-
Find the Laplace transform of the following signals and locate the poles and zeros of \(F(s)\). (a) \(f(t)=-8 u(t)\). (b) \(f(t)=0.5 t u(t)\). (c) \(f(t)=10 e^{-20000 t} u(t)\).
-
Wisconsin Tool Company Wisconsin Tool Company (WTC) is a business located in Madison, WI that manufacturers tool and die equipment. WTC executed three sales in Year 23. See Sale Agreements in the...
-
Saenz-Qualified Business Income Javier and Maria Saenz, married filing jointly, have several investments. Their adjusted gross income and taxable income for 2023 is \( \$ \) 300,000 and \( \$ \)...
Study smarter with the SolutionInn App