The UNIX and Linux Forums  


Go Back   The UNIX and Linux Forums > Top Forums > Shell Programming and Scripting
.
google unix.com



Shell Programming and Scripting Post questions about KSH, CSH, SH, BASH, PERL, PHP, SED, AWK and OTHER shell scripts and shell scripting languages here.

More UNIX and Linux Forum Topics You Might Find Helpful
Thread Thread Starter Forum Replies Last Post
need help-matrix inverse (awk) vesyyr UNIX for Dummies Questions & Answers 0 12-14-2007 02:44 PM
PERL: How do I get both sizes of a matrix? foo.bar Shell Programming and Scripting 2 09-26-2007 06:25 PM
processing matrix column wise Abhishek Ghose Shell Programming and Scripting 5 08-21-2007 01:55 PM
Regarding Dot Matrix Printing aman_mlt Linux 0 02-23-2006 01:45 AM

 
English Japanese Spanish French German Portuguese Italian Dutch Swedish Russian Norwegian Hungarian Hebrew Danish Bulgarian Greek Powered by Powered by Google
 
LinkBack Thread Tools Search this Thread Rate Thread Display Modes
Prev Previous Post   Next Post Next
  #1 (permalink)  
Old 12-14-2007
vesyyr vesyyr is offline
Registered User
  
 

Join Date: Dec 2007
Posts: 2
Smile matrix inverse (awk)

I need to inverse a matrix given in a file.
The problem is I'm stuck with writing determinant finding algoritm into code.

I found this algoritm about finding determinant of nxn matrix. This is what i need:


Matrices and Determinants

and here:

a11 a12 a13
a21 a22 a23
a31 a32 a33

= a11(a22a33 − a23a32) − a12(a21a33 − a23a31) + a13(a21a32 − a22a31)
Note the pattern of + and − signs.
The general formula is compact, but tedious to compute. Here it is for an n by n matrix A:
detA = ai1Ci1 + ai2Ci2 + · · · + ainCin

where Cij are referred to as the cofactors and are computed from
Cij = (−1)i+j detMij
The term Mij is known as the ”minor matrix” and is the matrix you get if you eliminate row
i and column j from matrix A. So to find the determinant of e.g. a 4×4 matrix, you end up
calculating a bunch of 3 × 3 matrix determinants (much easier). Obviously you can apply this
technique recursively (probably using a computer).

***************

Can some1 please write it into my code or if he has time even complete the full inverse.

I read the matrix from a file into an array "row":
----------------

#!/usr/bin/awk -f
BEGIN{}
{
m=1
while (m <= NF){
row[NR,m] = $m
m++
}
}

END{}

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

thank you.
 

Bookmarks

Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes Rate This Thread
Rate This Thread:

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On




All times are GMT -4. The time now is 05:40 AM.


Powered by: vBulletin, Copyright ©2000 - 2006, Jelsoft Enterprises Limited. Language Translations Powered by .
vBCredits v1.4 Copyright ©2007 - 2008, PixelFX Studios
The UNIX and Linux Forums Content Copyright ©1993-2009. All Rights Reserved.Ad Management by RedTyger

Content Relevant URLs by vBSEO 3.2.0