Continue to Site

Eng-Tips is the largest engineering community on the Internet

Intelligent Work Forums for Engineering Professionals

  • Congratulations KootK on being selected by the Eng-Tips community for having the most helpful posts in the forums last week. Way to Go!

manipulating a matrix

Status
Not open for further replies.

gecko3

Electrical
Dec 1, 2005
3
Hello, I am trying to build a loop that makes a matrix diagnolly dominant (I'm not sure if thats the right term... I mean where the values on the diagnol are from greatest to least... like this

like if I was given this:


2 3 7 8
9 2 3 4
5 9 0 6
3 8 4 3

I would get this:



9 2 3 4
3 8 4 3
2 3 7 8
5 9 0 6

with 9,8,7,6 making this diagnolly dominant.

I was wondering if anyone has any ideas on the simplest way to go about this...

I'm having a hard time thinking on how to approach this, I'm thinking

1) compare the entire first column
2) take the line with the largest first column value and switch
it with first line
3) lock the first line then compare colum 2 in the following 3 lines
put largest value for column 2 line as second line
4) lock the 2nd line check the third column last two lines
if the 3rd line has the larger value switch those as well....


at this point I'm thinking my algorithm is running into trouble...

any suggestions would be greatly appreciated.

Thank You
 
Replies continue below

Recommended for you

Look up partial-pivoting on the net. What you're looking for is normally the first part of LU decomposition. The diagonally dominant matrix gives the best results.
 
What are you actualy trying to achieve?
Is it "just" putting the highest value on the diagonal or the first step in a LU decomposition?
If the latter other things are important too, especially if you are interested in sparse-matrices.

I know something about sparse matrices (related to Equation Oriented flowsheeting).
Some algorithms AND code are available from literature for such matrices
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor