Open navigation menu
Close suggestions
Search
Search
en
Change Language
Upload
Sign in
Sign in
Download free for days
0 ratings
0% found this document useful (0 votes)
18 views
3 pages
Project CFP (Inverse of Matrix)
C++ code of inverse of matrix
Uploaded by
rayyanquddusi683
AI-enhanced title
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content,
claim it here
.
Available Formats
Download as TXT, PDF, TXT or read online on Scribd
Download
Save
Save Project CFP (Inverse of matrix) For Later
Share
0%
0% found this document useful, undefined
0%
, undefined
Print
Embed
Report
0 ratings
0% found this document useful (0 votes)
18 views
3 pages
Project CFP (Inverse of Matrix)
C++ code of inverse of matrix
Uploaded by
rayyanquddusi683
AI-enhanced title
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content,
claim it here
.
Available Formats
Download as TXT, PDF, TXT or read online on Scribd
Carousel Previous
Carousel Next
Download
Save
Save Project CFP (Inverse of matrix) For Later
Share
0%
0% found this document useful, undefined
0%
, undefined
Print
Embed
Report
Download
Save Project CFP (Inverse of matrix) For Later
You are on page 1
/ 3
Search
Fullscreen
#include<iostream>
using namespace std ;
const int MAX=5;
void input_matrix( float A[][MAX] , int r , int c);
void output_matrix(float A[][MAX] , int r , int c);
void Swap(float &a , float &b);
int main ()
{
float A[MAX][MAX] , I[MAX][MAX] ;
int r , c , count = 0;
cout<<"Input dimensions of matrix ";
cin>>r>>c;
input_matrix(A , r ,c);
cout<<endl;
output_matrix(A , r , c);
cout<<endl;
float pivot , multi;
// Identity matrix input
for (int i=0 ; i<r ; i++)
{
for (int j=0 ; j<c ; j++)
{
if (i==j)
{
I[i][j]=1;
}
else
{
I[i][j]=0;
}
}
}
// Main functioning of converting matrix in reduced echelon form
for (int i=0 ; i<r ; i++)
{
// If First element of row is zero now swap it with other rows
for (int j=i+1 ; j<r ; j++)
{
if (A[i][i]!=0)
{
break;
}
else if (A[j][i]!=0)
{
for (int k=0 ; k<c ; k++)
{
Swap(A[i][k] , A[j][k]);
Swap(I[i][k] , I[j][k]);
}
}
}
// Making pivot point = 1 ;
if (A[i][i]!=0)
{
pivot = A[i][i];
for (int l=0 ; l<c ; l++)
{
A[i][l] = A[i][l] / pivot ;
I[i][l] = I[i][l] / pivot ;
}
for (int m = i+1 ; m<r ; m++)
{
multi = A[m][i];
for (int n=0 ; n<c ; n++)
{
A[m][n] = A[m][n] - A[i][n]*multi;
I[m][n] = I[m][n] - I[i][n]*multi;
}
}
}
}
// now convert it into reduced echelon form
float mi ;
for (int i = r-1 ; i>=0 ; i--)
{
for (int m=i-1 ; m>=0 ; m--)
{
mi = A[m][i];
for (int n=c-1 ; n>=0 ; n--)
{
A[m][n] = A[m][n] - A[i][n]*mi;
I[m][n] = I[m][n] - I[i][n]*mi;
}
}
}
// Calculating rank of matrix ;
for (int i=0 ; i<r ; i++)
{
for (int j=0 ; j<c ; j++)
{
if (A[i][j]!=0)
{
count++;
break;
}
}
}
if (count==r && count==c)
{
cout<<"Inverse of matrix exist "<<endl;
output_matrix(I , r , c);
}
else
{
cout<<"Rank of matrix is not equal to dimensions of matrix hence no inverse
exist ";
}
}
void input_matrix(float A[][MAX] , int r , int c )
{
for (int i=0 ;i<r ; i++)
{
for (int j=0 ; j<c ; j++)
{
cout<<"Enter element no ["<<i+1<<"]["<<j+1<<"]";
cin>>A[i][j];
}
}
return ;
}
void output_matrix(float A[][MAX] , int r , int c)
{
for (int i=0 ;i<r ; i++)
{
for(int j=0 ; j<c ; j++)
{
cout<<A[i][j]<<" ";
}
cout<<endl;
}
return ;
}
void Swap(float &a , float &b)
{
float temp ;
temp = a ;
a = b;
b = temp ;
return ;
}
You might also like
Write A Program To Store The Elements in 1-D Array and Perform The Operations Like Searching, Sorting and Reversing The Elements. (Menu Driven)
PDF
No ratings yet
Write A Program To Store The Elements in 1-D Array and Perform The Operations Like Searching, Sorting and Reversing The Elements. (Menu Driven)
11 pages
E Lab
PDF
No ratings yet
E Lab
744 pages
C++ Program To Find The Rank of A Matrix PDF
PDF
No ratings yet
C++ Program To Find The Rank of A Matrix PDF
3 pages
Software Project Management Plan
PDF
100% (1)
Software Project Management Plan
15 pages
ZZZZ
PDF
No ratings yet
ZZZZ
3 pages
Volvo Caretrack Manual
PDF
No ratings yet
Volvo Caretrack Manual
65 pages
Mini Project (Hard Copy)
PDF
No ratings yet
Mini Project (Hard Copy)
24 pages
2 - 2023331101 Gregorius Reynaldi Pratama - HW6
PDF
No ratings yet
2 - 2023331101 Gregorius Reynaldi Pratama - HW6
15 pages
Diagonal Matrix
PDF
No ratings yet
Diagonal Matrix
14 pages
Untitled Document
PDF
No ratings yet
Untitled Document
11 pages
Diagonal Matrix
PDF
No ratings yet
Diagonal Matrix
10 pages
07 Auditory Exercises Arrays
PDF
No ratings yet
07 Auditory Exercises Arrays
11 pages
Program
PDF
No ratings yet
Program
6 pages
Maths
PDF
No ratings yet
Maths
9 pages
Transpose
PDF
No ratings yet
Transpose
6 pages
Array Daily Challenge
PDF
No ratings yet
Array Daily Challenge
4 pages
Lab
PDF
No ratings yet
Lab
7 pages
Finding Inverse Matrix Source Code 1
PDF
No ratings yet
Finding Inverse Matrix Source Code 1
9 pages
Echelon Form: A "C" Program To Reduce The Matrix To The Echelon Form
PDF
No ratings yet
Echelon Form: A "C" Program To Reduce The Matrix To The Echelon Form
4 pages
Expanding Information Technology
PDF
No ratings yet
Expanding Information Technology
2 pages
All C++ Programs 1 To 16
PDF
No ratings yet
All C++ Programs 1 To 16
16 pages
Lab 11
PDF
No ratings yet
Lab 11
11 pages
2 Darray
PDF
No ratings yet
2 Darray
2 pages
Adaspam
PDF
No ratings yet
Adaspam
15 pages
Inverse of NXN Matrix in Java (By Augmenting The Matrix With Identity Matrix)
PDF
No ratings yet
Inverse of NXN Matrix in Java (By Augmenting The Matrix With Identity Matrix)
4 pages
Diagonal Matrix Program Check
PDF
No ratings yet
Diagonal Matrix Program Check
2 pages
Computer Aided Structural Analysis CS 520A: Gonzales, John Carlo B
PDF
No ratings yet
Computer Aided Structural Analysis CS 520A: Gonzales, John Carlo B
19 pages
AJ
PDF
No ratings yet
AJ
11 pages
A2 Ques1
PDF
No ratings yet
A2 Ques1
2 pages
Matrices
PDF
No ratings yet
Matrices
10 pages
Matrices
PDF
No ratings yet
Matrices
10 pages
Matrix
PDF
No ratings yet
Matrix
2 pages
DAA Lab File-1
PDF
No ratings yet
DAA Lab File-1
8 pages
QualComm 1
PDF
No ratings yet
QualComm 1
6 pages
Bss PR NM
PDF
No ratings yet
Bss PR NM
58 pages
Rref Bscs-Section 60
PDF
No ratings yet
Rref Bscs-Section 60
3 pages
Using Namespace Int Int Float: #Include #Include
PDF
No ratings yet
Using Namespace Int Int Float: #Include #Include
2 pages
Diagonal Matrix
PDF
No ratings yet
Diagonal Matrix
2 pages
Shreyash Kalaskar 19 Oops Practical No.4
PDF
No ratings yet
Shreyash Kalaskar 19 Oops Practical No.4
5 pages
El Programa: Using Using Using Namespace Class Static Void String
PDF
No ratings yet
El Programa: Using Using Using Namespace Class Static Void String
4 pages
Canon IR2020 Trouble Error Codes
PDF
100% (2)
Canon IR2020 Trouble Error Codes
6 pages
Program To Multiply Two Matrices
PDF
No ratings yet
Program To Multiply Two Matrices
3 pages
Labd
PDF
No ratings yet
Labd
66 pages
Telekom Bill: Page 1 of 6
PDF
No ratings yet
Telekom Bill: Page 1 of 6
6 pages
Project 5
PDF
No ratings yet
Project 5
2 pages
My
PDF
No ratings yet
My
3 pages
Add Lab Manual
PDF
No ratings yet
Add Lab Manual
11 pages
Payroll Table Descriptions Hand Book
PDF
0% (2)
Payroll Table Descriptions Hand Book
251 pages
Java Metode Gauss Jordan
PDF
No ratings yet
Java Metode Gauss Jordan
7 pages
Value Stream Mapping Using FlexSim Simulation Software
PDF
100% (1)
Value Stream Mapping Using FlexSim Simulation Software
14 pages
C++ ASSIGNMENT
PDF
No ratings yet
C++ ASSIGNMENT
3 pages
Daa File
PDF
No ratings yet
Daa File
18 pages
Installation Guide S900
PDF
No ratings yet
Installation Guide S900
28 pages
Computer Science Discrete Mathematics
PDF
No ratings yet
Computer Science Discrete Mathematics
11 pages
Ai Soft: B.Tech in Information Technology
PDF
No ratings yet
Ai Soft: B.Tech in Information Technology
79 pages
Dyna Fad
PDF
100% (1)
Dyna Fad
48 pages
Matrix Operations 1
PDF
No ratings yet
Matrix Operations 1
5 pages
GCD and Matrix Programs
PDF
No ratings yet
GCD and Matrix Programs
3 pages
Linear Search
PDF
No ratings yet
Linear Search
2 pages
mCSL216 NEW
PDF
No ratings yet
mCSL216 NEW
27 pages
Inverse Matrix
PDF
No ratings yet
Inverse Matrix
7 pages
Invers of A Matrix
PDF
No ratings yet
Invers of A Matrix
5 pages
SIN WF5 0913 en
PDF
No ratings yet
SIN WF5 0913 en
140 pages
C++ Exercises II
PDF
50% (2)
C++ Exercises II
4 pages
Ex - 6
PDF
No ratings yet
Ex - 6
17 pages
Hemax330Hematology Analyzer Communication Protocol
PDF
No ratings yet
Hemax330Hematology Analyzer Communication Protocol
8 pages
Untitled 1
PDF
No ratings yet
Untitled 1
5 pages
Deloitte Consulting 401
PDF
No ratings yet
Deloitte Consulting 401
23 pages
Assignment 2
PDF
No ratings yet
Assignment 2
7 pages
Pulse User Manual - v1.2
PDF
No ratings yet
Pulse User Manual - v1.2
86 pages
Verification Mag 2018 Issue
PDF
No ratings yet
Verification Mag 2018 Issue
39 pages
Multicast Troubleshooting 1 PDF
PDF
No ratings yet
Multicast Troubleshooting 1 PDF
127 pages
Computer Programing II - Course Outline
PDF
No ratings yet
Computer Programing II - Course Outline
2 pages
Indian Institute of Technology Delhi: Submitted by
PDF
No ratings yet
Indian Institute of Technology Delhi: Submitted by
13 pages
Week - 1 - Team - Charter - Team D - V5 (FINAL)
PDF
No ratings yet
Week - 1 - Team - Charter - Team D - V5 (FINAL)
6 pages
Program 5: Write A Program To Perform Basic Operation On Two Polynomials. Source Code
PDF
No ratings yet
Program 5: Write A Program To Perform Basic Operation On Two Polynomials. Source Code
10 pages
Week - 04-Learn Dsa With C++
PDF
No ratings yet
Week - 04-Learn Dsa With C++
23 pages
Guide To Be Anonymous
PDF
No ratings yet
Guide To Be Anonymous
5 pages
Practical 1: Write C# Code To Display The Asterisk Pattern
PDF
No ratings yet
Practical 1: Write C# Code To Display The Asterisk Pattern
20 pages
Sample
PDF
No ratings yet
Sample
5 pages
40U Cabinet Setup Guide - A04
PDF
No ratings yet
40U Cabinet Setup Guide - A04
12 pages
IT in The Nest
PDF
No ratings yet
IT in The Nest
2 pages
Resolution Rfid Agm 2019
PDF
No ratings yet
Resolution Rfid Agm 2019
1 page
Dca01 Block02 Computer Fundamental
PDF
No ratings yet
Dca01 Block02 Computer Fundamental
22 pages
Syllabus CFD PDF
PDF
No ratings yet
Syllabus CFD PDF
1 page
Lab Exercise 2-CS0017
PDF
No ratings yet
Lab Exercise 2-CS0017
17 pages