Path: utzoo!utgpu!watserv1!watmath!att!linac!pacific.mps.ohio-state.edu!zaphod.mps.ohio-state.edu!samsung!cs.utexas.edu!convex!news From: dodson@convex.COM (Dave Dodson) Newsgroups: comp.sources.wanted,aus.wanted Subject: Re: Wanted: C matrix handling functions Keywords: inverse determinant Message-ID: <1991Jan10.160539.21452@convex.com> Date: 10 Jan 91 16:05:39 GMT References: <1206@erm.oz> Sender: news@convex.com (news access account) Reply-To: dodson@convex.COM (Dave Dodson) Organization: Convex Computer Corporation; Richardson, TX Lines: 30 Nntp-Posting-Host: mozart.convex.com In article <1206@erm.oz> david@erm.oz (David Hayward) writes: >I am looking for some public domain C code to do the following: >1) Calculate the determinant of a matrix. >2) Calculate the inverse of a matrix. > >If someone has code or knows where to get it, I would greatly appreciate it if >you could get in touch with me. Try "Numerical Recipes in C". The code is not in the public domain, but is widely available and I think buying a book and maybe the accompanying floppy disk gives you the right to use the code for non-commercial use. Be advised, however, that it is almost never really necessary or even desirable to compute either the determinant or the inverse of a matrix. While papers and reference books extensively use the notation "det(A) = 0" to mean "A is singular," there are both more efficient and more reliable methods for detecting singularity. Similarly, the notation "A^(-1) * b" is often used to mean "the solution of the system of linear equations A * x = b." It is more efficient and more accurate to compute the solution directly than to invert the coefficient matrix and multiply the inverse times the right-hand-side vector. This is true even if there are many systems of equations, all using the same coefficient matrix; the matrix may be factored once and the systems may be solved from the factors just as efficiently--and more accurately--than by matrix multiplication by the inverse. ---------------------------------------------------------------------- Dave Dodson dodson@convex.COM Convex Computer Corporation Richardson, Texas (214) 497-4234