| ²é¿´: 963 | »Ø¸´: 0 | ||
ßÇßÇßÇßÇгæ (³õÈëÎÄ̳)
|
[ÇóÖú]
¶þάisingÄ£ÐÍÃÉÌØ¿¨Âå³ÌÐò³ö´í£¬ÇóÖ¸µã
|
|
#include #include #include #include #define L 150 #define preN 100000 #define lateN 5100000 #define deltaN (lateN-preN) double recordEnergy[deltaN]; int recordMagnet[deltaN]; int lattice[L][L]; int temp[L][L]; double energy; int magnet; double T; struct CX { double C; double X; }; void InitialLattice(); void SaveInitial(); void GetInitial(); void CaculateFirstMagnet(); void CaculateFirstEnergy(); void GenerateNext(); struct CX Caculate_C_and_X(); int main() { int i; struct CX cx[200]; FILE *ft,*fx,*fc; ft=fopen("T.txt","w" ;fx=fopen("X.txt","w" ;fc=fopen("C.txt","w" ;srand(time(NULL)); T = 1.0; for(i=0;T<4.0;i++) { InitialLattice(); cx=Caculate_C_and_X(); fprintf(ft,"%f\n",T); fprintf(fx,"%f\n",cx.X); fprintf(fc,"%f\n",cx.C); printf("T=%f ",T); printf(" X=%f ",cx.X); printf(" C=%f\n",cx.C); T = T+0.05; } fclose(ft); fclose(fx); fclose(fc); return 0; } void InitialLattice() { int i,j; for(i=0;i for(j=0;j if((rand()%10)>5) lattice[j]=1; else lattice[j]=1; } } } void SaveInitial() { int k,m; for(k=0;k for(m=0;m } } void GetInitial() { int k,m; for(k=0;k for(m=0;m } } void CaculateFirstMagnet() { int i,j; int iMagnet=0; for(i=0;i for(j=0;j } magnet = iMagnet; } void CaculateFirstEnergy() { double dEnergy = 0.0; int up,down,right,left,px,py; for(px=0;px for(py=0;py up = (L+px-1)%L; down = (px+1)%L; right = (L+py-1)%L; left = (py+1)%L; dEnergy += 0.5*lattice[px][py]*(lattice[up][py]+lattice[down][py]+lattice[px][right]+lattice[px][left]); } } energy = dEnergy; } void GenerateNext() { int px,py; int dE,sum; int up,down,right,left; px = rand()%L; py = rand()%L; up = (L+px-1)%L; down = (px+1)%L; right = (L+py-1)%L; left = (py+1)%L; sum = (lattice[px][py])*(lattice[up][py]+lattice[down][py]+lattice[px][right]+lattice[px][left]); switch(sum) { case 4: dE= 8; break; case 2: dE= 4; break; case 0: dE= 0; break; case -2: dE= -4; break; case -4: dE= -8; break; default: printf("---Erro!---\n" ; break;} if( dE>0 ) { if((rand()*1.0/RAND_MAX) <= exp((-1.0)*dE/T)) { lattice[px][py] = -lattice[px][py]; magnet += 2*lattice[px][py]; energy += dE; } } else { lattice[px][py] = -lattice[px][py]; magnet += 2*lattice[px][py]; energy += dE; } } struct CX Caculate_C_and_X() { struct CX cx; int i; double AvgEnergy=0.0; double AvgSquareEnergy=0.0; double AvgMagnet=0.0; double AvgSquareMagnet=0.0; CaculateFirstMagnet(); CaculateFirstEnergy(); for(i=0; i GenerateNext(); if(i>=preN) { recordEnergy[i-preN] = energy; recordMagnet[i-preN] = magnet; } } for(i=0;i AvgEnergy += (double)recordEnergy/deltaN; AvgSquareEnergy += (double)recordEnergy*recordEnergy/deltaN; AvgMagnet += (double)recordMagnet/deltaN; AvgSquareMagnet += (double)recordMagnet*recordMagnet/deltaN; } cx.C = (AvgSquareEnergy - AvgEnergy*AvgEnergy)/T/T; cx.X = (AvgSquareMagnet - AvgMagnet*AvgMagnet)/T; return cx; } :\microsoft visual studio\myprojects\ising\ising.cpp(44) : error C2440: '=' : cannot convert from 'struct CX' to 'struct CX [200]' No user-defined-conversion operator available that can perform this conversion, or the operator cannot be called d:\microsoft visual studio\myprojects\ising\ising.cpp(46) : error C2228: left of '.X' must have class/struct/union type d:\microsoft visual studio\myprojects\ising\ising.cpp(47) : error C2228: left of '.C' must have class/struct/union type d:\microsoft visual studio\myprojects\ising\ising.cpp(49) : error C2228: left of '.X' must have class/struct/union type d:\microsoft visual studio\myprojects\ising\ising.cpp(50) : error C2228: left of '.C' must have class/struct/union type d:\microsoft visual studio\myprojects\ising\ising.cpp(67) : error C2440: '=' : cannot convert from 'const int' to 'int [150]' There are no conversions to array types, although there are conversions to references or pointers to arrays d:\microsoft visual studio\myprojects\ising\ising.cpp(68) : error C2440: '=' : cannot convert from 'const int' to 'int [150]' There are no conversions to array types, although there are conversions to references or pointers to arrays d:\microsoft visual studio\myprojects\ising\ising.cpp(98) : error C2297: '+=' : illegal, right operand has type 'int [150]' d:\microsoft visual studio\myprojects\ising\ising.cpp(187) : error C2440: 'type cast' : cannot convert from 'double [5000000]' to 'double' There is no context in which this conversion is possible d:\microsoft visual studio\myprojects\ising\ising.cpp(188) : error C2440: 'type cast' : cannot convert from 'double [5000000]' to 'double' There is no context in which this conversion is possible d:\microsoft visual studio\myprojects\ising\ising.cpp(189) : error C2440: 'type cast' : cannot convert from 'int [5000000]' to 'double' There is no context in which this conversion is possible d:\microsoft visual studio\myprojects\ising\ising.cpp(190) : error C2440: 'type cast' : cannot convert from 'int [5000000]' to 'double' There is no context in which this conversion is possible Ö´ÐÐ cl.exe ʱ³ö´í. ising.obj - 1 error(s), 0 warning(s) Ôõô°ì |
» ²ÂÄãϲ»¶
265Çóµ÷¼Á
ÒѾÓÐ9È˻ظ´
085600²ÄÁÏÓ뻯¹¤µ÷¼Á
ÒѾÓÐ20È˻ظ´
ר˶ 351 086100 Ò²ÊÇ¿¼µÄ²Ä¿Æ»ù ±¾¿ÆÒ²ÊDzÄÁÏ
ÒѾÓÐ6È˻ظ´
085600ר˶²ÄÁÏÓ뻯¹¤348·ÖÇóµ÷¼Á
ÒѾÓÐ10È˻ظ´
085600 295·ÖÇóµ÷¼Á
ÒѾÓÐ21È˻ظ´
285Çóµ÷¼Á
ÒѾÓÐ5È˻ظ´
Ò»Ö¾Ô¸°²»Õ´óѧ0817»¯Ñ§¹¤³ÌÓë¼¼Êõ£¬Çóµ÷¼Á
ÒѾÓÐ9È˻ظ´
Ò»Ö¾Ô¸0817»¯Ñ§¹¤³ÌÓë¼¼Êõ£¬Çóµ÷¼Á
ÒѾÓÐ8È˻ظ´
271·ÖÇóµ÷¼ÁѧУ
ÒѾÓÐ3È˻ظ´
ÉúÎïѧ308·ÖÇóµ÷¼Á£¨Ò»Ö¾Ô¸»ª¶«Ê¦´ó£©
ÒѾÓÐ7È˻ظ´
ÕÒµ½Ò»Ð©Ïà¹ØµÄ¾«»ªÌû×Ó£¬Ï£ÍûÓÐÓÃŶ~
ÈËÉúתÕÛµã£¬ÕæÐÄÇó°ïÖú£¡
ÒѾÓÐ13È˻ظ´
¹ØÓÚANSYSÔÚÌåÄ£Ð͵ıíÃæÊ©¼ÓÃæÔØºÉµÄÎÊÌâ¡£
ÒѾÓÐ9È˻ظ´
ÓÃcÓïÑÔ±à³ÌÔõÀ´±í´ïʱÖÍ£¡Ð»Ð»£¡
ÒѾÓÐ6È˻ظ´
Çë¸ßÊÖÖ¸µãÒ»ÏÂÔõôȷ¶¨Ò»¸ö·ûºÅ¾ØÕóÖеĵÈÖµÔªËØ
ÒѾÓÐ6È˻ظ´
OPEN CV °ïÖúÎĵµ ²Î¿¼ÊÖ²á
ÒѾÓÐ31È˻ظ´
ÉϺ£Ò©ÎïËù±¯²Ò348·Ö£¬Çó½ÓÊÕ£¡£¡£¡£¡£¡£¡£¡£¡£¡£¡£¡£¡
ÒѾÓÐ36È˻ظ´
GPC£¨Äý½ºÉøÍ¸É«Æ×£©Æ×ͼÇóÖú
ÒѾÓÐ9È˻ظ´
Çó¸ßÊÖÖ¸µã£º¶ÔÓÚ±£ÊØÐԽϵ͵ĻùÒò¿ÉÒÔÓüò²¢ÒýÎïÀ´À©Âð£¿
ÒѾÓÐ9È˻ظ´
matlab³ÌÐòÔËÐгö´í£¬ÇóÖ¸µãÐÞ¸Ä
ÒѾÓÐ4È˻ظ´
ɽ¶«´óѧÓлú333£¬Çóµ÷¼Á
ÒѾÓÐ8È˻ظ´
ÇóÖú°¡£¡ÇóÒ»³ÌÐò£¬ÓÃmatlab³ÌÐò×ö£¬ÓÃÃÉÌØ¿¨Âå·½·¨Ä£Äâ
ÒѾÓÐ10È˻ظ´
¡¾ÇóÖú¡¿´¼³Á
ÒѾÓÐ7È˻ظ´
¡¾ÇóÖú¡¿Ò©Ñ§»ù´¡ÖªÊ¶
ÒѾÓÐ10È˻ظ´
ÇóÖúCÓïÑÔÓÐÏÞԪһά¡¢¶þά¡¢¾ØÐÎÍø¸ñÒÔ¼°Èý½ÇÐÎÍø¸ñ³ÌÐò
ÒѾÓÐ4È˻ظ´
¿ÆÑдÓСľ³æ¿ªÊ¼£¬ÈËÈËΪÎÒ£¬ÎÒΪÈËÈË














;
»Ø¸´´ËÂ¥
µã»÷ÕâÀïËÑË÷¸ü¶àÏà¹Ø×ÊÔ´