PEANO order

Collapse
X
 
  • Time
  • Show
Clear All
new posts
  • mia023
    New Member
    • May 2007
    • 89

    PEANO order

    hello everyone I have a project and just need ideas about it. This is the documentation:

    [FONT=Calibri][SIZE=3][FONT=Calibri][SIZE=3]
    Develop the code for matrix multiplication in Peano[/SIZE][/FONT][/SIZE][/FONT][FONT=Calibri][SIZE=3][FONT=Calibri][SIZE=3]‐[/SIZE][/FONT][/SIZE][/FONT][FONT=Calibri][SIZE=3][FONT=Calibri][SIZE=3]Order and another one in roworder.
    The program should be able to read two matrices from a file, and output the
    multiplication of these two matrices using both orders. Use PAPI (Performance
    Application Programming Interface) to instrument your code. Your code should monitor
    the following: L1 cache misses, L2 cache misses, number of FLOPS and total time.
    Present these results in a table for different sizes of the matrices, analyze and justify
    these results.
    [/SIZE][/FONT][/SIZE][/FONT]
  • donbock
    Recognized Expert Top Contributor
    • Mar 2008
    • 2427

    #2
    Are you using the Haskell language?

    Comment

    • mia023
      New Member
      • May 2007
      • 89

      #3
      actually no i am using C language

      Comment

      • HabibBhutto
        New Member
        • Jan 2009
        • 17

        #4
        Hi Dear,

        just refer the book
        C++ Projects
        by Reeta Sahoo
        publisher: khanna book publishing co. (p) Ltd

        there is a project in this book with respect to matrix manipulation he/she demonstrated all basic operation with respect to matrix... !

        It will help u alot... !

        :) pray for me if my sugesstion works for u.. !

        Comment

        • mia023
          New Member
          • May 2007
          • 89

          #5
          you should buy the book or it is free

          Comment

          • mia023
            New Member
            • May 2007
            • 89

            #6
            it isn't working out need some hepl please

            Comment

            • mia023
              New Member
              • May 2007
              • 89

              #7
              Matrix Multiplication

              I want to write a C++ program regarding matrix multiplication using Peano order can you please help

              Comment

              • JosAH
                Recognized Expert MVP
                • Mar 2007
                • 11453

                #8
                I merged your two threads: they're both about the same problem. A question for you: what have you done so far?

                kind regards,

                Jos (moderator)

                Comment

                • mia023
                  New Member
                  • May 2007
                  • 89

                  #9
                  this is my code but i think there is a problem in it


                  #include <iostream>
                  #include <string>
                  #include <vector>
                  #include <sstream>

                  using namespace std;
                  // NOTE: CHANGE THESE VARIABLES TO MEET THE REQUIREMENTS OF YOUR TESTCASE!!!!
                  #define numRowsA 3
                  #define numColumnsA 3
                  #define numRowsB numColumnsA
                  #define numColumnsB 3
                  static double toDouble ( string s);
                  static long toLong ( string s);
                  static int toInteger ( string s);

                  int MatrixA[9] = {1,2,3,4,5,6,7, 8,9};
                  int MatrixB[9]= {10,11,12,13,14 ,15,16,17,18};
                  int MatrixMult[9];
                  int a = 0;
                  int b = 0;
                  int c = 0;
                  void peanomult(int phsA, int phsB, int phsC, int dim);
                  int main()
                  {
                  for (int i =0; i < 9; i++)
                  {
                  cout << MatrixA[i];
                  cout << " ";
                  }
                  cout << endl;
                  cout << endl;
                  for (int i =0; i < 9; i++)
                  {
                  cout << MatrixB[i];
                  cout << " ";
                  }
                  cout << endl;
                  cout << endl;

                  peanomult(0, 0, 0, 9);
                  for (int i =0; i < 9; i++)
                  {
                  cout << MatrixMult[i];
                  cout << " ";
                  }
                  cout << endl;
                  cout << endl;


                  return 1;
                  }


                  //void peanomult(int MatrixA, int MatrixB, int MatrixMult, int dim)
                  void peanomult(int phsA, int phsB, int phsC, int dim)
                  {
                  if (dim == 1)
                  {
                  MatrixMult[c] += MatrixA[a] * MatrixB[b];
                  }
                  else
                  {
                  peanomult( phsA, phsB, phsC, dim/3); a += phsA; c += phsC;
                  peanomult( phsA, -phsB, phsC, dim/3); a += phsA; c += phsC;
                  peanomult( phsA, phsB, phsC, dim/3); a += phsA; b += phsB;
                  peanomult( phsA, phsB, -phsC, dim/3); a += phsA; c -= phsC;
                  peanomult( phsA, -phsB, -phsC, dim/3); a += phsA; c -= phsC;
                  peanomult( phsA, phsB, -phsC, dim/3); a += phsA; b += phsB;
                  peanomult( phsA, phsB, phsC, dim/3); a += phsA; c += phsC;
                  peanomult( phsA, -phsB, phsC, dim/3); a += phsA; c += phsC;
                  peanomult( phsA, phsB, phsC, dim/3); b += phsB; c += phsC;
                  peanomult( phsA, phsB, phsC, dim/3); a -= phsA; c += phsC;
                  peanomult( phsA, -phsB, phsC, dim/3); a -= phsA; c += phsC;
                  peanomult( phsA, phsB, phsC, dim/3); a -= phsA; b += phsB;
                  peanomult( phsA, phsB, -phsC, dim/3); a -= phsA; c -= phsC;
                  peanomult( phsA, -phsB, -phsC, dim/3); a -= phsA; c -= phsC;
                  peanomult( phsA, phsB, -phsC, dim/3); a -= phsA; b += phsB;
                  peanomult( phsA, phsB, phsC, dim/3); a -= phsA; c += phsC;
                  peanomult( phsA, -phsB, phsC, dim/3); a -= phsA; c += phsC;
                  peanomult( phsA, phsB, phsC, dim/3); b += phsB; c += phsC;
                  peanomult( phsA, phsB, phsC, dim/3); a += phsA; c += phsC;
                  peanomult( phsA, -phsB, phsC, dim/3); a += phsA; c += phsC;
                  peanomult( phsA, phsB, phsC, dim/3); a += phsA; b += phsB;
                  peanomult( phsA, phsB, -phsC, dim/3); a += phsA; c -= phsC;
                  peanomult( phsA, -phsB, -phsC, dim/3); a += phsA; c -= phsC;
                  peanomult( phsA, phsB, -phsC, dim/3); a += phsA; b += phsB;
                  peanomult( phsA, phsB, phsC, dim/3); a += phsA; c += phsC;
                  peanomult( phsA, -phsB, phsC, dim/3); a += phsA; c += phsC;
                  peanomult( phsA, phsB, phsC, dim/3);
                  };
                  }

                  Comment

                  • mia023
                    New Member
                    • May 2007
                    • 89

                    #10
                    could anyone respond as soon as possible because the due date is real soon

                    Comment

                    • JosAH
                      Recognized Expert MVP
                      • Mar 2007
                      • 11453

                      #11
                      Wouldn't it be a good idea to at least supply a link about what that 'Peano order' is all about? Showing a piece of badly formatted code that doesn't work is not the way to go. Help us to help you.

                      kind regards,

                      Jos

                      Comment

                      • mia023
                        New Member
                        • May 2007
                        • 89

                        #12

                        Comment

                        • JosAH
                          Recognized Expert MVP
                          • Mar 2007
                          • 11453

                          #13
                          So you simply copied that function from page #12 of that (interesting) article and you expect everything to automagically work? That is not much of a scientific attitude: read and understand that article; draw the trace of that curve on paper and step through that algorithm and see if the two follow the same trace.

                          kind regards,

                          Jos

                          Comment

                          • mia023
                            New Member
                            • May 2007
                            • 89

                            #14
                            I really don't know C++ well nor C the teacher asked us to do it and I read the article and found this code only so I figured it would be of help. I haven't taken Peano order before and therefore I didn't really understand the article well so please can you help me alittle bit at least.

                            Comment

                            Working...