Download as docx, pdf, or txt
Download as docx, pdf, or txt
You are on page 1of 1

773100-1.

2-1P AID: 8522 | 25/01/2023

The objective is to develop an algorithm to overwrite with .

Here is an algorithm that overwrites with , where :

This algorithm computes the matrix multiplication by updating each element of


one at a time. The outermost loop iterates over the rows of , the middle loop sets the
element to zero, and the innermost loop iterates over the elements of A for that
row and column. The product of the corresponding elements of are accumulated in the
current element of .

The algorithm does not require any extra storage.

For the case when is upper triangular, there is a property that the lower triangular part
of is zero. So, the requirement is to iterate over the upper triangular part of . Thus,

This algorithm also requires time and no extra storage is required.

Hence, the required algorithm is given above. In both cases, the algorithm does not
require any extra space.

You might also like