Question: IN MATLAB Part 1: Recursive Mat Mul Your task is to create three functions for multiplying two nx nmatrices, having the following forms: 1. function
IN MATLAB

Part 1: Recursive Mat Mul Your task is to create three functions for multiplying two nx nmatrices, having the following forms: 1. function C- defaultMatMul(A,B) 2. function C-myMatMul(A,B) 3. function C- recMatMul(A, B) The first just uses CA*B, using Matlab's default matrix multiplication algorithm The second uses three nested loops and the formula 10 and therefore uses only scalar multiplication as a primitive The third is a recursive algorithm, with base case when n-1 (just c-a . b), and uses the recursion 21 The function will therefore involve calling eight recursive calls, each on a problem half the size of the original: C11 recMatMul (A11,B11) + recMatMul(A12, B21) . C22 = recMatMul (A21 , B12) + recMatMul (A22, B22) You may assume for the purposes of your recursive algorithm that n is a positive integer of the form 2". Thus you can divide the matrices neatly in half at every step Part 2: Plotting Use code along the lines of tic; CODE HERE; timeElapsed toc (check the documen- tation on tic and toc) to record the time required for matrix multiplication by each algo- rithm. Use A randn(n,n) ; B randn(n,n) to make random n n matrices and time how long it takes each of your algorithms to compute C-AB for n 32, 64,128,... , 4096 (or 8192, if your computer can handle it). Make a plot with one line for each method. If you want to get clearer results you may optionally run each trial multiple times and report the average
Step by Step Solution
There are 3 Steps involved in it
Get step-by-step solutions from verified subject matter experts
