4.1 v1 Sparse Vector and Matrix Algebra

# Pos r1indxk a1k 1 1 20 2 3 30 3 5 40 4 9 50 r2indxk

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

This is the end of the preview. Sign up to access the rest of the document.

Unformatted text preview: 1Indx(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 Switch(k): 1 X 2 5 5 0 6 0 7 0 8 0 9 0 3 X X X 4 10 0 11 0 12 0 © Copyright 1999 Daniel Tylavsky Sparse Vector & Matrix Algebra • Step 3: Clear first M position of A array. • Step 4: Use R1Indx and Switch to write A1 into A. • Step 5: Use R2Indx and Switch to add A2 to A. Pos: 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 Switch(k): A(k): 1 X 2 5 10.0 12.0 10.0 0.0 2.0 3.0 4.0 0.0 0.0 0.0 5.0 0 5 0 6 0 7 0 8 0 9 0 3 7.0 0.0 X X X X X X 10 0 11 0 12 0 4 X • Step 5: Clear Switch array using merged list if necessary, {1,3,5,9,4}. © Copyright 1999 Daniel Tylavsky Sparse Vector & Matrix Algebra – Teams: Use the expanded pointer technique to add the follow sparse vectors stored in unordered compact form. • Step 1: Merge Row Indices – {1,3,4,8,6,2,7} 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 – Inner Product Calculation of Unordered Sparse Vectors b1 • Inner product of col. Vectors: a,b: b n a T • b = [ a1 a 2...
View Full Document

{[ snackBarMessage ]}

Ask a homework question - tutors are online