rbmatlab  1.16.09
 All Classes Namespaces Files Functions Variables Modules Pages
basis_orthonormalization_matrix.m
1 function [G, Vstr] = basis_orthonormalization_matrix(pdeg,quaddeg)
2 %function [G, Vstr] = basis_orthonormalization_matrix(pdeg,quaddeg)
3 %
4 % computation of Gram matrix of ldg basis of degree pdeg with
5 % quadrature of degree quaddeg. Inner product is L2-inner product
6 % over reference triangle.
7 %
8 % If the resulting matrix is not unity, the strin Vstr defines an
9 % orthogonal matrix V, that realizes an orthonormalization.
10 % i.e. if G=X' * X then (XV)'(XV) is the identity matrix.
11 % This matrix must be multiplied in evaluate_basis with the
12 % current basis in order to produce an orthonormal basis.
13 
14 % Bernard Haasdonk 28.1.2009
15 
16 % set ldg parameters
17 params.nelements = 1;
18 params.pdeg = pdeg;
19 params.dimrange = 1;
20 
21 % initialize function
22 df = ldgdiscfunc(params);
23 
24 % test orthogonality of basis functions:
25 f = @(lcoord) gram_matrix(evaluate_basis(df,lcoord));
26 G = triaquadrature(quaddeg,f);
27 
28 % determine V such that Id = V' * G * V, i.e. V is the
29 % coefficient matrix for orthonormalization of the input vectors
30 G = 0.5*(G+G');
31 [v,e] = eig(G); % so G = v * e * v', v' * G * v = e,
32  % e.^(-0.5) * v' * G * v e.^(-0.5) = Id
33 V = v * diag(diag(e).^(-0.5));
34 
35 %keyboard;
36 
37 if abs(max(V' * G * V -eye(size(G))))>1e-4
38  disp('error in orthonomalization matrix')
39 end;
40 
41 Vstr = matrix2str(V);
42 %| \docupdate
an ldg shape functions implementation
Definition: ldgdiscfunc.m:17