00001 00002 00003 00004 00005 00006 00007 00008 00009 00010 00011 00012 00013 // compares two fields and returns the max distrance between 00014 // equivalent components. 00015 float check_differences(mdp_field<mdp_complex> &chi, 00016 mdp_field<mdp_complex> &psi) { 00017 begin_function("check_differences"); 00018 00019 mdp_int i; 00020 mdp_int i_min=psi.physical_local_start(); 00021 mdp_int i_max=psi.physical_local_stop(); 00022 float max=0, tmp; 00023 if(&chi.lattice()!=&psi.lattice()) 00024 error("check_differences()\nFields defined on different lattices"); 00025 for(i=i_min; i<i_max; i++) { 00026 tmp=abs(chi[i]-psi[i]); 00027 if(tmp>max) max=tmp; 00028 } 00029 mdp << "Fields agree/disagree within precision=" << max << '\n'; 00030 00031 end_function("check_differences"); 00032 return max; 00033 }
1.6.1