{[ promptMessage ]}

Bookmark it

{[ promptMessage ]}

4.1 v1 Sparse Vector and Matrix Algebra

# List 245617 pos switchk listk newlistk 0 1 1 2 1 2 1

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: ngle Use – Resultant list is unordered. List: {2,4,5,6,1,7} Pos: Switch(k): List(k) NewList(k) 0 1 1 2 1 2 1 4 2 3 0 5 4 4 1 6 5 5 1 1 6 • To order list, scan switch array in order (ascending/descending). • Requires N Comparisons • Sort Scheme Requires M(M-1)/2 6 1 7 7 7 1 8 0 9 0 10 0 11 0 12 0 © Copyright 1999 Daniel Tylavsky Sparse Vector & Matrix Algebra • To clear array for next use, only clear location in NewList. Pos: Switch(k): List(k) NewList(k) 0 1 0 1 0 2 1 2 0 1 0 4 2 3 0 0 5 4 4 0 1 0 6 5 5 0 1 0 1 6 6 0 1 0 7 7 7 0 1 8 0 9 0 10 0 11 0 12 0 • To merge two new lists, no need to clear array. Simply use a different switch value. (Multiple Use Technique.) • EX: Merge: List A {1,3,5}, List B {2,3,6} Pos: Switch(k): NxtList(k) 0 1 2 1 1 2 2 1 3 3 2 0 5 4 1 2 5 2 1 6 6 2 1 7 1 8 0 9 0 10 0 11 0 12 0 © Copyright 1999 Daniel Tylavsky Sparse Vector & Matrix Algebra – Adding Sparse Vectors • Expanded Accumulator – Ex: Add the following sparse vectors stored in unordered compact form: Pos: R1Indx(k): A1(k): R2Indx(k): A2(k): 0 1 1 2.0 2 3 3.0 3 5 4.0 4 9 5.0 5 6.0 4 7.0 1 8.0 5 0 3 9.0 • Step 1: Merge Row Indices – {1,3,5,9,4} 6 0 7 0 8 0 9 0 10 0 11 0 12 0 © Copyright 1999 Daniel Tylavsky Sparse Vector & Matrix Algebra • Step 2: Zero Merged List Position...
View Full Document

{[ snackBarMessage ]}

Ask a homework question - tutors are online