Presentation is loading. Please wait.

Presentation is loading. Please wait.

CS 284a Lecture Wednesday, 26 November, 1997

Similar presentations


Presentation on theme: "CS 284a Lecture Wednesday, 26 November, 1997"— Presentation transcript:

1 CS 284a Lecture Wednesday, 26 November, 1997
CS 284a, 26 November 1997 Copyright (c) , John Thornley

2 Final Homework: Skyline Matrix Problem
LU factorization of special kind of sparse matrix. Without pivoting. Part of the “Salishan Problems”. Need to avoid storage/computation of zero elements. CS 284a, 26 November 1997 Copyright (c) , John Thornley

3 Copyright (c) 1997-98, John Thornley
A Skyline Matrix 1 2 3 4 5 6 7 7 8 4 0  lower[i]  i for k in 0 .. lower[i] - 1 : A[i][k] == 0 for k in lower[i] .. i : A[i][k] != 0 0  upper[j]  j for k in 0 .. upper[j] - 1 : A[k][j] == 0 for k in upper[j] .. j : A[k][j] != 0 for i in 0 .. n - 1 : for j in 0 .. n - 1 : 1 3 5 3 2 8 1 2 2 7 3 2 4 7 4 1 4 8 5 8 4 5 7 6 3 7 5 1 6 9 1 8 9 4 7 4 6 2 8 A lower[0 .. 7] = {0, 1, 1, 1, 3, 1, 2, 4} upper[0 .. 7] = {0, 1, 2, 0, 4, 2, 0, 7} CS 284a, 26 November 1997 Copyright (c) , John Thornley

4 Skyline Matrix Representation
7 1 1 3 2 8 2 1 3 2 4 3 8 5 2 7 4 8 4 5 5 7 6 3 7 5 2 4 8 5 6 9 1 8 9 6 4 3 7 1 4 1 9 7 4 6 2 7 8 L U CS 284a, 26 November 1997 Copyright (c) , John Thornley

5 Skyline Matrix Type Definition
typedef struct { int n; int *lower, *upper; float **L, **U; } skyline_matrix; CS 284a, 26 November 1997 Copyright (c) , John Thornley

6 Skyline Matrix Problem Declaration (Sequential)
void solve(skyline_matrix A, float b[], float x[]); /* Given A and B, compute x such that Ax = b. */ CS 284a, 26 November 1997 Copyright (c) , John Thornley

7 Solving Ax = b Using LU Factorization
Goal: Solve Ax = b for x. Step 1: Solve A = LU for L and U. Step 2: Solve Ly = b for y (by forward substitution). Step 3: Solve Ux = y for x (by back substitution). CS 284a, 26 November 1997 Copyright (c) , John Thornley

8 Copyright (c) 1997-98, John Thornley
LU Factorization Factorize A into unit lower-triangular and general upper-triangular factors: for 0  i < n, 0  j < i : LU[i][j] = (A[i][j] - LU[i][0..j-1]*LU[0..j-1][j])/LU[j][j] for 0  i < n, i  j < n : LU[i][j] = A[i][j] - LU[i][0..i-1]*LU[0..i-1][j] 6 3 5 9 4 7 8 3 4 1 6 3 5 9 4 7 8 3 4 18 13 18 23 9 22 28 11 9 3 1 4 3 -4 -3 1 4 2 -3 42 37 45 52 23 50 71 37 20 7 4 1 -2 5 7 -3 -1 8 4 24 4 2 81 68 15 23 58 54 4 -2 6 1 7 4 7 5 2 8 18 37 32 65 43 82 91 58 67 3 7 2 8 1 6 4 1 3 4 12 26 31 11 18 81 70 24 40 2 5 -3 4 5 1 5 6 9 7 36 30 25 56 94 11 25 62 18 6 3 7 -3 7 -4 1 4 3 -1 18 29 38 29 5 78 80 2 24 3 5 -4 6 2 -2 3 1 6 4 42 37 37 86 41 50 94 64 39 7 4 5 2 -3 2 2 -4 1 3 A L U CS 284a, 26 November 1997 Copyright (c) , John Thornley

9 Multithreaded LU Factorization of Skyline Matrix
LU is same shape as A. Therefore, write LU over A as usual. Could use barriers, but this limits concurrency. Blocking and counters should perform better. CS 284a, 26 November 1997 Copyright (c) , John Thornley


Download ppt "CS 284a Lecture Wednesday, 26 November, 1997"

Similar presentations


Ads by Google