This is a static copy of a profile report

Home

lgwt (318 calls, 0.861 sec)
Generated 18-Mar-2011 23:31:42 using cpu time.
M-function in file /Users/Robert/Documents/Work/Cardiff/postdoc/myrepo/NURBS/isoBEM/lgwt.m
Copy to new window for comparing multiple runs

Parents (calling functions)

Function NameFunction TypeCalls
integrateHsubmatrixSSTM-function31
integrateGsubmatrix_TellesM-function31
integrateHGsubmatrices_GLQM-function255
calculateL2BoundaryNormM-function1
Lines where the most time was spent

Line NumberCodeCallsTotal Time% TimeTime Plot
45
L(:,k+1)=( (2*k-1)*y.*L(:,k)-(...
270300.290 s33.7%
46
end
270300.114 s13.3%
51
y=y0-L(:,N2)./Lp;
54060.073 s8.4%
53
end
54060.041 s4.8%
50
y0=y;
54060.041 s4.8%
All other lines  0.301 s34.9%
Totals  0.861 s100% 
Children (called functions)

Function NameFunction TypeCallsTotal Time% TimeTime Plot
linspaceM-function3180.021 s2.4%
Self time (built-ins, overhead, etc.)  0.840 s97.6%
Totals  0.861 s100% 
M-Lint results
Line numberMessage
42The value assigned to variable 'Lp' might be unused.
Coverage results
[ Show coverage for parent directory ]
Total lines in function59
Non-code lines (comments, blank lines)38
Code lines (lines that can run)21
Code lines that did run21
Code lines that did not run0
Coverage (did run/can run)100.00 %
Function listing
   time   calls  line
1 function [x,w]=lgwt(N,a,b)
2
3 % lgwt.m
4 %
5 % This script is for computing definite integrals using Legendre-Gauss
6 % Quadrature. Computes the Legendre-Gauss nodes and weights on an interval
7 % [a,b] with truncation order N
8 %
9 % Suppose you have a continuous function f(x) which is defined on [a,b]
10 % which you can evaluate at any x in [a,b]. Simply evaluate it at all of
11 % the values contained in the x vector to obtain a vector f. Then compute
12 % the definite integral using sum(f.*w);
13 %
14 % Written by Greg von Winckel - 02/25/2004
318 15 N=N-1;
318 16 N1=N+1; N2=N+2;
17
0.04 318 18 xu=linspace(-1,1,N1)';
19
20 % Initial guess
318 21 y=cos((2*(0:N)'+1)*pi/(2*N+2))+(0.27/N1)*sin(pi*xu*N/N2);
22
23 % Legendre-Gauss Vandermonde Matrix
318 24 L=zeros(N1,N2);
25
26 % Derivative of LGVM
318 27 Lp=zeros(N1,N2);
28
29 % Compute the zeros of the N+1 Legendre Polynomial
30 % using the recursion relation and the Newton-Raphson method
31
0.01 318 32 y0=2;
33
34 % Iterate until new points are uniformly within epsilon of old points
0.01 318 35 while max(abs(y-y0))>eps
36
37
0.04 5406 38 L(:,1)=1;
0.03 5406 39 Lp(:,1)=0;
40
0.04 5406 41 L(:,2)=y;
0.04 5406 42 Lp(:,2)=1;
43
0.03 5406 44 for k=2:N1
0.29 27030 45 L(:,k+1)=( (2*k-1)*y.*L(:,k)-(k-1)*L(:,k-1) )/k;
0.11 27030 46 end
47
0.02 5406 48 Lp=(N2)*( L(:,N1)-y.*L(:,N2) )./(1-y.^2);
49
0.04 5406 50 y0=y;
0.07 5406 51 y=y0-L(:,N2)./Lp;
52
0.04 5406 53 end
54
55 % Linear map from[-1,1] to [a,b]
318 56 x=(a*(1-y)+b*(1+y))/2;
57
58 % Compute the weights
0.02 318 59 w=(b-a)./((1-y.^2).*Lp.^2)*(N2/N1)^2;