473,404 Members | 2,174 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,404 software developers and data experts.

matrix code

i am looking for code to find inverse of N*N matrix .
i will be grateful to you if you mail me code at
<email snipped for security reasons>
Oct 13 '06 #1
5 6896
I could use the same one !! <email snipped for security reasons>

Thanks

i am looking for code to find inverse of N*N matrix .
i will be grateful to you if you mail me code at
<email snipped for security reasons>
Oct 13 '06 #2
D_C
293 100+
(Wiki) Gaussian Elimination. Create a second matrix which is an NxN identity matrix (all diagonal entries are 1, everything else is 0). For example, a 3x3 identity matrix is
Expand|Select|Wrap|Line Numbers
  1. 1 0 0
  2. 0 1 0
  3. 0 0 1
Use Gaussian elimination to convert your NxN matrix into the identity matrix. However, for every operation you perform on your NxN matrix, also perform on the newly created identity matrix. Whatever matrix the identity matrix turns into is the inverse, assuming that your NxN matrix is invertible.
Oct 13 '06 #3
i am looking for code in c to find inverse of N*N matrix .
if u have it .
i will be grateful to you if you mail me code at

<email snipped for security reasons>
Jan 10 '07 #4
DeMan
1,806 1GB
This problem has been addressed MANY times, so you may do well to look through earlier posts.

D_C has provided you with a method you could implement.

Using this method on a matrix with variable placeholders, certain properties become evident to more simply evaluate a matrix inverse. I would suggest you search some/all/different combinations of, the following terms (which may or may not have much to do with inverses - I leave that to you to work out) in google (inverse, determinant, eigenvalue, eigenvector, matrix) , which might be able to help you find a method/formula. Once you have attempted this method, post any code you have (or at least where you are having difficulties starting) and help may be forthcoming
Jan 10 '07 #5
macklin01
145 100+
One other thing to consider:

If you're solving the system Ax = b, it is not necessary to find the inverse of A to solve for x. In fact, it's computationally more efficient not to.

So, before you code anything, the first step is to make sure you're solving the right problem. If the problem is to find the actual matrix inverse, go for Gaussian elimination with partial or full pivoting, as was mentioned above. If the problem is to actually solve linear systems, look for iterative techniques, like conjugate gradient, successive overrelaxation, Jacobi, Gauss-Seidel, etc. -- Paul
Jan 10 '07 #6

Sign in to post your reply or Sign up for a free account.

Similar topics

6
by: Ben Ingram | last post by:
Hi all, I am writing a template matrix class in which the template parameters are the number of rows and number of columns. There are a number of reasons why this is an appropriate tradeoff for...
5
by: Jason | last post by:
Hello. I am trying to learn how operator overloading works so I wrote a simple class to help me practice. I understand the basic opertoar overload like + - / *, but when I try to overload more...
15
by: christopher diggins | last post by:
Here is some code I wrote for Matrix multiplication for arbitrary dimensionality known at compile-time. I am curious how practical it is. For instance, is it common to know the dimensionality of...
6
by: vishnu mahendra | last post by:
hello to all, can any one please give me an algorithm to find inverse of a matrix of order n rows and m columns. thank you in advance, vishnu.
14
by: amitnanda | last post by:
Hi Guys, I have a matrix multiplication program in C that multiplies two matrices. When their size is 3*3 or 800*800, the program runs fine. But above that size, I get a "segmentation fault"....
20
by: Frank-O | last post by:
Hi , Recently I have been commited to the task of "translating" some complex statistical algorithms from Matlab to C++. The goal is to be three times as fast as matlab ( the latest) . I've...
1
by: Peterwkc | last post by:
Hello all expert, i have two program which make me desperate bu after i have noticed the forum, my future is become brightness back. By the way, my problem is like this i the first program was...
18
by: Hypnotik | last post by:
Hello everyone. I'm writing a program which uses a class called matrix. I have written all of the different functions, constructor, etc. When I run the program I receive "Constructor", which I...
2
by: Encrypted | last post by:
i am working with a matrix manipulation program...consists of a matrix class and its member functions.. i have also overloaded << and >>...so dat dey can read and print d whole matrix at one...
2
by: rijaalu | last post by:
I am designing a matrix class that performs addition, multicpication, substraction and division. When ever i complie the code it shows an error. include <iostream> using namespace std; class...
0
BarryA
by: BarryA | last post by:
What are the essential steps and strategies outlined in the Data Structures and Algorithms (DSA) roadmap for aspiring data scientists? How can individuals effectively utilize this roadmap to progress...
1
by: Sonnysonu | last post by:
This is the data of csv file 1 2 3 1 2 3 1 2 3 1 2 3 2 3 2 3 3 the lengths should be different i have to store the data by column-wise with in the specific length. suppose the i have to...
0
by: Hystou | last post by:
There are some requirements for setting up RAID: 1. The motherboard and BIOS support RAID configuration. 2. The motherboard has 2 or more available SATA protocol SSD/HDD slots (including MSATA, M.2...
0
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However,...
0
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can...
0
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers,...
0
by: Hystou | last post by:
Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows...
0
agi2029
by: agi2029 | last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing,...
0
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 1 May 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome a new...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.