answersLogoWhite

0


Best Answer

#include<iostream>

#include<stdio.h>

#include<conio.h>

using namespace std;

int main()

{

int a[20][20],b[20][20],c[20][20],i,j,k,m,n,f;

cout << "Input row and column of A matrix \n\n";

cin >> n >> m;

cout << "\n\nInput A - matrix \n\n";

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

for(j=0;j<m;++j)

cin >> a[i][j];

cout << "\n\nMatrix A : \n\n";

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

{

for(j=0;j<m;++j)

cout << a[i][j] << " ";

cout << "\n\n";

}

for(i=0;i<m;++i)

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

b[i][j]=a[j][i];

cout << "\n\nTranspose of matrix A is : \n\n";

for(i=0;i<m;++i)

{

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

cout << b[i][j] << " ";

cout << "\n\n";

}

for(i=0;i<m;i++)

{

for(j=0;j<m;j++){

c[i][j]=0;

for(k=0;k<=m;k++)

c[i][j]+=a[i][k]*b[k][j];

}

}

for(i=0;i<m;i++)

{

for(j=0;j<m;j++)

{

if((int)c[i][i]==1&&(int)c[i][j]==0)

f=1;

}

}

cout<<"\n\n Matrix A * transpose of A \n\n";

for(i=0;i<m;i++)

{

for(j=0;j<m;j++)

cout << c[i][j];

cout << "\n\n";

}

if(f==1)

cout << "\n\nMatrix A is Orthogonal !!!";

else

cout << "\n\nMatrix A is NOT Orthogonal !!!";

getch();

return 0;

}

-ALOK

User Avatar

Wiki User

12y ago
This answer is:
User Avatar

Add your answer:

Earn +20 pts
Q: C program to check whether a given matrix is orthogonal or not?
Write your answer...
Submit
Still have questions?
magnify glass
imp
Continue Learning about Engineering

C program to read and print a scalar matrix?

Here is the C program to check whether the inputted matrix is scalar matrix or not. ( its not my creation, its get from other website,am not check) #include&lt;stdio.h&gt; #include&lt;conio.h&gt; int main() { int a[10][10],i,j,m,n,f=0; printf("Enter the order of the matrix\n"); scanf("%d%d",&amp;m,&amp;n); printf("Enter the matrix\n"); for(i=0;i&lt;m;i++) { for(j=0;j&lt;n;j++) { scanf("%d",&amp;a[i][j]); } } if(m!=n) { printf("The matrix is not identity"); } else { for(i=0;i&lt;m;i++) { for(j=0;j&lt;n;j++) { if((i==j&amp;&amp;a[i][j]!=a[0][0])(i!=j&amp;&amp;a[i][j]!=0)) { printf("The matrix is not scalar\n"); f=1; break; } } if(f==1) { break; } } if(f==0) { printf("The matrix is scalar\n"); } } getch(); return 0; }


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(); }


Write a c program to check whether a string follows English capitalization rules?

Active Time spent online


How do you write a program in c plus plus to check if an array is symmetric?

To determine if an array is symmetric, the array must be square. If so, check each element against its transpose. If all elements are equal, the array is symmetric.For a two-dimensional array (a matrix) of order n, the following code will determine if it is symmetric or not:templatebool symmetric(const std::array& matrix){for (size_t r=0 ; r


Matrix multiplication using mpi?

Check related links

Related questions

How do you check orthogonality of a matrix using arrays?

the transpose of null space of A is equal to orthogonal complement of A


Write a program By using if else statement to read a number and check whether it is positive or negative?

write a c++program by using if statement to read a number and check whether it is positive or negative


What is a Desk check trace table?

Going through a program on paper to check whether it has errors.


C program to read and print a scalar matrix?

Here is the C program to check whether the inputted matrix is scalar matrix or not. ( its not my creation, its get from other website,am not check) #include&lt;stdio.h&gt; #include&lt;conio.h&gt; int main() { int a[10][10],i,j,m,n,f=0; printf("Enter the order of the matrix\n"); scanf("%d%d",&amp;m,&amp;n); printf("Enter the matrix\n"); for(i=0;i&lt;m;i++) { for(j=0;j&lt;n;j++) { scanf("%d",&amp;a[i][j]); } } if(m!=n) { printf("The matrix is not identity"); } else { for(i=0;i&lt;m;i++) { for(j=0;j&lt;n;j++) { if((i==j&amp;&amp;a[i][j]!=a[0][0])(i!=j&amp;&amp;a[i][j]!=0)) { printf("The matrix is not scalar\n"); f=1; break; } } if(f==1) { break; } } if(f==0) { printf("The matrix is scalar\n"); } } getch(); return 0; }


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(); }


Wap to build a sparse matrix as an arraywrite functions to check if the sparse matrix is a square diagonal or lower triangular or upper triagular or tridiagonal matrix?

write a programe to build a sparse matrix as an array. write function to check if the sparse matrix is a square, diagonal,lower triangular, upper triangular or tridiagonal matrix


Can you write a C program to check whether a string is an IP address or not?

Use the Exception class and type converters.


Lab manual in mca 1st sem from ignou?

write a program in C to check whether a given number is apalindrome or not


Write a c program to check whether a string follows English capitalization rules?

Active Time spent online


Could you write a assembly language program in tasm To check whether a given number present in a sequence of given memory location containing the string to be checked in 8086?

8086 assembly language program to check wether given number is perfect or not


How do you write a program in c plus plus to check if an array is symmetric?

To determine if an array is symmetric, the array must be square. If so, check each element against its transpose. If all elements are equal, the array is symmetric.For a two-dimensional array (a matrix) of order n, the following code will determine if it is symmetric or not:templatebool symmetric(const std::array& matrix){for (size_t r=0 ; r


Matrix multiplication using mpi?

Check related links