let A and B be two symmetric matrices of the same order. Develop an algorithm to compute C=A+B,taking advantage of symmetry for each matrix.Your algorithm should overwrite B with C. What is the flop count?
At vero eos et accusamus et iusto odio dignissimos ducimus qui blanditiis praesentium voluptatum deleniti atque corrupti quos dolores et quas molestias excepturi sint occaecati cupiditate non provident, similique sunt in culpa qui officia deserunt mollitia animi, id est laborum et dolorum fuga.
Et harum quidem rerum facilis est et expedita distinctio. Nam libero tempore, cum soluta nobis est eligendi optio cumque nihil impedit quo minus id quod maxime placeat facere possimus, omnis voluptas assumenda est, omnis dolor repellendus.
Itaque earum rerum hic tenetur a sapiente delectus, ut aut reiciendis voluptatibus maiores alias consequatur aut perferendis doloribus asperiores repellat.
let A and B be two symmetric matrices of the same order. Develop an algorithm to compute C=A+B,taking advantage of symmetry for each matrix.Your algorithm should overwrite B with C. What is the flop count?
At vero eos et accusamus et iusto odio dignissimos ducimus qui blanditiis praesentium voluptatum deleniti atque corrupti quos dolores et quas molestias excepturi sint occaecati cupiditate non provident, similique sunt in culpa qui officia deserunt mollitia animi, id est laborum et dolorum fuga.
Et harum quidem rerum facilis est et expedita distinctio. Nam libero tempore, cum soluta nobis est eligendi optio cumque nihil impedit quo minus id quod maxime placeat facere possimus, omnis voluptas assumenda est, omnis dolor repellendus.
Itaque earum rerum hic tenetur a sapiente delectus, ut aut reiciendis voluptatibus maiores alias consequatur aut perferendis doloribus asperiores repellat.
okay..it is correct if i do like this :
Input: Dim n for \[a _{ij}\], j>=i and \[b _{ij}\],j>=i where i,j=1,...,n
Output : B=C
Step 1 : for j=1,...,n
for i=1,...,j
\[b _{ij}^{new}=a _{ij}+b _{ij}\]
I'm thinking...
Does your algorithm use the fact that A and B are symmetrical?
We should be able to do something like
Step 1 : for j=1,...,n for i=1,...,j
if i does not equal j, then output cij=cji=aij+bij
if i equals j, then cij=aij+bij
What do you think of this part?
Do you think you can use it?
Just trying to help.
actually that is what I got. You want to know how I figured it out...
Ok we want to basically know how many operations we did.
And I had to look up the definition of flops.
So we want to count the number of operations we did.
I counted my diagonal elements which were n.
Then for the first row we had (n-1) entries left to calculate
second row we had (n-2) entries left to calculate
third row we had (n-3) entries left to calculate
.......
nth row we had (n-n) entries left to calculate
So we had n diagonal entries + (n-1)+(n-2)+...+(n-n) other entries to calculate.
So we have n+sum(n-i, i=1..n)
Do you understand how I got this so far?
We can simplify this to what your friend got.
I counted each entry we had to calculate.
I know the diagonal entries will be repeated once but all other entries will be counted twice.
So you know if we had a 3 by 3 symmetric matrix.
You find the sum of the operations we did by counting the diagonal entries and the entries above the diagonal.
So for a 3 b3 symmetric matrix, we have 3 diagonal entries then the number of entries above that diagonal is (3-1)+(3-2)+(3-3)
(3-1)=2 that is how many are above the diagonal in the first row
(3-2)=1 that is how many are above the diagonal in the second row
(3-3)=0 that is how many are above the diagonal in the 3rd row
Now I ignored everything below the diagonal because we already performed those operations above the diagonal. We were suppose to use the fact that the matrix was symmetric after all.
Yeah. I will have to do some review on that part.
I'm going to class soon. I can't promise I will look at it tonight but I think @zarkon might know matlab. I could be wrong. No promises. lol.
hehe. It's okay. You helped me a lot today. Actually, i'm going to sleep already because in Malaysia, right now is midnight. Thank you so much for your helped. May God bless you. =)