×
INTELLIGENT WORK FORUMS
FOR ENGINEERING PROFESSIONALS

Are you an
Engineering professional?
Join Eng-Tips Forums!
• Talk With Other Members
• Be Notified Of Responses
• Keyword Search
Favorite Forums
• Automated Signatures
• Best Of All, It's Free!

*Eng-Tips's functionality depends on members receiving e-mail. By joining you are opting in to receive e-mail.

#### Posting Guidelines

Promoting, selling, recruiting, coursework and thesis posting is forbidden.

# manipulating a matrix

## manipulating a matrix

(OP)
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'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

### RE: manipulating a matrix

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.

### RE: manipulating a matrix

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

#### Red Flag This Post

Please let us know here why this post is inappropriate. Reasons such as off-topic, duplicates, flames, illegal, vulgar, or students posting their homework.

#### Red Flag Submitted

Thank you for helping keep Eng-Tips Forums free from inappropriate posts.
The Eng-Tips staff will check this out and take appropriate action.

Close Box

# Join Eng-Tips® Today!

Join your peers on the Internet's largest technical engineering professional community.
It's easy to join and it's free.

Here's Why Members Love Eng-Tips Forums:

• Talk To Other Members
• Notification Of Responses To Questions
• Favorite Forums One Click Access
• Keyword Search Of All Posts, And More...

Register now while it's still free!