# Thread: Diagonalising none-square matrix

1. ## Diagonalising none-square matrix

Hello all,

I hope you can help me out here, I am not very good in maths....

I want to go from a random matrix
VW X Y Z
A: 1 0 0 1 1
B: 0 0 1 0 0
C: 1 0 0 0 0
D: 0 1 0 0 0

to a 'diagonlised' matrix where higher values far from the diagonal are penalised.

X Y V Z W
B: 1 0 0 0 0
A: 0 1 1 1 0
C: 0 0 1 0 0
D: 0 0 0 0 1

Only by swithing the order of rows and columns.

Are there algorithms or programs that can do this transformation?

In reality I have the next problem:

For a distribution centre I have a set of shops and a set of articles. Each day the orders for the shops are received:

Orders:
Shop 1: Article 1: 3 units, article 4: 2 units
Shop 2: Article 3: 1 unit, article 7: 2 units
etc.

If I put this information in a matrix; I get horizontally the shops and vertically the articles:

.........Articles
Shop 1 2 3 4 5 6 7
........1 3 0 0 2 0 0 0
........2 0 0 1 0 0 0 2
etc.

In realtity this matrices are much larger, with 300 shops and 10,000 different articles.

If I want to serve the shops in different batches, say 50 shops at the time, the chance that I have to serve a lot of articles in each batch is large. However, if I will be able to get groups of shops that request the same type of articles, I will reduce the number of articels in each batch. Changing the order of rows and columns in the original table so that most values are near the diagonal will result in less articles per batch.