Unit-3-Floyd Warshal Algorithm
Unit-3-Floyd Warshal Algorithm
1
Solving Systems of Equations
a11x1 = b1
a21x1 + a22x2 = b2 , and so on…
2
Equation Solver
3
Equation Solver Example
• When an x, b, and a meet at a cell, ax is subtracted from b
• When b and a meet at cell 1, b is divided by a to become x
4
Complexity
• Time steps = 2N – 1
• Note that half the processors are idle every time step –
can improve efficiency by solving two interleaved
equation systems simultaneously
5
Inverting Triangular Matrices
6
Inverting Triangular Matrices
7
Solving Tridiagonal Matrices
8
Odd-Even Reduction
10
The Algorithm
• The ith leaf receives the inputs ui, di, li, and bi
1 0 -1/2 x1 -3/2 1 0 0 x1 -2
0 1 -3/2 x2 = 3/2 0 1 0 x2 = 0
0 0 1 x3 -1 0 0 1 x3 -1
13
Algorithm Implementation
14
Algorithm Implementation
• Each cell stores i = ak,I – the value for the normalized pivot row
• This value is used when subtracting a multiple of the pivot row from other rows
• What is the multiple? It is aj,1
• How does each cell receive aj,1 ? It is passed rightward by the first cell
• Each cell now outputs the new values for each row
• The first cell only outputs zeroes and these outputs are no longer needed
15
Algorithm Implementation
• The outputs of all but the first cell must now go through the remaining
algorithm steps
• A triangular matrix of processors efficiently implements the flow of data
• Number of time steps?
• Can be extended to compute the inverse of a matrix
16
Graph Algorithms
17
Floyd Warshall Algorithm
18
Implementation on 2d Processor Array
Row 3
Row 2 Row 3
Row 1 Row 2 Row 3
• When a row passes over the 1st row, the value of ai1 is
broadcast to the entire row – aij is set to 1 if ai1 = a1j = 1
– in other words, the row is now the ith row of A(1)
• By the time the kth row finds its empty slot, it has already
become the kth row of A(k-1) 20
Algorithm Implementation
21
Title
• Bullet
22