1 function [G, Vstr] = ldg_basis_orthonormalization_matrix(pdeg,quaddeg)
2 %
function [G, Vstr] = ldg_basis_orthonormalization_matrix(pdeg,quaddeg)
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.
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.
14 % Bernard Haasdonk 28.1.2009
21 % test orthogonality of basis functions:
22 G = ldg_local_mass_matrix(quaddeg,params);
24 %f = @(lcoord) gram_matrix(ldg_evaluate_basis(params,lcoord));
25 %G = triaquadrature(quaddeg,f);
27 % determine V such that Id = V
' * G * V, i.e. V is the
28 % coefficient matrix for orthonormalization of the input vectors
30 [v,e] = eig(G); % so G = v * e * v
', v' * G * v = e,
31 % e.^(-0.5) * v
' * G * v e.^(-0.5) = Id
32 V = v * diag(diag(e).^(-0.5));
36 if abs(max(V' * G * V -eye(size(G))))>1e-4
37 disp(
'error in orthonomalization matrix')