math question

This is a discussion on math question within the A Brief History of Cprogramming.com forums, part of the Community Boards category; I am researching loop fusion at my university, but i just started and am confused about the notation for his ...

  1. #1
    Registered User linuxdude's Avatar
    Join Date
    Mar 2003
    Location
    Louisiana
    Posts
    926

    Question math question

    I am researching loop fusion at my university, but i just started and am confused about the notation for his summations.
    Code:
                10
    w[k] = sum (a[i,j] * b[j,k,l] * c[k,l]
                i,j,l
    the i,j,l are what is underneath the sum and their upper bounds are each 10

    shouldn't it be
    Code:
    for(i=0;i<10;i++){
         for(j=0;j<10;j++){
             for(l=0;l<10;l++){
                 w[k] = w[k] + a[i,j] * b[j,k,l] * c[k,l]
             }
         }
    }
    but he does these steps
    Code:
    tmp[j] = sum(a[i,j])
             i
    tmp2[j,k,l] = b[j,k,l] * c[k,l]
    tmp3[j,k] = sum(tmp2[j,k,l])
                l
    tmp4[j,k] = tmp[j]*tmp3[j,k]
    w[k] = sum(tmp4[j,k])
           j
    i'm confused!
    Last edited by linuxdude; 04-22-2007 at 12:29 AM.

  2. #2
    Fear the Reaper...
    Join Date
    Aug 2005
    Location
    Toronto, Ontario, Canada
    Posts
    625
    I'm not really follwing what you're saying you professor does. I think you'd need an image or something for me to understand.
    Teacher: "You connect with Internet Explorer, but what is your browser? You know, Yahoo, Webcrawler...?" It's great to see the educational system moving in the right direction

  3. #3
    aoeuhtns
    Join Date
    Jul 2005
    Posts
    581
    He's just using the distributive property.

    Code:
    w[k] = sum_j(tmp4[j,k])
         = sum_j(tmp[j]*tmp3[j,k])
         = sum_j(sum_i(a[i,j]) * sum_l(tmp2[j,k,l]))
         = sum_j(sum_i(a[i,j] * sum_l(tmp2[j,k,l])))    -- using distributive property 
         = sum_j(sum_i(a[i,j] * sum_l(b[j,k,l] * c[k,l])))
         = sum_j(sum_i(sum_l(a[i,j] * b[j,k,l] * c[k,l])))  -- using distributive property.
    There are 10 types of people in this world, those who cringed when reading the beginning of this sentence and those who salivated to how superior they are for understanding something as simple as binary.

  4. #4
    Registered User linuxdude's Avatar
    Join Date
    Mar 2003
    Location
    Louisiana
    Posts
    926
    I'm still confused. Why isn't it like the code. And could you help me write his into code? Like why are you summing over j first and not l?

  5. #5
    aoeuhtns
    Join Date
    Jul 2005
    Posts
    581
    Why would you care that I'm summing over j on the outside and i on the inside? There's no difference.

    "Why isn't it like the code?"? What code, yours? I'm not writing code.
    There are 10 types of people in this world, those who cringed when reading the beginning of this sentence and those who salivated to how superior they are for understanding something as simple as binary.

Popular pages Recent additions subscribe to a feed

Similar Threads

  1. another exercise question
    By luigi40 in forum C# Programming
    Replies: 3
    Last Post: 11-28-2005, 03:52 PM
  2. opengl DC question
    By SAMSAM in forum Game Programming
    Replies: 6
    Last Post: 02-26-2003, 09:22 PM
  3. More a math question than an algorithm
    By Gustaff in forum C Programming
    Replies: 1
    Last Post: 01-28-2003, 01:10 PM
  4. Stupid Math Question....really stupid
    By ToLazytoSignIn in forum A Brief History of Cprogramming.com
    Replies: 9
    Last Post: 01-16-2003, 07:36 PM
  5. Math Question
    By DarkEldar77 in forum C++ Programming
    Replies: 2
    Last Post: 09-17-2001, 01:52 PM

1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21