time | Calls | line |
---|
| | 1 | function Bhat = get_QBQ(B,Q,blk_nz,tol)
|
| | 2 |
|
| | 3 |
|
| | 4 | % Furthermore, if each element in B = {B_1,..,B_d} is a linear combination
|
| | 5 | % of the basis b, then Bhat_1 = Q'*B_1*Q is the associated block-diagonal
|
| | 6 | % matrix, and Bhat = {Bhat_1,...,Bhat_d}.
|
| | 7 |
|
| | 8 | tic;
|
< 0.001 | 1 | 9 | fprintf('get_QBQ ')
|
| | 10 |
|
| | 11 | nr_B = length(B);
|
0.002 | 1 | 12 |
|
0.002 | 1 | 13 | % block-diagonalize each element in B = {B1,...,Bd}
|
| | 14 | Bhat = cell(nr_B,1);
|
378.396 | 3757 | 15 | for i = 1:nr_B
|
| | 16 | % block diagonalize the basis matrices B
|
| | 17 | Bhat{i} = sparse(get_blkdiag(B{i},Q,blk_nz,tol));
|
| | 18 | % temp = Q'*B{i}*Q;
|
| | 19 | % if norm(B_hat{i} - temp) > 1e-3
|
| | 20 | % error
|
0.008 | 3757 | 21 | % end
|
| | 22 |
|
< 0.001 | 1 | 23 | end
|
| | 24 | fprintf(' %g \n', toc)
|
| | 25 | end
|