sundialsTB, a Matlab Interface to SUNDIALS - Site Index Page ...
sundialsTB, a Matlab Interface to SUNDIALS - Site Index Page ...
sundialsTB, a Matlab Interface to SUNDIALS - Site Index Page ...
Create successful ePaper yourself
Turn your PDF publications into a flip-book with our unique Google optimized e-Paper software.
1 f u n c t i o n r e t = N VWrmsNorm( x ,w,comm)<br />
11<br />
12 % Radu Serban <br />
13 % Copyright ( c ) 2005 , The Regents o f the U n i v e r s i t y o f C a l i f o r n i a .<br />
14 % $Revision$Date$<br />
15<br />
16 i f nargin == 2<br />
17<br />
18 r e t = dot ( x . ˆ 2 ,w. ˆ 2 ) ;<br />
19 r e t = s q r t ( r e t / l e n g t h ( x ) ) ;<br />
20<br />
21 e l s e<br />
22<br />
23 lnrm = dot ( x . ˆ 2 ,w. ˆ 2 ) ;<br />
24 gnrm = 0 . 0 ;<br />
25 MPI Allreduce ( lnrm , gnrm , ’SUM’ ,comm ) ;<br />
26<br />
27 ln = l e n g t h ( x ) ;<br />
28 gn = 0 ;<br />
29 MPI Allreduce ( ln , gn , ’SUM’ ,comm ) ;<br />
30<br />
31 r e t = s q r t ( gnrm/gn ) ;<br />
32<br />
33 end<br />
56