Go to the source code of this file.
Functions | |
| double | snrm (int n, double sx[], int itol) |
|
||||||||||||||||
|
Definition at line 30 of file snrm.h. Referenced by linbcg(). 00031 { 00032 int i, isamax; 00033 double ans=0.; 00034 00035 if(itol<=3){ 00036 ans=0.0; 00037 for(i=1;i<=n;i++) ans+=sx[i]*sx[i]; // vector magnitude norm 00038 return sqrt(ans); 00039 } 00040 else{ 00041 isamax=1; 00042 for(i=1;i<=n;i++){if(fabs(sx[i])>fabs(sx[isamax])) isamax=i;} 00043 return fabs(sx[isamax]); 00044 } 00045 }
|