Thread: Symetric Matrix calculation

1. Symetric Matrix calculation

Hi
Need some help about symetric matrix calculation. Need some generic formula to calculate in particular order.

-1 51 54 25 77
51 -1 44 70 96
54 44 -1 87 94
25 70 87 -1 88
77 96 94 88 -1

I want to add several items to make an array of sum in this order.
Example,
sum = 01 +12 + 23 + 34+ 45
(start with element row 0 column 1, last column number is index for next element)

some more example:
sum = 01 +13 + 34 + 45+ 52
sum = 01 +14 + 45 + 52+ 23
sum = 01 +15 + 52 + 23+ 34

sum = 02 +23 + 34 + 45+ 51
sum = 02 +24 + 45 + 51+ 13 and so on.

Each sum should take maximum number (maximum row or column, an item column is row for next item and each column is taken only one times)
as number of items in the matrix. If row and column is same we don't add it or if the cell value is -1.

How can I generelize these?

Br
Aktar

2. Re: Symetric Matrix calculation

Most programming languages support arrays, indexing of arrays, and loops. C++ is not an exception.

3. Re: Symetric Matrix calculation

Originally Posted by wizard_hu_
Most programming languages support arrays, indexing of arrays, and loops. C++ is not an exception.
I know, would be nice if you can give me general formula for this, I would like to include it in my app. I spent sometimes and looks difficult for me,

4. Re: Symetric Matrix calculation

This description is not entirely clear to me. Is it some kind of spanning-tree generator for weighted graphs? (http://en.wikipedia.org/wiki/Spanning_tree, http://en.wikipedia.org/wiki/Weighted_graph)

5. Re: Symetric Matrix calculation

Originally Posted by wizard_hu_
This description is not entirely clear to me. Is it some kind of spanning-tree generator for weighted graphs? (http://en.wikipedia.org/wiki/Spanning_tree, http://en.wikipedia.org/wiki/Weighted_graph)
Hi,
Thanks for your information.
Following link gave me some light for solving the problem but
http://www.cplusplus.com/reference/a...t_permutation/
I am going to use it in my Qt app and I get the following error

error: 'sort' was not declared in this scope
error: 'next_permutation' was not declared in this scope
If I test it in visual studio in windows, work great but in QtSDK it gives this error (I have included #include <algorithm> )
So what is missing for Qt project?

Posting Permissions

• You may not post new threads
• You may not post replies
• You may not post attachments
• You may not edit your posts
•