Sparse Vector & Matrix Algebra Lecture #4 EEE 574 Dr. Dan Tylavsky.

Slides:



Advertisements
Similar presentations
2.3 Modeling Real World Data with Matrices
Advertisements

Chapter 4 Systems of Linear Equations; Matrices Section 2 Systems of Linear Equations and Augmented Matrics.
Lecture #14 EEE 574 Dr. Dan Tylavsky Matrix Inversion Lemma.
Triangular Linear Equations Lecture #5 EEE 574 Dr. Dan Tylavsky.
Sparse Matrix Storage Lecture #3 EEE 574 Dr. Dan Tylavsky.
Matrix Factorization Lecture #7 EEE 574 Dr. Dan Tylavsky.
Numerical Triangular Factorization Lecture #11 EEE 574 Dr. Dan Tylavsky.
Sparse Triangular Matrix Equations Lecture #6 EEE 574 Dr. Dan Tylavsky.
Lecture #22 EEE 574 Dr. Dan Tylavsky Newton-Raphson Power Flow Implementation.
Graphs and Matrix Storage Structures EEE 574 Dr. Dan Tylavsky.
Analysis of Triangular Factorization Lecture #8 EEE 574 Dr. Dan Tylavsky.
Fill Lecture #9 EEE 574 Dr. Dan Tylavsky. Fill © Copyright 1999 Daniel Tylavsky 4 When we solve Ax=b, (A sparse), fill-in will occur in the L,U factor.
Computer Science 1620 Multi-Dimensional Arrays. we used arrays to store a set of data of the same type e.g. store the assignment grades for a particular.
Lecture #12 EEE 574 Dr. Dan Tylavsky Optimal Ordering.
“No one can be told what the matrix is…
Part 3 Chapter 8 Linear Algebraic Equations and Matrices PowerPoints organized by Dr. Michael R. Gustafson II, Duke University All images copyright © The.
Arithmetic Operations on Matrices. 1. Definition of Matrix 2. Column, Row and Square Matrix 3. Addition and Subtraction of Matrices 4. Multiplying Row.
Table of Contents Matrices - Multiplication Assume that matrix A is of order m  n and matrix B is of order p  q. To determine whether or not A can be.
100’s of free ppt’s from library
Chapter 7 Matrix Mathematics Matrix Operations Copyright © The McGraw-Hill Companies, Inc. Permission required for reproduction or display.
Matrices Write and Augmented Matrix of a system of Linear Equations Write the system from the augmented matrix Solve Systems of Linear Equations using.
259 Lecture 14 Elementary Matrix Theory. 2 Matrix Definition  A matrix is a rectangular array of elements (usually numbers) written in rows and columns.
Algebra 2: Lesson 5 Using Matrices to Organize Data and Solve Problems.
ECON 1150 Matrix Operations Special Matrices
Matlab Chapter 2: Array and Matrix Operations. What is a vector? In Matlab, it is a single row (horizontal) or column (vertical) of numbers or characters.
Array Addition  Two arrays can be added if and only if both arrays have exactly the same dimensions.  Assuming the dimension requirement is satisfied,
Row 1 Row 2 Row 3 Row m Column 1Column 2Column 3 Column 4.
Targil 6 Notes This week: –Linear time Sort – continue: Radix Sort Some Cormen Questions –Sparse Matrix representation & usage. Bucket sort Counting sort.
1 Data Structures CSCI 132, Spring 2014 Lecture 32 Tables I.
Efficiency and Flexibility of Jagged Arrays Geir Gundersen Department of Informatics University of Bergen Norway Joint work with Trond Steihaug.
If A and B are both m × n matrices then the sum of A and B, denoted A + B, is a matrix obtained by adding corresponding elements of A and B. add these.
Sparse Vectors & Matrices Jyh-Shing Roger Jang ( 張智星 ) CSIE Dept, National Taiwan University.
Direct Methods for Sparse Linear Systems Lecture 4 Alessandra Nardi Thanks to Prof. Jacob White, Suvranu De, Deepak Ramaswamy, Michal Rewienski, and Karen.
Slide Copyright © 2009 Pearson Education, Inc. 7.3 Matrices.
Copyright © 2011 Pearson Education, Inc. Solving Linear Systems Using Matrices Section 6.1 Matrices and Determinants.
Matrix Algebra Section 7.2. Review of order of matrices 2 rows, 3 columns Order is determined by: (# of rows) x (# of columns)
Matrices: Simplifying Algebraic Expressions Combining Like Terms & Distributive Property.
Algebra Matrix Operations. Definition Matrix-A rectangular arrangement of numbers in rows and columns Dimensions- number of rows then columns Entries-
ECE 530 – Analysis Techniques for Large-Scale Electrical Systems Prof. Hao Zhu Dept. of Electrical and Computer Engineering University of Illinois at Urbana-Champaign.
CMPS 1371 Introduction to Computing for Engineers VECTORS.
Slide Copyright © 2009 Pearson Education, Inc. 7.4 Solving Systems of Equations by Using Matrices.
3.5 Perform Basic Matrix Operations Add Matrices Subtract Matrices Solve Matric equations for x and y.
Do Now: Perform the indicated operation. 1.). Algebra II Elements 11.1: Matrix Operations HW: HW: p.590 (16-36 even, 37, 44, 46)
4.2 Matrix Multiplication Objectives: Multiply 2 matrices. Use matrix multiplication to solve mathematical and real-world problems. Standard:
Matrix – is a rectangular arrangement of numbers in rows and columns. Dimensions – Size – m is rows, n is columns. m x n ( row ∙ column) Elements – The.
Solution of Sparse Linear Systems Numerical Simulation CSE245 Thanks to: Kin Sou, Deepak Ramaswamy, Michal Rewienski, Jacob White, Shihhsien Kuo and Karen.
A rectangular array of numeric or algebraic quantities subject to mathematical operations. The regular formation of elements into columns and rows.
13.3 Product of a Scalar and a Matrix.  In matrix algebra, a real number is often called a.  To multiply a matrix by a scalar, you multiply each entry.
Matrix Operations McDougal Littell Algebra 2 Larson, Boswell, Kanold, Stiff Larson, Boswell, Kanold, Stiff Algebra 2: Applications, Equations, Graphs Algebra.
EEE 244-3: MATRICES AND EQUATION SOLVING
13.4 Product of Two Matrices
12-1 Organizing Data Using Matrices
Christmas Packets are due on Friday!!!
10.4 The Algebra of Matrices
Matrix Operations Free powerpoints at
Matrix Operations.
Matrix Operations.
Matrix Operations Free powerpoints at
Linear Algebraic Equations and Matrices
Matrix Multiplication
Matrix Operations Monday, August 06, 2018.
Matrix Operations.
Other Kinds of Arrays Chapter 11
Section 7.4 Matrix Algebra.
Matrix Operations Free powerpoints at
25. Basic matrix operations
Objectives Multiply two matrices.
3.5 Perform Basic Matrix Operations
EEE 244-3: MATRICES AND EQUATION SOLVING
Presentation transcript:

Sparse Vector & Matrix Algebra Lecture #4 EEE 574 Dr. Dan Tylavsky

Sparse Vector & Matrix Algebra © Copyright 1999 Daniel Tylavsky 4 Sparse Vector Algebra –Integer Sets - Sets of integers may be thought of as a sparse storage technique for a vector of integers. –Ex: List 1: {2,4,5,6} –Ex: List 1: {2,4,5,6} (Mutually exclusive lists.) – List 2: {3,7,9} – List 3: {1,10}

Sparse Vector & Matrix Algebra © Copyright 1999 Daniel Tylavsky –Merging Sparse Integer Sets Single Switch Technique/Single Use –Ex: Consider Merging »List 1: {2,4,5,6} List 2: {1,2,7} List 3: {1,5} N=Greatest Integer in any list M=Total # Elem. in all lists. = Unique Elem. in all lists. Write Operations –N Clear (Switch Vector) –M Write “1” into Switch –M Write into List Compare Operations –M Comparisons of Switch

Sparse Vector & Matrix Algebra © Copyright 1999 Daniel Tylavsky –Merging Sparse Integer Sets Single Switch Technique/Single Use –Resultant list is unordered. List: {2,4,5,6,1,7} To order list, scan switch array in order (ascending/descending). Requires N Comparisons Sort Scheme Requires M(M-1)/2

Sparse Vector & Matrix Algebra © Copyright 1999 Daniel Tylavsky 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} To clear array for next use, only clear location in NewList.

Sparse Vector & Matrix Algebra © Copyright 1999 Daniel Tylavsky –Adding Sparse Vectors Expanded Accumulator –Ex: Add the following sparse vectors stored in unordered compact form: Step 1: Merge Row Indices –{1,3,5,9,4}

Sparse Vector & Matrix Algebra © Copyright 1999 Daniel Tylavsky Step 2: Zero Merged List Positions in real vector of length N. (Expanded Accumulator) {1,3,5,9,4} Step 3: Write first vector into accumulator. Step 4: Add subsequent lists to accumulator.

Sparse Vector & Matrix Algebra © Copyright 1999 Daniel Tylavsky Step 5: Use merged integer list to retrieve only relevant data.

Sparse Vector & Matrix Algebra © Copyright 1999 Daniel Tylavsky –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.

Sparse Vector & Matrix Algebra © Copyright 1999 Daniel Tylavsky Step 3: Clear first M position of A array. Step 4: Use R1Indx and Switch to write A1 into A. Step 5: Clear Switch array using merged list if necessary, {1,3,5,9,4}. Step 5: Use R2Indx and Switch to add A2 to A.

Sparse Vector & Matrix Algebra © Copyright 1999 Daniel Tylavsky –Inner Product Calculation of Unordered Sparse Vectors Inner product of col. Vectors: a,b: –Ex: Perform an inner product of the following sparse vectors stored in unordered compact form:

Sparse Vector & Matrix Algebra © Copyright 1999 Daniel Tylavsky Step 1: Use an expanded pointer array to identify all non- zeros in A1. Step 2: Using pointer array, compare A2 with A1 and accumulate all non-zero products. Position pointer array value at location k gives location of index k in array A1.

Sparse Vector & Matrix Algebra © Copyright 1999 Daniel Tylavsky –Sparse Matrix Addition Assumption: Matrices stored in RR(C)U. Procedure: –Use multiple switch technique to symbolically add row by row. Symbolic result is data structure for numerical result. –Using created data structure perform numerical result. –(For something this simple, symbolic and numerical routines would be interwoven; however they will be kept separate in this example to emphasis the difference between symbolic and numerical operations.)

Sparse Vector & Matrix Algebra © Copyright 1999 Daniel Tylavsky Initialize: Switch=0, End=0, IR=0 IR=IR+1 Merge RIndxA and RIndxB using multiple use switch technique with IR as switch value. Save merged indices as RIndxC. Increment End on each entry into RIndxC. Mark end of row of C data structure: ERP(IR)=End IR=N? Perform numerical segment. No Yes

Sparse Vector & Matrix Algebra © Copyright 1999 Daniel Tylavsky Symbolically add the following matrices stored in RR(C)U.

Sparse Vector & Matrix Algebra © Copyright 1999 Daniel Tylavsky Initialize: Switch=0, IR=0 Clear C(k) from 1 to N IR=IR+1 Use Switch array to point to where each col. is stored in C(k). Add A and B to appropriate locations in C from ERPA/B(IR-1)+1 to ERPA(IR). IR=N? End N Y

Sparse Vector & Matrix Algebra © Copyright 1999 Daniel Tylavsky You can show that the arrays at completion have the form:

Sparse Vector & Matrix Algebra © Copyright 1999 Daniel Tylavsky –Multiplying a Sparse Matrix by a Dense Vector. A  b=x –A is sparse. –b is dense. –x is dense. No need to perform symbolic manipulation. Assume: –A and b are store in RR(C)U, ordered compact form.

Sparse Vector & Matrix Algebra © Copyright 1999 Daniel Tylavsky Initialize: IR=0 Clear x(k) from 1 to N IR=IR+1 Set pointer to begin/end or row: IBEG=ERPA(IR-1)+1, IEND=ERPA(IR). Accumulate Inner Product and store in dense x using Inner Product Alg.* IR=N? End N Y * You may wish to modify the inner product algorithm to take advantage of b being dense. There is no need to use a switch array since A indices can be used as pointers to locations in b.

Sparse Vector & Matrix Algebra © Copyright 1999 Daniel Tylavsky –Multiplying a Sparse Matrix by a Sparse Vector. A  b=x –A is sparse. –b is sparse. –x is sparse? If x is stored as a sparse vector: –Perform symbolic manipulation. If x is stored as a dense vector: –No need to perform symbolic manipulation. Assume: –A and b are store in RR(C)U, CR(C)U

Sparse Vector & Matrix Algebra © Copyright 1999 Daniel Tylavsky Initialize: Switch=0, IR=0 Clear x(k) IR=IR+1 Set pointer to begin/end or row: IBEG=ERPA(IR-1)+1, IEND=ERPA(IR). Accumulate Inner Product and store in sparse x using Inner Product Alg. IR=N? End N Y If x is sparse, perform symbolic program segment to get CRO/U. If x is dense, assume x is stored in ordered compact form.

The End