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.
N_VWL2Norm returns the weighted Euclidean L2 norm of x<br />
with weight vec<strong>to</strong>r w:<br />
sqrt [(sum (i = 0 <strong>to</strong> N-1) (x[i]*w[i])^2)]<br />
Usage: RET = N_VWL2Norm ( X, W [, COMM] )<br />
If COMM is not present, N_VWL2Norm returns the weighted L2<br />
norm of the local portion of X. Otherwise, it returns the<br />
global weighted L2 norm..<br />
Source Code<br />
1 f u n c t i o n r e t = N VWL2Norm( 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 ) ;<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 r e t = s q r t ( gnrm ) ;<br />
28<br />
29 end<br />
Purpose<br />
N_VWrmsNorm<br />
N_VWrmsNorm returns the weighted root mean square norm of x<br />
Synopsis<br />
function ret = N_VWrmsNorm(x,w,comm)<br />
Description<br />
N_VWrmsNorm returns the weighted root mean square norm of x<br />
with weight vec<strong>to</strong>r w:<br />
sqrt [(sum (i = 0 <strong>to</strong> N-1) (x[i]*w[i])^2)/N]<br />
Usage: RET = N_VWrmsNorm ( X, W [, COMM] )<br />
If COMM is not present, N_VWrmsNorm returns the WRMS norm<br />
of the local portion of X. Otherwise, it returns the global<br />
WRMS norm..<br />
Source Code<br />
55