Tuesday, July 28, 2009

Is there a source code for the adjoint of a matrix in C?

I am in the last stages of writing the code for it. I wanted to know if the code has already been written or not. I have used a[i][j] = (-1)^i+j * |M[i][j]| formula.

Is there a source code for the adjoint of a matrix in C?
It appears that the question period has expired. If you have received an answer that meets your needs, please choose one of those as a 'best answer.' If you haven't received a good answer for your question, you may want to consider the following,





1) Re-post your question. Newer questions get more activity on Yahoo! Answers than old ones.


2) If you do re-post your question, consider why it wasn't answered the first time. Could it be more specific? Could it be worded better? Were there grammatical or spelling errors? Was it in the best category?





If it doesn't seem likely that re-posting your question will help you, then here's a listing of my favorite 'answer sites'. Maybe one of them will help you.





Answers.com http://www.answers.com/


Bartleby http://www.bartleby.com/


Yahoo Reference http://education.yahoo.com/reference/


HowStuffWorks http://www.howstuffworks.com/


Wikipedia http://en.wikipedia.org/wiki/Main_Page





Since I really haven't answered your question, it is not necessary to give me any points. Regards.
Reply:Here is some code I found...





typedef struct ModelMatrix {


float mtx[3][3]; /* rotation/scale/shear matrix */


float translate[3]; /* translation */


} ModelMatrix;





transpose_adjoint( ModelMatrix *m, ModelMatrix *adjoint)


{


/* cofactor for each element */





adjoint-%26gt;mtx[0][0] = m-%26gt;mtx[1][1] * m-%26gt;mtx[2][2] - m-%26gt;mtx[1][2] * m-%26gt;mtx[2][1] ;


adjoint-%26gt;mtx[0][1] = m-%26gt;mtx[1][2] * m-%26gt;mtx[2][0] - m-%26gt;mtx[1][0] * m-%26gt;mtx[2][2] ;


adjoint-%26gt;mtx[0][2] = m-%26gt;mtx[1][0] * m-%26gt;mtx[2][1] - m-%26gt;mtx[1][1] * m-%26gt;mtx[2][0] ;


adjoint-%26gt;mtx[1][0] = m-%26gt;mtx[2][1] * m-%26gt;mtx[0][2] - m-%26gt;mtx[2][2] * m-%26gt;mtx[0][1] ;


adjoint-%26gt;mtx[1][1] = m-%26gt;mtx[2][2] * m-%26gt;mtx[0][0] - m-%26gt;mtx[2][0] * m-%26gt;mtx[0][2] ;


adjoint-%26gt;mtx[1][2] = m-%26gt;mtx[2][0] * m-%26gt;mtx[0][1] - m-%26gt;mtx[2][1] * m-%26gt;mtx[0][0] ;


adjoint-%26gt;mtx[2][0] = m-%26gt;mtx[0][1] * m-%26gt;mtx[1][2] - m-%26gt;mtx[0][2] * m-%26gt;mtx[1][1] ;


adjoint-%26gt;mtx[2][1] = m-%26gt;mtx[0][2] * m-%26gt;mtx[1][0] - m-%26gt;mtx[0][0] * m-%26gt;mtx[1][2] ;


adjoint-%26gt;mtx[2][2] = m-%26gt;mtx[0][0] * m-%26gt;mtx[1][1] - m-%26gt;mtx[0][1] * m-%26gt;mtx[1][0] ;


}





Also you might be interested in the following book that is also available on the web...





Numerical Recipes in C





http://library.lanl.gov/numerical/bookcp...


No comments:

Post a Comment