Community
cancel
Showing results for 
Search instead for 
Did you mean: 
Smart_Lubobya
Beginner
47 Views

codes output T, D are distorted after using QueryPerformanceCounter, why?

#include

"stdafx.h"

#include

#include

#include

using

namespace std;

void

{

T=C;

}

getTranspose(int C[4][4], int T[4][4])for (int i=0;i<4;i++)for (int j=0;j<4;j++)

void

{

cout << endl;

R +=C*X;

MatrixMultiply_CX(int C[4][4], int X[4][4],int R[4][4])for (int i=0;i<4;i++)for (int j=0;j<4;j++) R=0;for (int i=0;i<4;i++)for (int j=0;j<4;j++)for (int k=0;k<4;k++)// Product formula

}

void

{

cout << endl;

D +=R*T;

}

MatrixMultiply_RT(int R[4][4], int T[4][4],int D[4][4])for (int i=0;i<4;i++)for (int j=0;j<4;j++) D=0;for (int i=0;i<4;i++)for (int j=0;j<4;j++)for (int k=0;k<4;k++)

void

{

UINT64 startCount, endCount, diffCount, freq;

QueryPerformanceCounter((LARGE_INTEGER*)&startCount);

QueryPerformanceCounter((LARGE_INTEGER*)&endCount);

cout << endl;

}

MatrixMultiply_CX(C, X, R);

cout << endl;

}

MatrixMultiply_RT(R, T, D);

cout << endl;

}

diffCount = endCount - startCount;

QueryPerformanceFrequency((LARGE_INTEGER*)&freq);

printf(

}

main(void)int C[4][4] ={1,1,1,1,2,1,-1,-2,1,-1,-1,1,1,-2,2,-1};int X[4][4] ={4,8,6,9,7,6,3,11,1,9,8,3,15,5,15,6};int R[4][4];int T[4][4];int D[4][4];for (int i=0;i<4;i++) {for (int j=0;j<4;j++)cout << T << " ";for(int i = 0; i<4; i++){for(int j = 0; j<4; j++)cout << R << " ";for(int i = 0; i<4; i++){for(int j = 0; j<4; j++) cout << D << " ";double exeTime_in_ms = (double)diffCount * 1000.0 / freq;"Executing time : %fms\\n", exeTime_in_ms);
0 Kudos
2 Replies
jimdempseyatthecove
Black Belt
47 Views

Can you repost your code using the button that looks like a yellow pencil (between the HTML and Omega buttons).

Jim
Brandon_H_Intel
Employee
47 Views

I agree with Jim. You could also attach the source as a file as well using the "Add Files" button. I thought the problem was just some added whitespace, so I was going to just clean it up, but it looks like some code got transposed, so I'm not sure if the code really made it through the cut/paste properly.
Reply