---------------------------------- " Data Structure "---------------------------------------------
Transpose of a Sparse Matrix
{
int i,j,k,n;
b2[0][0]=b1[0][1];
b2[0][1]=b1[0][0];
b2[0][2]=b1[0][2];
k=1;
n=b1[0][2];
for(i=0;i<b1[0][1];i++) /*According to column it is transposing the sparse matrix */
{
for(j=1;j<=n;j++)
{
if(i==b1[j][1])
{
b2[k][0]=b1[j][1];
b2[k][1]=b1[j][0];
b2[k][2]=b1[j][2];
k++;
}
}
}
}
No comments:
Post a Comment