Ask Question, Ask an Expert

+61-413 786 465

info@mywordsolution.com

Ask Computer Engineering Expert

Explain an efficient method of storing a sparse matrix in memory. Write a module to find the transpose of the sparse matrix stored in this way.

A matrix which contains number of zero entries in much higher number than the number of non zero entries is called sparse matrix. The normal method of representing matrices in memory as two-dimensional arrays may not be appropriate for sparse matrices. One may save space by storing only nonzero entries in the matrix. For example the matrix A (3*3 matrix) represented below

0      2     0

5     0     0

0     6     9

can be written in the sparse matrix form as follows:

3     3     4

0     1     2

1     0     5

2     2     6

2     3     9

Where the first row represent the dimension of matrix and last column tells us the number of nonzero values; second row onwards it is giving the position and value of the non zero number.

 

A function which is used to find transpose of a sparse matrix is:

void  transpose(x,r,y)

int x[3][3],y[3][3],r;

{

int i,j,k,m,n,t,p,q,col;

m=x[0][0];

n=x[0][1];

t=x[0][2]; y[0][0]=n; y[0][1]=m; y[0][2]=t;

if(t>0)

{

q=1;

for (col=0;col<=n;col++)

for(p=1;p<=t;p++)

if(x[p][1]==col)

{

y[q][0]=x[p][1]; y[q][1]=x[p][0]; y[q][2]=x[p][2];

q++;

}

}

return;

}

 

Computer Engineering, Engineering

  • Category:- Computer Engineering
  • Reference No.:- M9504013

Have any Question?


Related Questions in Computer Engineering

What are the best practices to follow for microsoft windows

What are the best practices to follow for Microsoft Windows network security. Which two would you start with and why?

Systems analysis projectpersonal trainer inc owns and

Systems analysis project Personal Trainer, Inc. owns and operates fitness centers in a dozen Midwestern cities. The centers have done well, and the company is planning an international expansion by opening a new "superce ...

Explain how financial leverage at investment banks differed

Explain how financial leverage at investment banks differed from financial leverage at more traditional commercial banks. What is the benefits of this leverage? What are the primary risks associated with financial levera ...

Today is your 35th birthday and it occurs to you that your

Today is your 35th birthday and it occurs to you that your current retirement savings may be insufficient to maintain for you the lifestyle to which you have become accustomed. • The value of your retirement account toda ...

Need references for information for the following dealing

Need references for information for the following dealing with CSMS (Consolidated Sales and Marketing System Project) Produce a narrative which describes the added error-handling pathways that includes: an overview of th ...

Question suppose a computer using direct mapped cache has

Question Suppose a computer using direct mapped cache has 2 40 bytes of byte-addressable main memory and a cache of 64 blocks, where each block contains 32 bytes. a. how many blocks pf main memory are there? b. what is t ...

Question suppose a class car is a child of a class vehicle

Question : Suppose a class Car is a child of a class Vehicle. Suppose Vehicle and Car have methods Move(). Method Move() of the class Car calls method Move() of the class Vehicle(). Write the statement in Move() of the c ...

Requirementswrite a java program that reads a set of

Requirements: Write a java program that reads a set of integer lattice points, prints out the ones on the boundry of the convex hull sorted left to right (ie by x-coordinate), and then accepts additional points and deter ...

Simple coding help needed for java programhere is the

SIMPLE CODING HELP NEEDED FOR JAVA PROGRAM Here is the program description: Write a program that supports the following operations: int add(string login, string time, int priority, int size, int handle): add a new reques ...

Suppose a consumer is trying to make a choice over the

Suppose a consumer is trying to make a choice over the consumption of two goods: x and y. Px = 3, Py = 4 and the income is equal to 50. Assume that the government distributes some stamps that are good to buy 5 units of g ...

  • 4,153,160 Questions Asked
  • 13,132 Experts
  • 2,558,936 Questions Answered

Ask Experts for help!!

Looking for Assignment Help?

Start excelling in your Courses, Get help with Assignment

Write us your full requirement for evaluation and you will receive response within 20 minutes turnaround time.

Ask Now Help with Problems, Get a Best Answer

Why might a bank avoid the use of interest rate swaps even

Why might a bank avoid the use of interest rate swaps, even when the institution is exposed to significant interest rate

Describe the difference between zero coupon bonds and

Describe the difference between zero coupon bonds and coupon bonds. Under what conditions will a coupon bond sell at a p

Compute the present value of an annuity of 880 per year

Compute the present value of an annuity of $ 880 per year for 16 years, given a discount rate of 6 percent per annum. As

Compute the present value of an 1150 payment made in ten

Compute the present value of an $1,150 payment made in ten years when the discount rate is 12 percent. (Do not round int

Compute the present value of an annuity of 699 per year

Compute the present value of an annuity of $ 699 per year for 19 years, given a discount rate of 6 percent per annum. As