Multi-Dimensional Arrays

Slides:



Advertisements
Similar presentations
Section 13-4: Matrix Multiplication
Advertisements

Maths for Computer Graphics
Multiplying matrices An animated example. (3 x 3)x (3 x 2)= (3 x 2) These must be the same, otherwise multiplication cannot be done Is multiplication.
4.2 Operations with Matrices Scalar multiplication.
Row 1 Row 2 Row 3 Row m Column 1Column 2Column 3 Column 4.
Matrix Arithmetic. A matrix M is an array of cell entries (m row,column ) and it must have rectangular dimensions (Rows x Columns). Example: 3x x.
Two dimensional arrays in Java Computer Science 3 Gerb Objective: Use matrices in Java.
CHAPTER: 12. Array is a collection of variables of the same data type that are referenced by a common name. An Array of 10 Elements of type double.
Warm Up. Multiplying Matrices 6.2 part 2 **Multiply rows times columns. **You can only multiply if the number of columns in the 1 st matrix is equal.
AIM: How do we perform basic matrix operations? DO NOW:  Describe the steps for solving a system of Inequalities  How do you know which region is shaded?
4.3 Matrix Multiplication 1.Multiplying a Matrix by a Scalar 2.Multiplying Matrices.
Slide Copyright © 2009 Pearson Education, Inc. 7.3 Matrices.
3.6 Solving Systems Using Matrices You can use a matrix to represent and solve a system of equations without writing the variables. A matrix is a rectangular.
Multiplying Matrices Algebra 2—Section 3.6. Recall: Scalar Multiplication - each element in a matrix is multiplied by a constant. Multiplying one matrix.
Warm Up Perform the indicated operations. If the matrix does not exist, write impossible
EGR 115 Introduction to Computing for Engineers MATLAB Basics 1: Variables & Arrays Wednesday 03 Sept 2014 EGR 115 Introduction to Computing for Engineers.
EXAMPLE 1 Add and subtract matrices
1 Arrays of Arrays Quick review … arrays Arrays of arrays ≡ multidimensional array Example: times table Representation in memory Ragged arrays Example:
3.6 Multiplying Matrices Homework 3-17odd and odd.
MULTI-DIMENSIONAL ARRAYS 1. Multi-dimensional Arrays The types of arrays discussed so far are all linear arrays. That is, they all dealt with a single.
Notes Over 4.2 Finding the Product of Two Matrices Find the product. If it is not defined, state the reason. To multiply matrices, the number of columns.
Do Now: Perform the indicated operation. 1.). Algebra II Elements 11.1: Matrix Operations HW: HW: p.590 (16-36 even, 37, 44, 46)
Precalculus Section 14.1 Add and subtract matrices Often a set of data is arranged in a table form A matrix is a rectangular.
§9-3 Matrix Operations. Matrix Notation The matrix has 2 rows and 3 columns.
13.4 Product of Two Matrices
Lesson 43: Working with Matrices: Multiplication
12-1 Organizing Data Using Matrices
Multiplying Matrices.
Christmas Packets are due on Friday!!!
Linear Algebra review (optional)
Lecture 8: 2D Arrays and Nested Loops
Two-Dimensional Arrays
multi-dimensional arrays
Unit 1: Matrices Day 1 Aug. 7th, 2012.
Matrix Operations.
EGR 115 Introduction to Computing for Engineers
MULTI-DIMENSIONAL ARRAY
Introduction To Matrices
Matrix Operations Monday, August 06, 2018.
Matrix Operations.
Multiplying Matrices Algebra 2—Section 3.6.
Matrix Operations SpringSemester 2017.
Warm Up Use scalar multiplication to evaluate the following:
Multiplying Matrices.
WarmUp 2-3 on your calculator or on paper..
7.3 Matrices.
AGENDA DG minutes.
25. Basic matrix operations
Multiplying Matrices.
Lab 4: C Array Review: Array Lab assignments.
Multidimensional Arrays
Matrix Multiplication
MATRICES MATRIX OPERATIONS.
2.2 Introduction to Matrices
Multidimensional array
Multiplying Matrices.
Introduction to Matlab
3.6 Multiply Matrices.
Linear Algebra review (optional)
1.8 Matrices.
Matrix Operations SpringSemester 2017.
Matrix A matrix is a rectangular arrangement of numbers in rows and columns Each number in a matrix is called an Element. The dimensions of a matrix are.
AGENDA DG minutes.
Lesson 2: Multiplying Matrices
1.8 Matrices.
Multiplying Matrices.
Arrays and Matrices Prof. Abdul Hameed.
Multiplying Matrices.
Introduction to Matrices
Multiplying Matrices.
Presentation transcript:

Multi-Dimensional Arrays www.hndit.com Multi-Dimensional Arrays

Multi-dimensional Arrays www.hndit.com Multi-dimensional Arrays The types of arrays discussed so far are all linear arrays. That is, they all dealt with a single dimension. But think about a situation where we want to store elements of a 3x4 matrix. The C language allows to have multi- dimensional arrays for this kind of situations. 

2 Dimensional Arrays - 2D Also called as 2D arrays. www.hndit.com 2 Dimensional Arrays - 2D Column Index No. Also called as 2D arrays. Take the example of the 3x4 matrix. To store the elements of this we can declare a 2D array as follows: int matrix[3][4]; 0 1 2 3 1 2 2 6 9 4 5 12 10 16 7 3 18 Raw Index No. Raw Column

Assigning Values to a 2D Array Elements www.hndit.com Example 1: You can refer by row column indices int matrix[3][4]; matrix[0][0] = 2; matrix[0][1] = 6; Example 2: You can initialize row wise int matrix[3][4] = { {2,6,9,4}, {5,12,10,16}, {7,3,3,18} };

Array Exercise www.hndit.com Declare a 2D array and store the values shown in the figure. Read the elements from the user After storing all the values, display the content of the matrix. Column Index No. 0 1 2 3 1 2 2 6 9 4 5 12 10 16 7 3 18 Raw Index No.

www.hndit.com Homework Write a program to read values for a 2x3 matrix from a user and multiply with a scalar value and display the result. The scalar value also you must read from the user. Write a program to multiply two matrices of integers. 1st matrix is 3x2 and the 2nd matrix is 2x4. Display the result. Note : No need to read the matrices values from the user

Thank You ! www.hndit.com