rbmatlab  1.16.09
 All Classes Namespaces Files Functions Variables Modules Pages
ldg_l2error.m
1 function l2err = ldg_l2error(df,func,qdeg)
2 %function l2err = ldg_l2error(df,func,qdeg)
3 %
4 % function computing the l2 error of an analytic function func to
5 % the ldg function specified by dofs. A quadrature
6 % of degree qdeg is used.
7 %
8 % func is to be called with local coordinates
9 % res = func(einds, loc ,grid,params)
10 % where res is a matrix of length(loc) x dimrange;
11 %
12 % by this also discrete function differences can be computed by
13 % creating a ldgdiscfunc class object from a ldg dof vector dofs2
14 %
15 % df2 = ldgdiscfunc(dofs2,params);
16 % ldg_l2error(dofs,df,...);
17 
18 % Bernard Haasdonk 5.2.2009
19 
20 % simply pass func_df_difference_sqr and its parameters to quadrature routine.
21 
22 %if isa(func,'ldgdiscfunc')
23 % l2errssqr = triaquadrature(qdeg,@df_df_difference_sqr,df,func,grid, ...
24 % params);
25 %else
26 
27 %params.evaluate = @ldg_evaluate;
28 l2errssqr = triaquadrature(qdeg,@df_func_difference_sqr,df,func);
29 %end;
30 l2err = sqrt(sum(l2errssqr));
31 %| \docupdate
an ldg shape functions implementation
Definition: ldgdiscfunc.m:17