answersLogoWhite

0


Best Answer

// transpose for the sparse matrix void main() { clrscr(); int a[10][10],b[10][10]; int m,n,p,q,t,col; int i,j; printf("enter the no of row and columns :\n"); scanf("%d %d",&m,&n); // assigning the value of matrix for(i=1;i<=m;i++) { for(j=1;j<=n;j++) { printf("a[%d][%d]= ",i,j); scanf("%d",&a[i][j]); } } printf("\n\n"); //displaying the matrix printf("\n\nThe matrix is :\n\n"); for(i=1;i<=m;i++) { for(j=1;j<=n;j++) { printf("%d\t",a[i][j]); } printf("\n"); } t=0; printf("\n\nthe non zero value matrix are :\n\n"); for(i=1;i<=m;i++) { for(j=1;j<=n;j++) { // accepting only non zero value if(a[i][j]!=0) { t=t+1; b[t][1]=i; b[t][2]=j; b[t][3]=a[i][j]; } } } printf("a[0 %d %d %d\n",m,n,t); for(i=1;i<=t;i++) { printf("a[%d %d %d %d\n",i,b[i][1],b[i][2],b[i][3]); } a[0][1]=n; a[0][2]=m; a[0][3]=t; int s[10],u[10]; if(t>0) { for(i=1;i<=n;i++) { s[i]=0; } for(i=1;i<=t;i++) { s[b[i][2]]=s[b[i][2]]+1; } u[1]=1; for(i=2;i<=n;i++) { u[i]=u[i-1]+s[i-1]; } for(i=1;i<=t;i++) { j=u[b[i][2]]; a[j][1]=b[i][2]; a[j][2]=b[i][1]; a[j][3]=b[i][3]; u[b[i][2]]=j+1; } } printf("\n\n the fast transpose matrix \n\n"); printf("a[0 %d %d %d\n",n,m,t); for(i=1;i<=t;i++) { printf("a[%d %d %d %d\n",i,a[i][1],a[i][2],a[i][3]); } getch(); }

User Avatar

Wiki User

15y ago
This answer is:
User Avatar

Add your answer:

Earn +20 pts
Q: Function to find the transpose of a sparse matrix?
Write your answer...
Submit
Still have questions?
magnify glass
imp
Continue Learning about Engineering

How do you write a java program to find the transpose of the matrix for the given elements?

You basically write a nested for loop (one for within another one), to copy the elements of the matrix to a new matrix.


Draw a flowchart to find the transpose of matrices?

draw the flowchart for transpose of a matrice


What is matrix programming in C programming?

C Examples on Matrix OperationsA matrix is a rectangular array of numbers or symbols arranged in rows and columns. The following section contains a list of C programs which perform the operations of Addition, Subtraction and Multiplication on the 2 matrices. The section also deals with evaluating the transpose of a given matrix. The transpose of a matrix is the interchange of rows and columns.The section also has programs on finding the trace of 2 matrices, calculating the sum and difference of two matrices. It also has a C program which is used to perform multiplication of a matrix using recursion.C Program to Calculate the Addition or Subtraction & Trace of 2 MatricesC Program to Find the Transpose of a given MatrixC Program to Compute the Product of Two MatricesC Program to Calculate the Sum & Difference of the MatricesC Program to Perform Matrix Multiplication using Recursion


Write a program to transpose of a matrix?

Program to find the Transpose of a Matrix#include#includevoid main(){int i,j,n,t;int m[5][5];clrscr();printf("Enter Order of Matrix : ");scanf("%d",&n);printf("Enter Elements of Matrix :\n\n");for(i=0;i


Write a program using c plus plus to check whether the given square matrix is symmetric or not?

means whether the matrix is same or not program for symmetric matrix : include&lt;stdio.h&gt; #include&lt;conio.h&gt; main() { int a[10][10],at[10][10],k,i,j,m,n; clrscr(); printf("enter the order of matrix"); scanf("%d %d",&amp;m,&amp;n); printf("enter the matrix"); for(i=0;i&lt;m;i++) { for(j=0;j&lt;n;j++) scanf("%d",&amp;a[i][j]); } for(i=0;i&lt;m;i++) { for(j=0;j&lt;n;j++) at[i][j]=a[j][i]; } for(i=0;i&lt;m;i++) { for(j=0;j&lt;n;j++) { if(at[i][j]!=a[i][j]) k=1; } } if(k==1) printf("not symmetric"); else printf("symmetric"); getch(); }

Related questions

How do you find transportation of matrix?

Invert rows and columns to get the transpose of a matrix


How do you write a java program to find the transpose of the matrix for the given elements?

You basically write a nested for loop (one for within another one), to copy the elements of the matrix to a new matrix.


Draw a flowchart to find the transpose of matrices?

draw the flowchart for transpose of a matrice


What is an orthogonal matrix?

A matrix A is orthogonal if itstranspose is equal to it inverse. So AT is the transpose of A and A-1 is the inverse. We have AT=A-1 So we have : AAT= I, the identity matrix Since it is MUCH easier to find a transpose than an inverse, these matrices are easy to compute with. Furthermore, rotation matrices are orthogonal. The inverse of an orthogonal matrix is also orthogonal which can be easily proved directly from the definition.


Write a 8085 microprocessor program to find A inverse and A transpose if A is a 3x3 matrix?

Sp[[Q/Write a 8085 microprocessor program to find A inverse and A transpose if A is a 3x3 matrix|Answer]]ell chec[[Q/Write a 8085 microprocessor program to find A inverse and A transpose if A is a 3x3 matrix&amp;action=edit&amp;section=new|Answer it!]]k your answe[[Q/Discuss:Write a 8085 microprocessor program to find A inverse and A transpose if A is a 3x3 matrix|Disc]][[help/answering questions|guidelin]]Spell check your answeresussionr[[help/signing in|full benefits]] Save C[[Q/Write a 8085 microprocessor program to find A inverse and A transpose if A is a 3x3 matrix|Write a 8085 microprocessor program to find A inverse and A transpose if A is a 3x3 ]][[Q/Write a 8085 microprocessor program to find A inverse and A transpose if A is a 3x3 matrix&amp;action=edit&amp;section=new|Answering 'Write a 8085 microprocessor program to find A inverse and A transpose if A is a 3x3 matrix?']]matrix?ancel[[Q/How many animals are in West Texas|How many animals are in West Texas?]][[Q/How do you increase the number of four wheelers vehicles for servicing in a Service workshop|How do you increase the number of four wheelers vehicles for servicing in a]][[Q/How do you increase the number of four wheelers vehicles for servicing in a Service workshop|How do you increase the number of four wheelers vehicles for servicing in a Service workshop?]] Service workshop?[[Q/How do you increase the number of four wheelers vehicles for servicing in a Service workshop|How do you increase the number of four wheelers vehicles for servicing in a Service workshop?]]More Q&amp;A


What is matrix programming in C programming?

C Examples on Matrix OperationsA matrix is a rectangular array of numbers or symbols arranged in rows and columns. The following section contains a list of C programs which perform the operations of Addition, Subtraction and Multiplication on the 2 matrices. The section also deals with evaluating the transpose of a given matrix. The transpose of a matrix is the interchange of rows and columns.The section also has programs on finding the trace of 2 matrices, calculating the sum and difference of two matrices. It also has a C program which is used to perform multiplication of a matrix using recursion.C Program to Calculate the Addition or Subtraction & Trace of 2 MatricesC Program to Find the Transpose of a given MatrixC Program to Compute the Product of Two MatricesC Program to Calculate the Sum & Difference of the MatricesC Program to Perform Matrix Multiplication using Recursion


Write a program to transpose of a matrix?

Program to find the Transpose of a Matrix#include#includevoid main(){int i,j,n,t;int m[5][5];clrscr();printf("Enter Order of Matrix : ");scanf("%d",&n);printf("Enter Elements of Matrix :\n\n");for(i=0;i


Program to find the Transpose of matrix using function?

#include&lt;stdio.h&gt; void transpose(int a[50][50]); void main() { int a[50][50],b[50][50],m,n,i,j; scanf("%d",&amp;m,&amp;n); for(i=0;i&lt;m;i++) { for(j=0;j&lt;n;j++) { scanf("%d",&amp;a[i][j]); } } for(i=0;i&lt;n;i++) { for(j=0;j&lt;m;j++) { scanf("%d",&amp;b[i][j]); } } transpose(a,b,m,n) void transpose(int a[50][50],int b[50][50],int m,int n) { int i; for(i=0;i&lt;m;i++) { for(j=0;j&lt;n;j++) { b[i][j]=a[i][j]; } } }


How do find matrix inverse of 4cross 4matrix?

Next to your 4x4 matrix, place the 4x4 identity matrix on the right and adjoined to the one you want to invert. Now you can use row operations and change your original matrix on the left to a 4x4 identity matrix. Each time you do a row operation, make sure you do the same thing to the rows of the original identity matrix. You end up with the identity now on the left and the inverse on the right. You can also calculate the inverse using the adjoint. The adjoint matrix is computed by taking the transpose of a matrix where each element is cofactor of the corresponding element in the original matrix. You find the cofactor t of the matrix created by taking the original matrix and removing the row and column for the element you are calculating the cofactor of. The signs of the cofactors alternate, just as when computing the determinant


Write a program using c plus plus to check whether the given square matrix is symmetric or not?

means whether the matrix is same or not program for symmetric matrix : include&lt;stdio.h&gt; #include&lt;conio.h&gt; main() { int a[10][10],at[10][10],k,i,j,m,n; clrscr(); printf("enter the order of matrix"); scanf("%d %d",&amp;m,&amp;n); printf("enter the matrix"); for(i=0;i&lt;m;i++) { for(j=0;j&lt;n;j++) scanf("%d",&amp;a[i][j]); } for(i=0;i&lt;m;i++) { for(j=0;j&lt;n;j++) at[i][j]=a[j][i]; } for(i=0;i&lt;m;i++) { for(j=0;j&lt;n;j++) { if(at[i][j]!=a[i][j]) k=1; } } if(k==1) printf("not symmetric"); else printf("symmetric"); getch(); }


Find directed graph that has the adjacency matrix?

Find directed graph that has the adjacency matrix Find directed graph that has the adjacency matrix


How do you find original matrix from its inverse matrix?

To find the original matrix of an inverted matrix, simply invert it again. Consider A^-1^-1 = A^1 = A