Solved

inverse matrix

Posted on 1997-12-11
19
521 Views
Last Modified: 2010-05-18
how can I get the inverse of a N x N matrix I need this code ASAP please very quick
0
Comment
Question by:latino
  • 10
  • 5
  • 2
  • +2
19 Comments
 

Author Comment

by:latino
ID: 1256601
I Need this answer as soon as posible !!!!!!!!
0
 
LVL 10

Expert Comment

by:rbr
ID: 1256602
It depends on the size an shape of your matrix. If you need different algorithmen look for the book Numerical Recipies in C.

Online source code for this book at
http://
0
 
LVL 10

Expert Comment

by:rbr
ID: 1256603
Sorry i forgot the WWW-adress:
http://cfatab.havard.edu/nr/nronline.html
0
 

Author Comment

by:latino
ID: 1256604
http:// what???? there is no any answer, If please you can help me with the code I'll greatly appreciate it!!!!!!!!!

Ok let's say it's a 10 x 10 matrix

ASAP PLEASE
0
 

Author Comment

by:latino
ID: 1256605
This didn't help cause all I need is the code in that URL there is nothing about what I need

What if is a 10 x 10 matrix and I wanna find the inverse

PLEASE ASAP
0
 

Author Comment

by:latino
ID: 1256606
Still wating if EXPERTS can strike I'm here
0
 

Author Comment

by:latino
ID: 1256607
Still wating if EXPERTS can strike I'm here
0
 

Author Comment

by:latino
ID: 1256608
Godness Experts I really need this code I'll greatly appreciate
your assistance!!!!!!!!!!!!!!!!
0
 
LVL 10

Expert Comment

by:RONSLOW
ID: 1256609
here is 4x4 ... I'm looking for more for you...

From: gmt@aviator.cis.ufl.edu (Gary McTaggart)
Newsgroups: comp.graphics.algorithms
Subject: Re: Request: Inverse of a 4x4 matrix algorithm
Date: 21 May 1994 20:44:04 GMT
Mike Matsel (matsel@cs.uoregon.edu) wrote:

Does anyone have C code, or at least some psuedo-code for the finding the inverse of a 4 x 4 matrix? Its for a ray tracer. Thanks!
In a lot of cases in graphics, you will be strictly dealing with affine transforms. (My cheesy non-definition of affine is that you are only dealing with translations, rotations, and scaling. . .no shearing or perspective projection.) If this is the case, then you can use the following to find the inverse:


--------------------------------------------------------------------------------


// (Note that a Matrix is:
//   typedef float Matrix[4][4];
//
// Generally speaking, a matrix doesn't need to be bigger than 4x3, but
// since this code is to work with GL and it uses 4x4 matrices. . .

// Find the inverse of a matrix that is made up of only scales, rotations,
// and translations.
void MatrixAffineInverse( Matrix m, Matrix result )
{
  float Tx, Ty, Tz;

  // The rotational part of the matrix is simply the transpose of the
  // original matrix.
  result[0][0] = m[0][0];
  result[1][0] = m[0][1];
  result[2][0] = m[0][2];

  result[0][1] = m[1][0];
  result[1][1] = m[1][1];
  result[2][1] = m[1][2];

  result[0][2] = m[2][0];
  result[1][2] = m[2][1];
  result[2][2] = m[2][2];
 
  // The right column vector of the matrix should always be [ 0 0 0 1 ]
  // In most cases. . . you don't need this column at all because it'll
  // never be used in the program, but since this code is used with GL
  // and it does consider this column, it is here.
  result[0][3] = result[1][3] = result[2][3] = 0;
  result[3][3] = 1;

  // The translation components of the original matrix.
  Tx = m[3][0];
  Ty = m[3][1];
  Tz = m[3][2];
 
  // Rresult = -(Tm * Rm) to get the translation part of the inverse
  result[3][0] = -( m[0][0] * Tx + m[0][1] * Ty + m[0][2] * Tz );
  result[3][1] = -( m[1][0] * Tx + m[1][1] * Ty + m[1][2] * Tz );
  result[3][2] = -( m[2][0] * Tx + m[2][1] * Ty + m[2][2] * Tz );
}

0
Netscaler Common Configuration How To guides

If you use NetScaler you will want to see these guides. The NetScaler How To Guides show administrators how to get NetScaler up and configured by providing instructions for common scenarios and some not so common ones.

 
LVL 10

Expert Comment

by:RONSLOW
ID: 1256610
Here is another at http://irecall.com/vve/matrix.c


0
 

Author Comment

by:latino
ID: 1256611
I can still wait for this a little bit more
thanks Ronslow
0
 
LVL 2

Expert Comment

by:kellyjj
ID: 1256612
Sounds like a homework assignment?  I have to ask you... Do you know how to get the inverse of a matrix by hand??  If you can't do it by hand then you really won't be able to understand or even write a program to do it for you.  

If you do know how to get the inverse by hand the just write code to do what you would do.  I know that it won't be the best code, but it will be a good starting point.
0
 

Author Comment

by:latino
ID: 1256613
you are right kelly it's a homework but I know how to get it by hand but this code should be able to get the inverse of a matrix bigger than a 4 X 4 and that's where I fall dowm! but I'll keep trying and see what I come up with

Thanks anyway
0
 
LVL 10

Expert Comment

by:RONSLOW
ID: 1256614
0
 

Expert Comment

by:hbadr
ID: 1256615
do you still want the code ??
0
 

Author Comment

by:latino
ID: 1256616
I do habdr!!! thanks
0
 
LVL 10

Expert Comment

by:RONSLOW
ID: 1256617
Why the reject ???
0
 
LVL 10

Accepted Solution

by:
RONSLOW earned 100 total points
ID: 1256618
Why the reject ???  
0
 

Author Comment

by:latino
ID: 1256619
Thanks Ronslow
0

Featured Post

3 Use Cases for Connected Systems

Our Dev teams are like yours. They’re continually cranking out code for new features/bugs fixes, testing, deploying, testing some more, responding to production monitoring events and more. It’s complex. So, we thought you’d like to see what’s working for us.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Suggested Solutions

Title # Comments Views Activity
Concatenate two strings Last and First Name 10 59
Problem to scan all sheets 3 95
Resolve Dependency Issues 4 47
Memory going from 12gb to 64gb or 96gb. worth it? 15 135
This tutorial is posted by Aaron Wojnowski, administrator at SDKExpert.net.  To view more iPhone tutorials, visit www.sdkexpert.net. This is a very simple tutorial on finding the user's current location easily. In this tutorial, you will learn ho…
Windows programmers of the C/C++ variety, how many of you realise that since Window 9x Microsoft has been lying to you about what constitutes Unicode (http://en.wikipedia.org/wiki/Unicode)? They will have you believe that Unicode requires you to use…
The goal of this video is to provide viewers with basic examples to understand opening and writing to files in the C programming language.
Video by: Grant
The goal of this video is to provide viewers with basic examples to understand and use nested-loops in the C programming language.

910 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question

Need Help in Real-Time?

Connect with top rated Experts

16 Experts available now in Live!

Get 1:1 Help Now