# Linear Algebra Matrix Addition Algorithm

iwan89

## Homework Statement

let L and M be two symmetric nxn matrices. develop an algorithm to compute C=L+M, taking advantage of symmetry for each matrix. Your algorithm should overite B and C. What is the flop-count?

## Homework Equations

How to minimize the number of flop count? I want to make the algorithm as efficient as possible..
I hope you can provide me with Pseudocodes as well

## The Attempt at a Solution

The old algorithm produced a lot of flop count.

Input Two matrices a and b
Output Output matrix c containing elements after addition of a and b
complexity O(n^2)

for i =1 to rows [a]
for j =1 to columns[a]
Input a[i,j];
Input b[i,j];
C[i, j] = A[i, j] + B[i, j];
Display C[i,j];

Algorithm Description

To add two matrixes sufficient and necessary condition is "dimensions of matrix A = dimensions of matrix B".
Loop for number of rows in matrix A.
Loop for number of columns in matrix A.
Input A[i,j] and Input B[i,j] then add A[i,j] and B[i,j]
store and display this value as C[i,j];