DSA Lab 5 task
DSA Lab 5 task
Lab Objective:
Implementation of the algorithm for matrix multiplication using two-dimensional arrays.
Abstract:
This lab focuses on implementing matrix multiplication using two-dimensional arrays. Matrix
multiplication is a fundamental operation in linear algebra with applications in graphics, data science,
machine learning, and scientific computing. The lab introduces both standard multiplication for square
matrices (n × n) and generalized multiplication where the number of columns in matrix A equals the
number of rows in matrix B (cA = rB). This task helps students understand data storage in 2D arrays
and how to manipulate indices to perform calculations over rows and columns.
Lab Tasks:
b) Considering A is of order rAxcA, and B is of order rBxcB, revise the above algorithm and
implement it in
C++. cA=rB, but rA, rB and cB can be different quantities.
Data Structures and Algorithm
Conclusion:
This lab helped us understand and implement the logic of matrix multiplication, starting from square
matrices and extending to general matrices of compatible sizes. We also explored the rule that the
number of columns in the first matrix must equal the number of rows in the second. These concepts
are foundational in areas such as computer graphics, scientific computation, and neural networks. The
hands-on practice enhanced our ability to work with multi-dimensional arrays and nested loops.