#include
#include
#define MAX1 3
#define MAX2 3
struct sparse
{
int *sp ;
int row ;
} ;
void initsparse ( struct sparse * ) ;
void create_array ( struct sparse * ) ;
void display ( struct sparse ) ;
int count ( struct sparse ) ;
void create_tuple ( struct sparse *, struct sparse ) ;
void display_tuple ( struct sparse ) ;
void transpose ( struct sparse *, struct sparse ) ;
void display_transpose ( struct sparse ) ;
void delsparse ( struct sparse * ) ;
void main( )
{
struct sparse s[3] ;
int c, i ;
for ( i = 0 ; i <= 2 ; i++ )
initsparse ( &s[i] ) ;
clrscr( ) ;
create_array ( &s[0] ) ;
printf ( "\nElements in Sparse Matrix: " ) ;
display ( s[0] ) ;
c = count ( s[0] ) ;
printf ( "\n\nNumber of non-zero elements: %d", c ) ;
create_tuple ( &s[1], s[0] ) ;
printf ( "\n\nArray of non-zero elements: " ) ;
display_tuple ( s[1] ) ;
transpose ( &s[2], s[1] ) ;
printf ( "\n\nTranspose of array: " ) ;
display_transpose ( s[2] ) ;
for ( i = 0 ; i <= 2 ; i++ )
delsparse ( &s[i] ) ;
getch( ) ;
}
/* initialises data members */
void initsparse ( struct sparse *p )
{
p -> sp = NULL ;
}
/* dynamically creates the matrix of size MAX1 x MAX2 */
void create_array ( struct sparse *p )
{
int n, i ;
p -> sp = ( int * ) malloc ( MAX1 * MAX2 * sizeof ( int ) ) ;
for ( i = 0 ; i < MAX1 * MAX2 ; i++ )
{
printf ( "Enter element no. %d:", i ) ;
scanf ( "%d", &n ) ;
* ( p -> sp + i ) = n ;
}
}
/* displays the contents of the matrix */
void display ( struct sparse s )
{
int i ;
/* traverses the entire matrix */
for ( i = 0 ; i < MAX1 * MAX2 ; i++ )
{
/* positions the cursor to the new line for every new row */
if ( i % MAX2 0 )
printf ( "\n" ) ;
printf ( "%d\t", * ( p.sp + i ) ) ;
}
}
/* deallocates memory */
void delsparse ( struct sparse *p )
{
free ( p -> sp ) ;
}
a square matrix that is equal to its transpose
The transpose of a matrix A is the matrix B that is obtained by swapping the rows and columns of A into the columns and rows of B. In algebraic form, if A = {aij} then B = {aji} is its transpose, where 1 ≤ i ≤ n and 1 ≤ j ≤ m.
The classical adjoint of a square matrix A the transpose of the matrix who (i, j) entry is the a i j cofactor.
It need not be, so the question makes no sense!
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.
yes, it is true that the transpose of the transpose of a matrix is the original matrix
It depends on the computer language you're using.
The Transpose of a MatrixThe matrix of order n x m obtained by interchanging the rows and columns of the m X n matrix, A, is called the transpose of A and is denoted by A' or AT.
a square matrix that is equal to its transpose
Another sparse matrix.
Invert rows and columns to get the transpose of a matrix
from data structure
The transpose of a matrix A is the matrix B that is obtained by swapping the rows and columns of A into the columns and rows of B. In algebraic form, if A = {aij} then B = {aji} is its transpose, where 1 ≤ i ≤ n and 1 ≤ j ≤ m.
The classical adjoint of a square matrix A the transpose of the matrix who (i, j) entry is the a i j cofactor.
Hermitian matrix (please note spelling): a square matrix with complex elements that is equal to its conjugate transpose.
transpose(Matrix mat,int rows, int cols ){ //construction step Matrix tmat; for(int i=0;i<rows;i++){ for(int j=0;j<cols;j++){ tmat[j][i] = mat[i][j]; } } }
It need not be, so the question makes no sense!