Write a function to add an element at a given position to the sparse matrix representation of
Question:
Write a function to add an element at a given position to the sparse matrix representation of Section 12.2.
Transcribed Image Text:
12.2 Matrix Representations Some applications must represent a large, two-dimensional matrix where many of the elements have a value of zero. One example is the lower triangular matrix that results from solving systems of simultaneous equations. A lower triangular matrix stores zero values at positions [r, c] such that r < c, as shown in Figure 12.6(a). Thus, the upper-right triangle of the matrix is always zero. Another example is the representation of undirected graphs in an adjacency matrix (see Project 11.2). Because all edges between Vertices i and j go in both directions, there is no need to store both. Instead we can just store one edge going from the higher-indexed vertex to the lower-indexed vertex. In this case, only the lower triangle of the matrix can have non-zero values. We can take advantage of this fact to save space. Instead of storing n(n+1)/2 pieces of information in an n x n array, it would save space to use a list of length n(n+1)/2. This is only practical if some means can be found to locate within the list the element that would correspond to position [r, c] in the original matrix. To derive an equation to do this computation, note that row 0 of the matrix has one non-zero value, row 1 has two non-zero values, and so on. Thus, row r is preceded by r rows with a total of 1k = (r + r)/2 non-zero elements. Adding c to reach the cth position in the rth row yields the following equation to convert position [r, c] in the original matrix to the correct position in the list. matrix[r, c] = list [(r +r)/2+c]. A similar equation can be used to store an upper triangular matrix, that is, a matrix with zero values at positions [r, c] such that r>c, as shown in Figure 12.6(b). For an n x n upper triangular matrix, the equation would be matrix[r, c] = list[rn - (r +r)/2+c].
Fantastic news! We've Found the answer you've been seeking!
Step by Step Answer:
Answer rating: 100% (2 reviews)
The image provided describes a way of storing and accessing elements of lower and upper triangular matrices to save space For a lower triangular matri...View the full answer
Answered By
AJIN kuriakose
I have completed B.Tech in Electrical Engineering & Masters in Power & Control From one of the best universities in India. I got the 99.05 percentile in the Gate Electrical Engineering Exam. I can Help students solving assignments in Electrical subjects like Power Electronics, Control system, Analog, Network Theory & Engineering Mathematics. Clear your fundamentals and develop problem-solving skills and analytical skills to crack the exam.
Get guidance and the opportunity to learn from experienced...
I can provide tuition for Electrical engineering subjects (Power Electronics, Digital electronics, Network Theory, Control System & Engineering Mathematics). The toughest subject of Electrical engineering can be made simple in online classes...
I can also solve it.
1 .I can help you with your assignments or exams or quiz or tutoring.
2. Very strict to the deadlines.
Message me for any help in assignments, live sessions. I am here to help students for all assignments, tests and exams and I will make sure you always get _95% In your subject.
Contact me in solution inn for any help in your semester, projects and for many more things . Also feel free to contact me through solution inn and for any advise related to tutoring and how it works here.thank you.
5.00+
5+ Reviews
10+ Question Solved
Related Book For
Practical Introduction To Data Structures And Algorithm Analysis Java Edition
ISBN: 9780136609117
1st Edition
Authors: Clifford A. Shaffer
Question Posted:
Students also viewed these Computer science questions
-
What are required skills for a good negotiation? Pros and cons for using such a mechanism. Choose a IT work-based scenario and explain whether you would use negotiation or not? Use relevant...
-
Write a function to delete an element from a given position in the sparse matrix representation of Section 12.2. 12.2 Matrix Representations Some applications must represent a large, two-dimensional...
-
Implement the sparse matrix representation of Section 12.2. Your implementation should support the following operations on the matrix: Insert an element at a given position, Delete an element from...
-
Miller Companys contribution format income statement for the most recent month is shown below: Total Per Unit Sales (41,000 units) $ 287,000 $ 7.00 Variable expenses 164,000 4.00 Contribution margin...
-
The power stroke in an internal combustion engine can be approximated with a polytropic expansion. Consider air in a cylinder volume of 0.2 L at 7 MPa, 1800 K. It now expands in a reversible...
-
Examine the AI literature to discover whether the following tasks can currently be solved by computers: a. Playing a decent game of table tennis (Ping-Pong). b. Driving in the center of Cairo, Egypt....
-
Andrew Reitz established a trust in 2000, naming his sons, James and John, as sole beneficiaries and himself as trustee. Upon Andrews death, Hal Rachal Jr., the attorney who drafted the trust, became...
-
Public Charity. The Kids Club of Clare County is a public charity under IRC Sec. 501 (c) (3). It had total support last year of the following: United Way support $80,000 Grant from dare County 70,000...
-
Explain how the relative prices of rugs and robots in autarky compare with the relative prices when Canada and India start to trade? In your answer explain which country will export/import which...
-
Write a function to transpose a sparse matrix as represented in Section 12.2. 12.2 Matrix Representations Some applications must represent a large, two-dimensional matrix where many of the elements...
-
What fraction of the values in a matrix must be zero for the sparse matrix representation of Section 12.2 to be more space efficient than the standard two-dimensional matrix representation when data...
-
Earnhardt Driving Schools 2010 balance sheet showed net fixed assets of $2.8 million, and the 2011 balance sheet showed net fixed assets of $3.6 million. The companys 2011 income statement showed a...
-
6. Consider the following programming problem: In 1627, Manhattan Island was sold to the Dutch settlers for approximately $24. If the proceeds of that sale had been deposited in a Dutch bank paying...
-
Describe the early theory of management. Compare the differences between the theory you have chosen and at least one current approach/theory of management. In your comparison, include a minimum of...
-
Compare and Criticize the existing structure of any two named organization of your choice. What difference do you notice in their respective structures after each of them diversify their businesses.
-
Apple and Microsoft both being for profit companies, compare and contrast their leadership effectiveness.
-
Compare international and domestic terrorism versus individuals who attack due to shared ideologies. Based on your reading and experience, do you believe the United States (specifically the...
-
After successfully completing your corporate finance class, you fell the next challenge ahead is to serve on the board of directors of Cornwall Enterprises. Unfortunately you will be the only...
-
The water in tank A is at 270 F with quality of 10% and mass 1 lbm. It is connected to a piston/cylinder holding constant pressure of 40 psia initially with 1 lbm water at 700 F. The valve is opened,...
-
Visit the Go-sack-N Java applet at the companion Web site. a. Have the source send five packets, and then pause the animation before any of the five packets reach the destination. Then kill the first...
-
A packet flow is said to conform to a leaky bucket specification (r, b) with burst size b and average rate r if the number of packets that arrive to the leaky bucket is less than n + b packets in...
-
a. Consider an audio conference call in Skype with N > 2 participants. Suppose each participant generates a constant stream of rate r bps. How many bits per second will the call initiator need to...
-
Rebecca Young started working for an investment bank after completing her MBA. She has been under the dilemma of purchasing the new condominium at the price of 600,000 United States dollars or...
-
Write a program to implement the Support Vector Machine algorithm. Train an SVM classifer with data from w3 and 4 in the following way. Preprocess each training pattern to form a new vector having...
-
Gavin is the disaster recovery team leader for his organization, which is currently in the response phase of an incident that has severe customer impact. Gavin just received a phone call from a...
Study smarter with the SolutionInn App