4.1 v1 Sparse Vector and Matrix Algebra

# Vectors ab b n a t b a1 a 2 a n 2 a i bi

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: a n ] 2 = a i bi i =1 b n – Ex: Perform an inner product of the following sparse vectors stored in unordered compact form: ∑ 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 5 0 6 0 7 0 8 0 9 0 10 0 11 0 12 0 © Copyright 1999 Daniel Tylavsky Sparse Vector & Matrix Algebra • Step 1: Use an expanded pointer array to identify all nonzeros in A1. • Step 2: Using pointer array, compare A2 with A1 and accumulate all non-zero products. Pos: Pos: Pos: R1Indx(k): R1Indx(k): A1(k): A1(k): 3 4 1 2 3 4 1 2 5 9 1 3 5 9 1 3 2.0 3.0 4.0 5.0 2.0 3.0 4.0 5.0 R2Indx(k): R2Indx(k): A2(k): A2(k): 1 3 5 4 5 4 1 3 6.0 7.0 8.0 9.0 6.0 7.0 8.0 9.0 Pointer(k): Pointer(k): Pointer(k): Inner Prod: Inner Prod: 1 1 67.0 40.0 24.0 24.0 0 0 2 2 0 0 5 5 0 0 66 6 00 0 77 7 00 0 88 8 00 0 99 9 00 0 3 3 00 0 00 0 00 0 10 11 10 11 10 11 00 00 0 0 12 12 12 00 0 44 4 • Position pointer array value at location k gives location of index k in array A1. © Copyright 1999 Daniel Tylavsky Sparse Vector & Matrix Algebra – Sparse Matrix Addition • Assumption: Matrices stored in RR(C)U. • Procedure: – Use multiple switch technique to symb...
View Full Document

## This note was uploaded on 12/05/2012 for the course EEE 571 taught by Professor Tylavsky during the Spring '12 term at ASU.

Ask a homework question - tutors are online