注册 登录
编程论坛 汇编论坛

[求助]大家看看怎么把C语言程序改成汇编?

cyzzhe 发布于 2006-05-27 16:46, 756 次点击

void calcOutputNet()

{

int i;

int j;

//calculate the outputs of the hidden neurons

//the hidden neurons are tanh

for(i = 0;i<numHidden;i++)

{

hiddenVal[i] = 0.0;

for(j = 0;j<numInputs;j++)

hiddenVal[i] = hiddenVal[i] + (trainInputs[0][j] * weightsIH[j][i]);

hiddenVal[i] = tanh(hiddenVal[i]);

}

//calculate the output of the network

//the output neuron is linear

outPred = 0.0;

//calculate the output of the network

//the output neuron is linear

//outPred = 0.0;

for(i = 0;i<numHidden;i++)

outPred = outPred + hiddenVal[i] * weightsHO[i];

//calculate the error

//errThisPat = outPred - trainOutput[patnum];

}

//****************************************************//

//********** THIS IS THE MAIN PROGRAM **************************

//==============================================================

main ()

{

int i;

int j;

//initiate the weights

initWeights();

//load in the data

initData();

//train the network

for(j = 0;j <= numEpochs;j++)

{

for(i = 0;i<numPatterns;i++)

{

//select a pattern at its squence

patNum =i;

//calculate the current network output

//and error for this pattern

calcNet();

//change network weights

WeightChangesHO();

WeightChangesIH();

}

//display the overall network error

//after each epoch

for(i = 0;i<numPatterns;i++)

{

patNum =i;

calcOverallError();

}

printf("epoch =%d RMSError =%d\n " ,j, RMSerror);

}

//training has finished

//display the results

displayResults();

// trainInputs[0][0] = 1;

// trainInputs[0][1] = 1;

//trainInputs[0][2] = 1;//bias

//trainInputs[0][3] = 1;

//trainInputs[0][4] = 1;

//trainInputs[0][5] = 1;

// calcOutputNet();

trainInputs[0][0] = 1;

trainInputs[0][1] = 1;

trainInputs[0][2] = 1;//bias

trainInputs[0][3] = 1;

trainInputs[0][4] = 1;

trainInputs[0][5] = 1;

trainInputs[0][6] = 1;

trainInputs[0][7] = 1;

trainInputs[0][8] = 1;

trainInputs[0][9] = 1;

trainInputs[0][10] = -1;

trainInputs[0][11] = -1;

calcOutputNet();

}

//=============================================================

//********** END OF THE MAIN PROGRAM *********************
1 回复
#2
lxgaaa2006-05-28 18:42
同问,不懂
1