4.1 v1 Sparse Vector and Matrix Algebra

Expanded accumulator 13594 pos r1indxk a1k 0 1 1 20 2

Info iconThis preview shows page 1. Sign up to view the full content.

View Full Document Right Arrow Icon
This is the end of the preview. Sign up to access the rest of the document.

Unformatted text preview: s in real vector of length N. (Expanded Accumulator) {1,3,5,9,4} Pos: R1Indx(k): A1(k): 0 1 1 2.0 2 3 3.0 3 5 4.0 4 9 5.0 5 0 R2Indx(k): A2(k): 5 6.0 4 7.0 1 8.0 3 9.0 ExAcc(k): 10.0 2.0 0.0 X X 12.0 0.0 10.0 3.0 X 4.0 0.0 7.0 0.0 X X 6 0 7 0 8 0 9 0 X X X 5.0 0.0 X • Step 3: Write first vector into accumulator. • Step 4: Add subsequent lists to accumulator. 10 0 11 0 12 0 © Copyright 1999 Daniel Tylavsky Sparse Vector & Matrix Algebra • Step 5: Use merged integer list to retrieve only relevant data. Pos: R1Indx(k): A1(k): 1 1 2.0 2 3 3.0 3 5 4.0 4 9 5.0 R2Indx(k): A2(k): 5 6.0 4 7.0 1 8.0 3 9.0 ExAcc(k): 10.0 X 12.0 7.0 10.0 Rindx(k): A(k): 0 1 3 5 10.0 12.0 10.0 9 5.0 5 0 4 7.0 6 0 7 0 8 0 9 0 X X X 5.0 10 0 11 0 12 0 © Copyright 1999 Daniel Tylavsky Sparse Vector & Matrix Algebra – Teams: Use the expanded accumulator technique to add the follow sparse vectors stored in unordered compact form. Pos: R1Indx(k): A1(k): R2Indx(k): A2(k): 0 1 1 1.0 2 3 2.0 3 4 3.0 4 8 4.0 5 6 5.0 2 6.0 3 7.0 4 8.0 7 6 9.0 10.0 6 0 7 0 8 0 9 0 10 0 11 0 12 0 © Copyright 1999 Daniel Tylavsky Sparse Vector & Matrix Algebra – Adding Sparse Vectors • Expanded Pointer Array – Ex: Add the following sparse vectors stored in unordered compact form: • Step 1: Merge Row Index: {1,3,5,9,4} • Step 2: Store in expanded pointer array the position that each element of A will occupy. Pos: R...
View Full Document

Ask a homework question - tutors are online