예제 #1
0
파일: matrixm.cpp 프로젝트: PasaLab/dolphin
int MyTest(void)
{
	int i,j,k;
	//init
	for(i = 0 ; i < M_INT; i++)
		for(j = 0; j < K_INT; j++)
			A[i*K_INT + j] = (float)i;

	for(i = 0 ; i < K_INT; i++)
		for(j = 0; j < N_INT; j++)
			B[i*N_INT + j] = (float)j;

	memset(C,0,sizeof(float)*M_INT*N_INT);
	memset(C1,0,sizeof(float)*M_INT*N_INT);
	memset(C2,0,sizeof(float)*M_INT*N_INT);

	NormalToBlockMatrix(A1,A,M_INT,K_INT);
	NormalToBlockMatrix(B1,B,K_INT,N_INT);
	
	fprintf(stderr,"%d\n",getStartAddress(C1,0,1,M_INT,N_INT) - C1);

	for(i = 0; i < M_INT/BLOCK_M; i++)
		for(j = 0; j < N_INT/BLOCK_N; j++)
			for(k = 0; k < K_INT/BLOCK_K; k++)
			{
				//Calculate C1(i,j) = A1(i,k) * B1(k,j)
				highEfficentMatrixMultiply(
						getStartAddress(C1,i,j,M_INT,N_INT),
						getStartAddress(A1,i,k,M_INT,K_INT),
						getStartAddress(B1,k,j,K_INT,N_INT),
						BLOCK_M,BLOCK_K,BLOCK_N);
			}
	

	highEfficentMatrixMultiply(C, A, B, M_INT,K_INT,N_INT);

	BlockToNormal(C2,C1,M_INT,N_INT);

	for(i = 0; i < M_INT; i++)
	{
		for(j = 0; j < N_INT ; j++){
			fprintf(stderr,"%f|%f ",C[i*N_INT+j],C2[i*N_INT+j]);
	//		assert(C1[i*N_INT+j] == C[i*N_INT+j]);
		}
		printf("\n");
	}
			
	return 0;
}
예제 #2
0
static
RemoteReflectionInfo makeRemoteReflectionInfo(RemoteSection fieldmd,
                                              RemoteSection assocty,
                                              RemoteSection builtin,
                                              RemoteSection capture,
                                              RemoteSection typeref,
                                              RemoteSection reflstr) {
  RemoteReflectionInfo Info = {
    fieldmd,
    assocty,
    builtin,
    capture,
    typeref,
    reflstr,
    0,
    0
  };

  const RemoteSection Sections[6] = {
    fieldmd, assocty, builtin, capture, typeref, reflstr
  };

  Info.StartAddress = getStartAddress(Sections, 6);

  uintptr_t EndAddress = getEndAddress(Sections, 6);
  Info.TotalSize = EndAddress - Info.StartAddress;

  return Info;
}
예제 #3
0
void Side::set(FrameBuffer& frame, uint32_t color)
{
	if(!bEnabled)
		return;

	for(int address = getStartAddress(); address <= getEndAddress(); ++address)
	{
		frame.setColor(address, color);
	}
}
예제 #4
0
파일: matrixm.cpp 프로젝트: PasaLab/dolphin
float* BlockToNormal(float* dst, float* src, int m,int n)
{
	int i,j,k;
	for(i = 0; i < m/BLOCK_M; i++)
		for(j = 0; j < n/BLOCK_N; j++)
		{
			 float* srcp = getStartAddress(src,i,j,m,n);
			 float* dstp = dst + i*BLOCK_M*n + j*BLOCK_N;
			//Convert SubMatrix src(i,j)
			for(k = 0; k < BLOCK_M;k++)//Copy the k-th line of matrix to the sub-block-matrix
			{
				memcpy(dstp,srcp,sizeof(float)*BLOCK_N);
				//go to the next line
				srcp += BLOCK_N;
				dstp += n;
			}
		}
	return dst;
}
예제 #5
0
파일: kinet.cpp 프로젝트: Dewb/streetlight
std::string FixtureStrip::getName() const
{
    std::ostringstream out;
    out << getStartAddress() << "-" << getStartAddress() + _length * 3 - 1;
    return out.str();
}