Data Structures and Algorithms(12)

Size: px
Start display at page:

Download "Data Structures and Algorithms(12)"

Transcription

1 Ming Zhang "Data s and Algorithms" Data s and Algorithms(12) Instructor: Ming Zhang Textbook Authors: Ming Zhang, Tengjiao Wang and Haiyan Zhao Higher Education Press, (the "Eleventh Five-Year" national planning textbook)

2 12.1 Multidimensional array Basic Concepts of Array Storage of Array Declaration of Array Special Matrices Implemented by Arrays Sparse Matrix 12.2 Generalized List 12.3 Storage management 12.4 Trie 12.5 Improved BST 2 Ming Zhang Data s and Algorithms

3 Basic Concepts Array is an ordered sequence with fixed number of elements and type. The size and type of static array must be specified at compile time Dynamic array is allocated memory at runtime 3 Ming Zhang Data s and Algorithms

4 Basic Concepts Multidimensional array is an extension of onedimensional array (vector). Vector of vectors make up an multidimensional array. Represented as ELEM A[c 1..d 1 ][c 2..d 2 ] [c n..d n ] c i and d i are upper and lower bounds of the indices in the i-th dimension. Thus, the total n number of elements is: i1 ( d i c i 1) 4 Ming Zhang Data s and Algorithms 4

5 of Array d1=3,d2=5 d2 d1 d1=3,d2=4, d3 d3=2 d1 d2 a[1][1] a[1][3][5] 2-dimensional array 3-dimensional array d1[0..2], d2[0..3], d3[0..1] are the three dimensions respectively 5 Ming Zhang Data s and Algorithms 5

6 Storage of Array Memory is one-dimensional, so arrays are stored linearly Stored row by row (row-major) Stored column by column (column-major) X= Ming Zhang Data s and Algorithms

7 Row-Major in Pascal a[1..k,1..m,1..n] a 111 a 112 a 113 a 11n a 122 a 123 a 12n a 121 a 1m1 a 1m2 a 1m3 a 1mn a 211 a 212 a 213 a 21n a 221 a 222 a 223 a 22n a 2m1 a 2m2 a 2m3 a 2mn a k11 a k12 a k13 a k1n a k21 a k22 a k23 a k2n a km1 a km2 a km3 a kmn 7 Ming Zhang Data s and Algorithms

8 Column-Major in FORTRAN a 111 a 211 a 311 a k11 a 121 a 221 a 321 a k21 a 1m1 a 2m1 a 3m1 a km1 a 112 a 212 a 312 a k12 a 122 a 222 a 322 a k22 a 1m2 a 2m2 a 3m2 a km2 a 11n a 21n a 31n a k1n a 12n a 22n a 32n a k2n a 1mn a 2mn a 3mn a kmn a[1..k, 1..m, 1..n] 8 Ming Zhang Data s and Algorithms

9 C++ multidimensional array ELEM A[d 1 ][ d 2 ] [d n ]; loc( A[ j, j,, j ]) loc( A[0,0,,0]) 1 2 d [ j d d j d d 1 2 n 2 3 j d j n n1 n n ] n1 loc( A[0,0,,0]) d [ j d j ] n n i k n i1 k i 1 9 Ming Zhang Data s and Algorithms 9

10 Special Matrices Implemented by Arrays Triangular matrix (upper/lower) Symmetric matrix Diagonal matrix Sparse matrix 10 Ming Zhang Data s and Algorithms 10

11 Lower Triangular Matrix One-dimensional array: list[0.. (n 2 +n)/2-1] The matrix element a i,j is stored in list[ (i 2 +i) /2 + j] (i>=j) Ming Zhang Data s and Algorithms 11

12 Symmetric Matrix Satisfies that a i,j = a j,i, 0 i, j < n The matrix on the right is a (symmetric) adjacent matrix for a undirected graph Store the lower triangle in a 1-dimensional array sa[0..n (n+1) /2-1] There is a one-to-one mapping between sa[k] and a i,j : k j( j 1) / 2 i, i j i( i 1) / 2 j, i j 12 Ming Zhang Data s and Algorithms

13 Diagonal Matrix Diagonal matrix: all non-zero elements are located at diagonal lines. Band matric: a[i][j] = 0 when i-j > 1 A band matrix with bandwidth 1 is shown as below a 0,0 a 0,1 a 1,0 a1,1 0 a 1,2 0 a n-1,n-2 a n-2,n-1 a n-1,n-1 13 Ming Zhang Data s and Algorithms 13

14 Sparse Matrix Few non-zero elemens, and these elements distribute unevenly A Ming Zhang Data s and Algorithms

15 Sparse Factor In a m n matrix, there are t non-zero elements, and the sparse factor is: When this value is lower than 0.05, the matrix could be considered a sparse matrix. 3-tuple (i, j, a ij ): commonly used for input/output i is the row number j is the column number a ij is the element value m t n 15 Ming Zhang Data s and Algorithms

16 Orthogonal Lists of a Sparse Matrix An orthogonal list consists of two sets of lists pointer sequense for rows and columns Each node has two pointers: one points to the successor on the same row; the other points to the successor on the same column head pointer for rows head pointer for columns Ming Zhang Data s and Algorithms 16

17 Classic Matrix Multiplication 17 Ming Zhang Data s and Algorithms 17

18 Time Cost of Classic Matrix Multiplication p=d1-c1+1,m=d3-c3+1,n=d2-c2+1; A is a p m matrix, B is a m n matrix, resulting in C, a p n matrix So the time cost of the classic matrix multiplication is O (p m n) for (i=c1; i<=d1; i++) for } (j=c2; j<=d2; j++){ sum = 0; for (k=c3; k<=d3; k++) sum = sum + A[i,k]*B[k,j]; C[i,j] = sum; 18 Ming Zhang Data s and Algorithms 18

19 head pointer for columns Sparse Matrix Multiplication = head pointer for rows finish Ming Zhang Data s and Algorithms 19

20 Time Cost of Sparse Matrix Multiplication A is a p m matrix, B is a m n matrix, resulting in C, a p n matrix. If the number of non-zero elements in a row of A is at most t a and the number of non-zero elements in a column of B is at most t b Overall running time is reduced to O ( (t a +t b ) p n) Time cost of classic matrix multiplication is O (p m n) 20 Ming Zhang Data s and Algorithms 20

21 Applications of Sparse Matrix polynomial of one indeterminate P n 2 ( x) a a x a x n 0 i0 a i 1 x i 2 a n x n 21 Ming Zhang Data s and Algorithms 21

22 Ming Zhang Data s and Algorithms Data s and Algorithms Thanks the National Elaborate Course (Only available for IPs in China) Ming Zhang, Tengjiao Wang and Haiyan Zhao Higher Education Press, (awarded as the "Eleventh Five-Year" national planning textbook)

Data Structures and Algorithms(2)

Data Structures and Algorithms(2) Ming Zhang Data Structures and Algorithms Data Structures and Algorithms(2) Instructor: Ming Zhang Textbook Authors: Ming Zhang, Tengjiao Wang and Haiyan Zhao Higher Education Press, 2008.6 (the "Eleventh

More information

Matrix Multiplication

Matrix Multiplication Matrix Multiplication CPS343 Parallel and High Performance Computing Spring 2013 CPS343 (Parallel and HPC) Matrix Multiplication Spring 2013 1 / 32 Outline 1 Matrix operations Importance Dense and sparse

More information

Matrix Multiplication

Matrix Multiplication Matrix Multiplication CPS343 Parallel and High Performance Computing Spring 2018 CPS343 (Parallel and HPC) Matrix Multiplication Spring 2018 1 / 32 Outline 1 Matrix operations Importance Dense and sparse

More information

Data Structures and Algorithms(12)

Data Structures and Algorithms(12) Ming Zhang "Data s and Algorithms" Data s and Algorithms(12) Instructor: Ming Zhang Textbook Authors: Ming Zhang, Tengjiao Wang and Haiyan Zhao Higher Education Press, 2008.6 (the "Eleventh Five-Year"

More information

Data Structures and Algorithms(8)

Data Structures and Algorithms(8) Data Structures and Algorithms(8) Instructor: Ming Zhang Textbook Authors:Ming Zhang, Tengjiao Wang and Haiyan Zhao Higher Education Press, 2008.6 (the Eleventh Five-Year national planning textbook) https://courses.edx.org/courses/pekingx/04830050x/2t2014/

More information

Data Structures and Algorithms(10)

Data Structures and Algorithms(10) Ming Zhang "Data Structures and Algorithms" Data Structures and Algorithms(10) Instructor: Ming Zhang Textbook Authors: Ming Zhang, Tengjiao Wang and Haiyan Zhao Higher Education Press, 2008.6 (the "Eleventh

More information

Data Structures and Algorithms(4)

Data Structures and Algorithms(4) Ming Zhang Data Structures and Algorithms Data Structures and Algorithms(4) Instructor: Ming Zhang Textbook Authors: Ming Zhang, Tengjiao Wang and Haiyan Zhao Higher Education Press, 2008.6 (the "Eleventh

More information

Data Structures and Algorithms(1)

Data Structures and Algorithms(1) Ming Zhang Data Structures and Algorithms Data Structures and Algorithms() Instructor: Ming Zhang Textbook Authors: Ming Zhang, Tengjiao Wang and Haiyan Zhao Higher Education Press, 008.6 (the "Eleventh

More information

Data Structures and Algorithms(1)

Data Structures and Algorithms(1) Ming Zhang Data Structures and Algorithms Data Structures and Algorithms(1) Instructor: Ming Zhang Textbook Authors: Ming Zhang, Tengjiao Wang and Haiyan Zhao Higher Education Press, 2008.6 (the "Eleventh

More information

CSE 230 Intermediate Programming in C and C++ Arrays and Pointers

CSE 230 Intermediate Programming in C and C++ Arrays and Pointers CSE 230 Intermediate Programming in C and C++ Arrays and Pointers Fall 2017 Stony Brook University Instructor: Shebuti Rayana http://www3.cs.stonybrook.edu/~cse230/ Definition: Arrays A collection of elements

More information

Data Structures and Algorithms(12)

Data Structures and Algorithms(12) Ming Zhang "Data s and Algorithms" Data s and Algorithms(12) Instructor: Ming Zhang Textbook Authors: Ming Zhang, Tengjiao Wang and Haiyan Zhao Higher Education Press, 28.6 (the "Eleventh Five-Year" national

More information

Data Structures and Algorithms(3)

Data Structures and Algorithms(3) Ming Zhang Data Structures and Algorithms Data Structures and Algorithms(3) Instructor: Ming Zhang Textbook Authors: Ming Zhang, Tengjiao Wang and Haiyan Zhao Higher Education Press, 2008.6 (the "Eleventh

More information

Data Structures and Algorithms(4)

Data Structures and Algorithms(4) Ming Zhang Data Structures and Algorithms Data Structures and Algorithms(4) Instructor: Ming Zhang Textook Authors: Ming Zhang, Tengjiao Wang and Haiyan Zhao Higher Education Press, 2008.6 (the "Eleventh

More information

Data Structures and Algorithms(3)

Data Structures and Algorithms(3) Ming Zhang Data Structures and Algorithms Data Structures and Algorithms(3) Instructor: Ming Zhang Textbook Authors: Ming Zhang, Tengjiao Wang and Haiyan Zhao Higher Education Press, 2008.6 (the "Eleventh

More information

Data Structures and Algorithms(3)

Data Structures and Algorithms(3) Ming Zhang Data Structures and Algorithms Data Structures and Algorithms(3) Instructor: Ming Zhang Textbook Authors: Ming Zhang, Tengjiao Wang and aiyan Zhao igher Education Press, 2008.6 (the "Eleventh

More information

UNIT 2 ARRAYS 2.0 INTRODUCTION. Structure. Page Nos.

UNIT 2 ARRAYS 2.0 INTRODUCTION. Structure. Page Nos. UNIT 2 ARRAYS Arrays Structure Page Nos. 2.0 Introduction 23 2.1 Objectives 24 2.2 Arrays and Pointers 24 2.3 Sparse Matrices 25 2.4 Polynomials 28 2.5 Representation of Arrays 30 2.5.1 Row Major Representation

More information

An array is a collection of data that holds fixed number of values of same type. It is also known as a set. An array is a data type.

An array is a collection of data that holds fixed number of values of same type. It is also known as a set. An array is a data type. Data Structures Introduction An array is a collection of data that holds fixed number of values of same type. It is also known as a set. An array is a data type. Representation of a large number of homogeneous

More information

Data Structures and Algorithms(4)

Data Structures and Algorithms(4) Ming Zhang Data Structures and Algorithms Data Structures and Algorithms(4) Instructor: Ming Zhang Textbook Authors: Ming Zhang, Tengjiao Wang and Haiyan Zhao Higher Education Press, 2008.6 (the "Eleventh

More information

ARRAY DATA STRUCTURE

ARRAY DATA STRUCTURE ARRAY DATA STRUCTURE Isha Batra, Divya Raheja Information Technology Dronacharya College Of Engineering, Farukhnagar,Gurgaon Abstract- In computer science, an array data structure or simply an array is

More information

Sparse Matrices. sparse many elements are zero dense few elements are zero

Sparse Matrices. sparse many elements are zero dense few elements are zero Sparse Matrices sparse many elements are zero dense few elements are zero Special Matrices A square matrix has the same number of rows and columns. Some special forms of square matrices are Diagonal: M(i,j)

More information

How to declare an array in C?

How to declare an array in C? Introduction An array is a collection of data that holds fixed number of values of same type. It is also known as a set. An array is a data type. Representation of a large number of homogeneous values.

More information

Maltepe University Computer Engineering Department. BİL 133 Algoritma ve Programlama. Chapter 8: Arrays and pointers

Maltepe University Computer Engineering Department. BİL 133 Algoritma ve Programlama. Chapter 8: Arrays and pointers Maltepe University Computer Engineering Department BİL 133 Algoritma ve Programlama Chapter 8: Arrays and pointers Basics int * ptr1, * ptr2; int a[10]; ptr1 = &a[2]; ptr2 = a; // equivalent to ptr2 =

More information

The Matrix-Tree Theorem and Its Applications to Complete and Complete Bipartite Graphs

The Matrix-Tree Theorem and Its Applications to Complete and Complete Bipartite Graphs The Matrix-Tree Theorem and Its Applications to Complete and Complete Bipartite Graphs Frankie Smith Nebraska Wesleyan University fsmith@nebrwesleyan.edu May 11, 2015 Abstract We will look at how to represent

More information

Lecture 2 Arrays, Searching and Sorting (Arrays, multi-dimensional Arrays)

Lecture 2 Arrays, Searching and Sorting (Arrays, multi-dimensional Arrays) Lecture 2 Arrays, Searching and Sorting (Arrays, multi-dimensional Arrays) In this lecture, you will: Learn about arrays Explore how to declare and manipulate data into arrays Understand the meaning of

More information

Arrays, Vectors, Matrices

Arrays, Vectors, Matrices Arrays, Vectors, Matrices Goal: o Scientific Eng. o Numerical computations o Array are very efficient way of organizing data since accessing array elements requires O(1). Characteristics of an array: o

More information

Lecture 5: Matrices. Dheeraj Kumar Singh 07CS1004 Teacher: Prof. Niloy Ganguly Department of Computer Science and Engineering IIT Kharagpur

Lecture 5: Matrices. Dheeraj Kumar Singh 07CS1004 Teacher: Prof. Niloy Ganguly Department of Computer Science and Engineering IIT Kharagpur Lecture 5: Matrices Dheeraj Kumar Singh 07CS1004 Teacher: Prof. Niloy Ganguly Department of Computer Science and Engineering IIT Kharagpur 29 th July, 2008 Types of Matrices Matrix Addition and Multiplication

More information

ESC101N: Fundamentals of Computing End-sem st semester

ESC101N: Fundamentals of Computing End-sem st semester ESC101N: Fundamentals of Computing End-sem 2010-11 1st semester Instructor: Arnab Bhattacharya 8:00-11:00am, 15th November, 2010 Instructions 1. Please write your name, roll number and section below. 2.

More information

Chapter 01 Arrays Prepared By: Dr. Murad Magableh 2013

Chapter 01 Arrays Prepared By: Dr. Murad Magableh 2013 Chapter 01 Arrays Prepared By: Dr. Murad Magableh 2013 One Dimensional Q1: Write a program that declares two arrays of integers and fills them from the user. Then exchanges their values and display the

More information

Chapter 8 :: Composite Types

Chapter 8 :: Composite Types Chapter 8 :: Composite Types Programming Language Pragmatics, Fourth Edition Michael L. Scott Copyright 2016 Elsevier 1 Chapter08_Composite_Types_4e - Tue November 21, 2017 Records (Structures) and Variants

More information

Maltepe University Computer Engineering Department. BİL 133 Algorithms and Programming. Chapter 8: Arrays

Maltepe University Computer Engineering Department. BİL 133 Algorithms and Programming. Chapter 8: Arrays Maltepe University Computer Engineering Department BİL 133 Algorithms and Programming Chapter 8: Arrays What is an Array? Scalar data types use a single memory cell to store a single value. For many problems

More information

CS 177. Lists and Matrices. Week 8

CS 177. Lists and Matrices. Week 8 CS 177 Lists and Matrices Week 8 1 Announcements Project 2 due on 7 th March, 2015 at 11.59 pm Table of Contents Lists Matrices Traversing a Matrix Construction of Matrices 3 Just a list of numbers 1D

More information

Matrices. Jordi Cortadella Department of Computer Science

Matrices. Jordi Cortadella Department of Computer Science Matrices Jordi Cortadella Department of Computer Science Matrices A matrix can be considered a two-dimensional vector, i.e. a vector of vectors. my_matrix: 3 8 1 0 5 0 6 3 7 2 9 4 // Declaration of a matrix

More information

Multi-Dimensional arrays

Multi-Dimensional arrays Multi-Dimensional arrays An array having more then one dimension is known as multi dimensional arrays. Two dimensional array is also an example of multi dimensional array. One can specify as many dimensions

More information

Data Structures and Algorithms(6)

Data Structures and Algorithms(6) Ming Zhang "ata Structures and Algorithms" ata Structures and Algorithms(6) Instructor: Ming Zhang Textbook Authors: Ming Zhang, Tengjiao Wang and Haiyan Zhao Higher ducation Press, 2008.6 (the "leventh

More information

2.1.5 Miscellaneous Topics

2.1.5 Miscellaneous Topics 2.1.5 Miscellaneous Topics struct definition of a data type union not specify whether a given member has public, private, protected no way to know what the data type is until runtime static class data

More information

2-D Arrays. Of course, to set each grid location to 0, we have to use a loop structure as follows (assume i and j are already defined):

2-D Arrays. Of course, to set each grid location to 0, we have to use a loop structure as follows (assume i and j are already defined): 2-D Arrays We define 2-D arrays similar to 1-D arrays, except that we must specify the size of the second dimension. The following is how we can declare a 5x5 int array: int grid[5][5]; Essentially, this

More information

2.7 Numerical Linear Algebra Software

2.7 Numerical Linear Algebra Software 2.7 Numerical Linear Algebra Software In this section we will discuss three software packages for linear algebra operations: (i) (ii) (iii) Matlab, Basic Linear Algebra Subroutines (BLAS) and LAPACK. There

More information

(Sparse) Linear Solvers

(Sparse) Linear Solvers (Sparse) Linear Solvers Ax = B Why? Many geometry processing applications boil down to: solve one or more linear systems Parameterization Editing Reconstruction Fairing Morphing 2 Don t you just invert

More information

Lecture 2. Two-Dimensional Arrays

Lecture 2. Two-Dimensional Arrays Lecture 2 Two-Dimensional Arrays 1 Lecture Content 1. 2-D Array Basics 2. Basic Operations on 2-D Array 3. Storing Matrices with Special Properties 4. Applications of 2-D Array 2 1. 2-D Array Basics An

More information

Programming Languages

Programming Languages Programming Languages Tevfik Koşar Lecture - XVIII March 23 rd, 2006 1 Roadmap Arrays Pointers Lists Files and I/O 2 1 Arrays Two layout strategies for arrays Contiguous elements Row pointers Row pointers

More information

Numerical Algorithms

Numerical Algorithms Chapter 10 Slide 464 Numerical Algorithms Slide 465 Numerical Algorithms In textbook do: Matrix multiplication Solving a system of linear equations Slide 466 Matrices A Review An n m matrix Column a 0,0

More information

Module 6: Array in C

Module 6: Array in C 1 Table of Content 1. Introduction 2. Basics of array 3. Types of Array 4. Declaring Arrays 5. Initializing an array 6. Processing an array 7. Summary Learning objectives 1. To understand the concept of

More information

CS 230 Programming Languages

CS 230 Programming Languages CS 230 Programming Languages 11 / 20 / 2015 Instructor: Michael Eckmann Questions/comments? Chapter 6 Arrays Pointers Today s Topics We all know what arrays are. Design issues Legal types for subscripts

More information

Sparse Linear Systems

Sparse Linear Systems 1 Sparse Linear Systems Rob H. Bisseling Mathematical Institute, Utrecht University Course Introduction Scientific Computing February 22, 2018 2 Outline Iterative solution methods 3 A perfect bipartite

More information

Answers to Homework 12: Systems of Linear Equations

Answers to Homework 12: Systems of Linear Equations Math 128A Spring 2002 Handout # 29 Sergey Fomel May 22, 2002 Answers to Homework 12: Systems of Linear Equations 1. (a) A vector norm x has the following properties i. x 0 for all x R n ; x = 0 only if

More information

Cache Memories. Topics. Next time. Generic cache memory organization Direct mapped caches Set associative caches Impact of caches on performance

Cache Memories. Topics. Next time. Generic cache memory organization Direct mapped caches Set associative caches Impact of caches on performance Cache Memories Topics Generic cache memory organization Direct mapped caches Set associative caches Impact of caches on performance Next time Dynamic memory allocation and memory bugs Fabián E. Bustamante,

More information

Linear Loop Transformations for Locality Enhancement

Linear Loop Transformations for Locality Enhancement Linear Loop Transformations for Locality Enhancement 1 Story so far Cache performance can be improved by tiling and permutation Permutation of perfectly nested loop can be modeled as a linear transformation

More information

Module 16: Data Flow Analysis in Presence of Procedure Calls Lecture 32: Iteration. The Lecture Contains: Iteration Space.

Module 16: Data Flow Analysis in Presence of Procedure Calls Lecture 32: Iteration. The Lecture Contains: Iteration Space. The Lecture Contains: Iteration Space Iteration Vector Normalized Iteration Vector Dependence Distance Direction Vector Loop Carried Dependence Relations Dependence Level Iteration Vector - Triangular

More information

Numerical Linear Algebra

Numerical Linear Algebra Numerical Linear Algebra Probably the simplest kind of problem. Occurs in many contexts, often as part of larger problem. Symbolic manipulation packages can do linear algebra "analytically" (e.g. Mathematica,

More information

Graphs. The ultimate data structure. graphs 1

Graphs. The ultimate data structure. graphs 1 Graphs The ultimate data structure graphs 1 Definition of graph Non-linear data structure consisting of nodes & links between them (like trees in this sense) Unlike trees, graph nodes may be completely

More information

COSC2430: Programming and Data Structures Sparse Matrix Addition 2 2: Non-recursive and recursive; arrays and linked lists

COSC2430: Programming and Data Structures Sparse Matrix Addition 2 2: Non-recursive and recursive; arrays and linked lists COSC2430: Programming and Data Structures Sparse Matrix Addition 2 2: Non-recursive and recursive; arrays and linked lists 1 Introduction You will create a C++ program to add two sparse matrices. Sparse

More information

Dense Matrix Algorithms

Dense Matrix Algorithms Dense Matrix Algorithms Ananth Grama, Anshul Gupta, George Karypis, and Vipin Kumar To accompany the text Introduction to Parallel Computing, Addison Wesley, 2003. Topic Overview Matrix-Vector Multiplication

More information

Chapter 8 Arrays and Strings. Objectives. Objectives (cont d.) Introduction. Arrays 12/23/2016. In this chapter, you will:

Chapter 8 Arrays and Strings. Objectives. Objectives (cont d.) Introduction. Arrays 12/23/2016. In this chapter, you will: Chapter 8 Arrays and Strings Objectives In this chapter, you will: Learn about arrays Declare and manipulate data into arrays Learn about array index out of bounds Learn about the restrictions on array

More information

Graphs. directed and undirected graphs weighted graphs adjacency matrices. abstract data type adjacency list adjacency matrix

Graphs. directed and undirected graphs weighted graphs adjacency matrices. abstract data type adjacency list adjacency matrix Graphs 1 Graphs directed and undirected graphs weighted graphs adjacency matrices 2 Graph Representations abstract data type adjacency list adjacency matrix 3 Graph Implementations adjacency matrix adjacency

More information

COMPUTER OPTIMIZATION

COMPUTER OPTIMIZATION COMPUTER OPTIMIZATION Storage Optimization: Since Normal Matrix is a symmetric matrix, store only half of it in a vector matrix and develop a indexing scheme to map the upper or lower half to the vector.

More information

Contents. F10: Parallel Sparse Matrix Computations. Parallel algorithms for sparse systems Ax = b. Discretized domain a metal sheet

Contents. F10: Parallel Sparse Matrix Computations. Parallel algorithms for sparse systems Ax = b. Discretized domain a metal sheet Contents 2 F10: Parallel Sparse Matrix Computations Figures mainly from Kumar et. al. Introduction to Parallel Computing, 1st ed Chap. 11 Bo Kågström et al (RG, EE, MR) 2011-05-10 Sparse matrices and storage

More information

Study of Butterfly Patterns of Matrix in Interconnection Network

Study of Butterfly Patterns of Matrix in Interconnection Network International Journal of Scientific & Engineering Research, Volume 7, Issue, December-6 3 ISSN 9-558 Study of Butterfly Patterns of Matrix in Interconnection Network Rakesh Kumar Katare Professor, Department

More information

An Introduction to Graph Theory

An Introduction to Graph Theory An Introduction to Graph Theory CIS008-2 Logic and Foundations of Mathematics David Goodwin david.goodwin@perisic.com 12:00, Friday 17 th February 2012 Outline 1 Graphs 2 Paths and cycles 3 Graphs and

More information

Computer Science & Engineering 150A Problem Solving Using Computers

Computer Science & Engineering 150A Problem Solving Using Computers Computer Science & Engineering 150A Problem Solving Using Computers Lecture 06 - Stephen Scott Adapted from Christopher M. Bourke 1 / 30 Fall 2009 Chapter 8 8.1 Declaring and 8.2 Array Subscripts 8.3 Using

More information

Chapter 8 Dense Matrix Algorithms

Chapter 8 Dense Matrix Algorithms Chapter 8 Dense Matrix Algorithms (Selected slides & additional slides) A. Grama, A. Gupta, G. Karypis, and V. Kumar To accompany the text Introduction to arallel Computing, Addison Wesley, 23. Topic Overview

More information

Lecture 9 - Matrix Multiplication Equivalences and Spectral Graph Theory 1

Lecture 9 - Matrix Multiplication Equivalences and Spectral Graph Theory 1 CME 305: Discrete Mathematics and Algorithms Instructor: Professor Aaron Sidford (sidford@stanfordedu) February 6, 2018 Lecture 9 - Matrix Multiplication Equivalences and Spectral Graph Theory 1 In the

More information

Algebraic Graph Theory- Adjacency Matrix and Spectrum

Algebraic Graph Theory- Adjacency Matrix and Spectrum Algebraic Graph Theory- Adjacency Matrix and Spectrum Michael Levet December 24, 2013 Introduction This tutorial will introduce the adjacency matrix, as well as spectral graph theory. For those familiar

More information

0_PreCNotes17 18.notebook May 16, Chapter 12

0_PreCNotes17 18.notebook May 16, Chapter 12 Chapter 12 Notes BASIC MATRIX OPERATIONS Matrix (plural: Matrices) an n x m array of elements element a ij Example 1 a 21 = a 13 = Multiply Matrix by a Scalar Distribute scalar to all elements Addition

More information

Chapter 4. Matrix and Vector Operations

Chapter 4. Matrix and Vector Operations 1 Scope of the Chapter Chapter 4 This chapter provides procedures for matrix and vector operations. This chapter (and Chapters 5 and 6) can handle general matrices, matrices with special structure and

More information

Methods of solving sparse linear systems. Soldatenko Oleg SPbSU, Department of Computational Physics

Methods of solving sparse linear systems. Soldatenko Oleg SPbSU, Department of Computational Physics Methods of solving sparse linear systems. Soldatenko Oleg SPbSU, Department of Computational Physics Outline Introduction Sherman-Morrison formula Woodbury formula Indexed storage of sparse matrices Types

More information

Classification s of Data Structures

Classification s of Data Structures Linear Data Structures using Sequential organization Classification s of Data Structures Types of Data Structures Arrays Declaration of arrays type arrayname [ arraysize ]; Ex-double balance[10]; Arrays

More information

ECEN 615 Methods of Electric Power Systems Analysis Lecture 11: Sparse Systems

ECEN 615 Methods of Electric Power Systems Analysis Lecture 11: Sparse Systems ECEN 615 Methods of Electric Power Systems Analysis Lecture 11: Sparse Systems Prof. Tom Overbye Dept. of Electrical and Computer Engineering Texas A&M University overbye@tamu.edu Announcements Homework

More information

NAG Fortran Library Routine Document F04BJF.1

NAG Fortran Library Routine Document F04BJF.1 F04 Simultaneous Linear Equations NAG Fortran Library Routine Document Note: before using this routine, please read the Users Note for your implementation to check the interpretation of bold italicised

More information

M4.1-R3: PROGRAMMING AND PROBLEM SOLVING THROUGH C LANGUAGE

M4.1-R3: PROGRAMMING AND PROBLEM SOLVING THROUGH C LANGUAGE M4.1-R3: PROGRAMMING AND PROBLEM SOLVING THROUGH C LANGUAGE NOTE: 1. There are TWO PARTS in this Module/Paper. PART ONE contains FOUR questions and PART TWO contains FIVE questions. 2. PART ONE is to be

More information

Two Dimensional Arrays

Two Dimensional Arrays 2-d Arrays 1 Two Dimensional Arrays We have seen that an array variable can store a list of values Many applications require us to store a table of values Student 1 Student 2 Student 3 Student 4 Subject

More information

Hypercubes. (Chapter Nine)

Hypercubes. (Chapter Nine) Hypercubes (Chapter Nine) Mesh Shortcomings: Due to its simplicity and regular structure, the mesh is attractive, both theoretically and practically. A problem with the mesh is that movement of data is

More information

Computer Programming. C Array is a collection of data belongings to the same data type. data_type array_name[array_size];

Computer Programming. C Array is a collection of data belongings to the same data type. data_type array_name[array_size]; Arrays An array is a collection of two or more adjacent memory cells, called array elements. Array is derived data type that is used to represent collection of data items. C Array is a collection of data

More information

NAG Fortran Library Routine Document F04CJF.1

NAG Fortran Library Routine Document F04CJF.1 F04 Simultaneous Linear Equations NAG Fortran Library Routine Document Note: before using this routine, please read the Users Note for your implementation to check the interpretation of bold italicised

More information

Iosif Ignat Laboratory Guide 6. Modular programming MODULAR PROGRAMMING

Iosif Ignat Laboratory Guide 6. Modular programming MODULAR PROGRAMMING MODULAR PROGRAMMING 1. Overview The learning objectives of this lab session is to: Understand the concepts of modules, modular programming, and variable scope. Learn how to develop applications using modules

More information

Computer Graphics. Coordinate Systems and Change of Frames. Based on slides by Dianna Xu, Bryn Mawr College

Computer Graphics. Coordinate Systems and Change of Frames. Based on slides by Dianna Xu, Bryn Mawr College Computer Graphics Coordinate Systems and Change of Frames Based on slides by Dianna Xu, Bryn Mawr College Linear Independence A set of vectors independent if is linearly If a set of vectors is linearly

More information

DATA STRUCTURE : A MCQ QUESTION SET Code : RBMCQ0305

DATA STRUCTURE : A MCQ QUESTION SET Code : RBMCQ0305 Q.1 If h is any hashing function and is used to hash n keys in to a table of size m, where n

More information

ENGR 253 LAB #1 - MATLAB Introduction

ENGR 253 LAB #1 - MATLAB Introduction ENGR 253 LAB #1 - MATLAB Introduction Objective Understanding and hands on experience with MATLAB with focus on Signal Processing. Resources Signals & Systems textbook by Oppenheim and Willsky Windows

More information

Computer Programming

Computer Programming Computer Programming Dr. Deepak B Phatak Dr. Supratik Chakraborty Department of Computer Science and Engineering Session: Recap of Arrays and Simultaneous Equations (S31 S35) Dr. Deepak B. Phatak & Dr.

More information

Average D-distance Between Edges of a Graph

Average D-distance Between Edges of a Graph Indian Journal of Science and Technology, Vol 8(), 5 56, January 05 ISSN (Print) : 0974-6846 ISSN (Online) : 0974-5645 OI : 07485/ijst/05/v8i/58066 Average -distance Between Edges of a Graph Reddy Babu

More information

Bharati Vidyapeeth s College Of Engineering for Women Pune-43 Department E & TC. SE- Unit Test I Subject-DS

Bharati Vidyapeeth s College Of Engineering for Women Pune-43 Department E & TC. SE- Unit Test I Subject-DS Bharati Vidyapeeth s College Of Engineering for Women Pune-43 SE- Unit Test I Subject-DS Date: 25/02/2010 Q-1 a) What is sorting? State different types of sorting and write a function in C to implement

More information

Fundamental of Programming (C)

Fundamental of Programming (C) Borrowed from lecturer notes by Omid Jafarinezhad Fundamental of Programming (C) Lecturer: Vahid Khodabakhshi Lecture 8 Array typical problems, Search, Sorting Department of Computer Engineering Outline

More information

A GENERALIZED GPS ALGORITHM FOR REDUCING THE BANDWIDTH AND PROFILE OF A SPARSE MATRIX

A GENERALIZED GPS ALGORITHM FOR REDUCING THE BANDWIDTH AND PROFILE OF A SPARSE MATRIX Progress In Electromagnetics Research, PIER 90, 121 136, 2009 A GENERALIZED GPS ALGORITHM FOR REDUCING THE BANDWIDTH AND PROFILE OF A SPARSE MATRIX Q. Wang, Y. C. Guo, and X. W. Shi National Key Laboratory

More information

BLAS and LAPACK + Data Formats for Sparse Matrices. Part of the lecture Wissenschaftliches Rechnen. Hilmar Wobker

BLAS and LAPACK + Data Formats for Sparse Matrices. Part of the lecture Wissenschaftliches Rechnen. Hilmar Wobker BLAS and LAPACK + Data Formats for Sparse Matrices Part of the lecture Wissenschaftliches Rechnen Hilmar Wobker Institute of Applied Mathematics and Numerics, TU Dortmund email: hilmar.wobker@math.tu-dortmund.de

More information

Graphs. The ultimate data structure. graphs 1

Graphs. The ultimate data structure. graphs 1 Graphs The ultimate data structure graphs 1 Definition of graph Non-linear data structure consisting of nodes & links between them (like trees in this sense) Unlike trees, graph nodes may be completely

More information

NAG Fortran Library Routine Document G05LZF.1

NAG Fortran Library Routine Document G05LZF.1 NAG Fortran Library Routine Document Note: before using this routine, please read the Users Note for your implementation to check the interpretation of bold italicised terms and other implementation-dependent

More information

Social Network Analysis

Social Network Analysis Social Network Analysis Mathematics of Networks Manar Mohaisen Department of EEC Engineering Adjacency matrix Network types Edge list Adjacency list Graph representation 2 Adjacency matrix Adjacency matrix

More information

Cribbage Count In Cribbage scoring, there are several ways of accumulating points in a pile of playing cards. Among these are

Cribbage Count In Cribbage scoring, there are several ways of accumulating points in a pile of playing cards. Among these are A Cribbage Count In Cribbage scoring, there are several ways of accumulating points in a pile of playing cards. Among these are s. Any combination of cards whose values sum to scores 2 points. (Aces have

More information

Programming Problem for the 1999 Comprehensive Exam

Programming Problem for the 1999 Comprehensive Exam Programming Problem for the 1999 Comprehensive Exam Out: Monday 1/25/99 at 9:00 am Due: Friday 1/29/99 at 5:00 pm Department of Computer Science Brown University Providence, RI 02912 1.0 The Task This

More information

Course Introduction / Review of Fundamentals of Graph Theory

Course Introduction / Review of Fundamentals of Graph Theory Course Introduction / Review of Fundamentals of Graph Theory Hiroki Sayama sayama@binghamton.edu Rise of Network Science (From Barabasi 2010) 2 Network models Many discrete parts involved Classic mean-field

More information

Graph Matrices and Applications: Motivational Overview The Problem with Pictorial Graphs Graphs were introduced as an abstraction of software structure. There are many other kinds of graphs that are useful

More information

AVERAGE D-DISTANCE BETWEEN VERTICES OF A GRAPH

AVERAGE D-DISTANCE BETWEEN VERTICES OF A GRAPH italian journal of pure and applied mathematics n. 33 2014 (293 298) 293 AVERAGE D-DISTANCE BETWEEN VERTICES OF A GRAPH D. Reddy Babu Department of Mathematics Koneru Lakshmaiah Education Foundation (K.L.

More information

Math 355: Linear Algebra: Midterm 1 Colin Carroll June 25, 2011

Math 355: Linear Algebra: Midterm 1 Colin Carroll June 25, 2011 Rice University, Summer 20 Math 355: Linear Algebra: Midterm Colin Carroll June 25, 20 I have adhered to the Rice honor code in completing this test. Signature: Name: Date: Time: Please read the following

More information

SE-292 High Performance Computing. Memory Hierarchy. R. Govindarajan Memory Hierarchy

SE-292 High Performance Computing. Memory Hierarchy. R. Govindarajan Memory Hierarchy SE-292 High Performance Computing Memory Hierarchy R. Govindarajan govind@serc Memory Hierarchy 2 1 Memory Organization Memory hierarchy CPU registers few in number (typically 16/32/128) subcycle access

More information

Sparse matrices, graphs, and tree elimination

Sparse matrices, graphs, and tree elimination Logistics Week 6: Friday, Oct 2 1. I will be out of town next Tuesday, October 6, and so will not have office hours on that day. I will be around on Monday, except during the SCAN seminar (1:25-2:15);

More information

Computer Programming: C++

Computer Programming: C++ The Islamic University of Gaza Engineering Faculty Department of Computer Engineering Fall 2017 ECOM 2003 Muath i.alnabris Computer Programming: C++ Experiment #7 Arrays Part II Passing Array to a Function

More information

Parallelizing The Matrix Multiplication. 6/10/2013 LONI Parallel Programming Workshop

Parallelizing The Matrix Multiplication. 6/10/2013 LONI Parallel Programming Workshop Parallelizing The Matrix Multiplication 6/10/2013 LONI Parallel Programming Workshop 2013 1 Serial version 6/10/2013 LONI Parallel Programming Workshop 2013 2 X = A md x B dn = C mn d c i,j = a i,k b k,j

More information

Null space basis: mxz. zxz I

Null space basis: mxz. zxz I Loop Transformations Linear Locality Enhancement for ache performance can be improved by tiling and permutation Permutation of perfectly nested loop can be modeled as a matrix of the loop nest. dependence

More information

Lecture 57 Dynamic Programming. (Refer Slide Time: 00:31)

Lecture 57 Dynamic Programming. (Refer Slide Time: 00:31) Programming, Data Structures and Algorithms Prof. N.S. Narayanaswamy Department of Computer Science and Engineering Indian Institution Technology, Madras Lecture 57 Dynamic Programming (Refer Slide Time:

More information

Multidimensional Arrays & Graphs. CMSC 420: Lecture 3

Multidimensional Arrays & Graphs. CMSC 420: Lecture 3 Multidimensional Arrays & Graphs CMSC 420: Lecture 3 Mini-Review Abstract Data Types: List Stack Queue Deque Dictionary Set Implementations: Linked Lists Circularly linked lists Doubly linked lists XOR

More information

COSC2430: Programming and Data Structures Sparse Matrix Multiplication: Search and Sorting Algorithms

COSC2430: Programming and Data Structures Sparse Matrix Multiplication: Search and Sorting Algorithms COSC2430: Programming and Data Structures Sparse Matrix Multiplication: Search and Sorting Algorithms 1 Introduction You will create a C++ program to multiply two sparse matrices as efficiently as possible

More information