Monday, October 7, 2024
HomeC ProgrammingMultiplying Matrixes | C For Dummies Weblog

Multiplying Matrixes | C For Dummies Weblog


Problem: ★ ★ ★ ☆

The duty for final month’s Train was to explain complicated information — a matrix. For this month’s Train, your job is to multiply these matrixes.

Matrix multiplication has sensible functions that I’m not going to get into right here. If you wish to know extra, I can suggest this video from Andy Math on YouTube. (He’s actually value a comply with.)

Successfully, matrix multiplication entails manipulating rows and columns between two matrixes. The ensuing matrix relies upon the size of the 2 unique matrixes, which is smart while you perceive why these manipulations are made. Once more, watch the video for a sensible instance.

Take into account the 2 matrixes proven in Determine 1, together with their product.

Determine 1. Matrix multiplication.

To calculate the outcomes you utilize row and column positions throughout the 2 matrixes. From the determine, the primary worth calculated is 220, set within the first column, first row. To acquire this outcome you manipulate values from the primary row in Matrix A and the primary column in Matrix B, as illustrated in Determine 2.

Determine 2. The primary row, first column within the answer relies on the primary row of Matrix A and the primary column of Matrix B.

For the outcome within the first row, second column, you carry out the identical motion, however with the second column in Matrix B, which is illustrated in Determine 3.

Determine 3. The primary row, second column within the answer relies on the primary row of Matrix A and the second column of Matrix B.

The sample repeats, marching down the rows of Matrix A and throughout the columns of Matrix B primarily based upon the row/column place within the ensuing matrix.

Your burden for this month’s Train is to jot down a C program that performs matrix multiplcation to generate the outcomes proven within the Figures. Use the Matrix A and B examples. You can even base your code upon the answer offered for final month’s Train.

Right here is output from my answer:

Matrix A
  10   20   30 
  11   21   31 
  12   22   32 
  13   23   33 
Matrix B
   1    2 
   3    4 
   5    6 
Matrix A * Matrix B
 220  280 
 229  292 
 238  304 
 247  316 

Please do this Train by yourself earlier than you peek at my answer, which I’ll present in per week.

RELATED ARTICLES

LEAVE A REPLY

Please enter your comment!
Please enter your name here

Most Popular

Recent Comments