• R/O
  • HTTP
  • SSH
  • HTTPS

Commit

Tags
Aucun tag

Frequently used words (click to add to your profile)

javac++androidlinuxc#windowsobjective-ccocoa誰得qtpythonphprubygameguibathyscaphec計画中(planning stage)翻訳omegatframeworktwitterdomtestvb.netdirectxゲームエンジンbtronarduinopreviewer

Commit MetaInfo

Révision1d17f754f4ab74687380d69b8f4c2e267469962e (tree)
l'heure2013-02-27 03:01:34
AuteurMikiya Fujii <mikiya.fujii@gmai...>
CommiterMikiya Fujii

Message de Log

Refactoring MNDO to speed up. #30829

git-svn-id: https://svn.sourceforge.jp/svnroot/molds/trunk@1304 1136aad2-a195-0410-b898-f5ea1d11b9d8

Change Summary

Modification

--- a/src/mndo/Mndo.cpp
+++ b/src/mndo/Mndo.cpp
@@ -3929,41 +3929,45 @@ void Mndo::FreeDiatomicTwoElecTwoCore2ndDeriTemps(double*** rotatingMatrix,
39293929 void Mndo::RotateDiatomicTwoElecTwoCoreToSpaceFrame(double**** matrix,
39303930 double const* const* rotatingMatrix) const{
39313931 double oldMatrix[dxy][dxy][dxy][dxy];
3932- for(int mu=0; mu<dxy; mu++){
3933- for(int nu=0; nu<dxy; nu++){
3934- for(int lambda=0; lambda<dxy; lambda++){
3935- for(int sigma=0; sigma<dxy; sigma++){
3936- oldMatrix[mu][nu][lambda][sigma] = matrix[mu][nu][lambda][sigma];
3937- }
3938- }
3939- }
3940- }
3941-
3932+ MolDS_wrappers::Blas::GetInstance()->Dcopy(dxy*dxy*dxy*dxy, &matrix[0][0][0][0], &oldMatrix[0][0][0][0]);
3933+
39423934 // rotate (fast algorithm, see also slow algorithm shown later)
3935+ double** twiceRotatingMatrix = NULL;
3936+ double** ptrOldMatrix = NULL;
3937+ double** ptrMatrix = NULL;
3938+ MallocerFreer::GetInstance()->Malloc<double>(&twiceRotatingMatrix, dxy*dxy, dxy*dxy);
3939+ MallocerFreer::GetInstance()->Malloc<double*>(&ptrOldMatrix, dxy*dxy);
3940+ MallocerFreer::GetInstance()->Malloc<double*>(&ptrMatrix, dxy*dxy);
39433941 for(int mu=0; mu<dxy; mu++){
39443942 for(int nu=0; nu<dxy; nu++){
3943+ int i=mu*dxy+nu;
39453944 for(int lambda=0; lambda<dxy; lambda++){
39463945 for(int sigma=0; sigma<dxy; sigma++){
3947- matrix[mu][nu][lambda][sigma] = 0.0;
3948- for(int i=0; i<dxy; i++){
3949- double tempI = 0.0;
3950- for(int j=0; j<dxy; j++){
3951- double tempIJ = 0.0;
3952- for(int k=0; k<dxy; k++){
3953- double tempIJK = 0.0;
3954- for(int l=0; l<dxy; l++){
3955- tempIJK += oldMatrix[i][j][k][l]*rotatingMatrix[sigma][l];
3956- }
3957- tempIJ += tempIJK*rotatingMatrix[lambda][k];
3958- }
3959- tempI += tempIJ*rotatingMatrix[nu][j];
3960- }
3961- matrix[mu][nu][lambda][sigma] += tempI*rotatingMatrix[mu][i];
3962- }
3946+ int j=lambda*dxy+sigma;
3947+ twiceRotatingMatrix[i][j] = rotatingMatrix[mu][lambda]*rotatingMatrix[nu][sigma];
39633948 }
39643949 }
3950+ ptrOldMatrix[i] = &oldMatrix[mu][nu][0][0];
3951+ ptrMatrix [i] = &matrix [mu][nu][0][0];
39653952 }
39663953 }
3954+ bool isColumnMajorTwiceRotatingMatrix = false;
3955+ bool isColumnMajorPtrOldMatrix = false;
3956+ double alpha = 1.0;
3957+ double beta = 0.0;
3958+ MolDS_wrappers::Blas::GetInstance()->Dgemmm(isColumnMajorTwiceRotatingMatrix,
3959+ isColumnMajorPtrOldMatrix,
3960+ !isColumnMajorTwiceRotatingMatrix,
3961+ dxy*dxy, dxy*dxy, dxy*dxy, dxy*dxy,
3962+ alpha,
3963+ twiceRotatingMatrix,
3964+ ptrOldMatrix,
3965+ twiceRotatingMatrix,
3966+ beta,
3967+ ptrMatrix);
3968+ MallocerFreer::GetInstance()->Free<double>(&twiceRotatingMatrix, dxy*dxy, dxy*dxy);
3969+ MallocerFreer::GetInstance()->Free<double*>(&ptrOldMatrix, dxy*dxy);
3970+ MallocerFreer::GetInstance()->Free<double*>(&ptrMatrix, dxy*dxy);
39673971
39683972 /*
39693973 // rotate (slow algorithm)