21.06.2014 Views

Numerical Methods Contents - SAM

Numerical Methods Contents - SAM

Numerical Methods Contents - SAM

SHOW MORE
SHOW LESS

Create successful ePaper yourself

Turn your PDF publications into a flip-book with our unique Google optimized e-Paper software.

The previous example (Code 2.8.14) showed that assembly of the Q-factor in the QR-factorization<br />

of A is not needed, when the linear system of equations Ax = b is to be solved by means of QRfactorization:<br />

the orthogonal transformations can simply be applied to the right hand side(s) whenever<br />

they are applied to the columns of A.<br />

Large (linear) electric circuit<br />

Sought:<br />

✄<br />

R1<br />

L<br />

C 1<br />

R 4<br />

R 2<br />

R 1<br />

C 1 R 1<br />

C 2<br />

R1<br />

L<br />

R 2<br />

C 2<br />

15 16 R 4 7 R 1<br />

17<br />

Discussion of Rem. 2.2.6 for QRfactorization:<br />

Inefficient (!) code<br />

✄<br />

Q ∈ R n,n dense matrix<br />

R ∈ R n,n dense matrix<br />

➣ O(n 2 ) computational effort for executing<br />

loop body<br />

1 % Setting: N ≫ 1,<br />

2 % large tridiagonal matrix A ∈ R n,n<br />

3 [Q,R] = qr (A) ;<br />

4 for j =1:N<br />

5 x = R \ ( Q’∗b) ;<br />

6 b = some_function ( x ) ;<br />

7 end<br />

Dependence of (certain) branch currents<br />

on “continuously varying” resistance<br />

R x<br />

(➣ currents for many different values of<br />

R x )<br />

R1<br />

C1<br />

R2<br />

8 18<br />

9 10<br />

L<br />

C2<br />

R3<br />

R4<br />

R x<br />

Fig. 26<br />

L<br />

R 2<br />

R 2 R2<br />

11 12 13 14<br />

Only a few entries of the nodal analysis matrix A (→ Ex. 2.0.1) are affected by variation of R x !<br />

(If R x connects nodes i & j ⇒ only entries a ii , a jj ,a ij , a ji of A depend on R x )<br />

R1<br />

C1<br />

R2<br />

C2<br />

R3<br />

R4<br />

U<br />

~<br />

Remedies:<br />

• Store R in sparse matrix format, see Code 2.8.14, Sect. 2.6.2.<br />

• Store Givens rotations contained in Q as array of triplets: G lk is coded as<br />

Ôº¾½¿ ¾º<br />

Repeating Gaussian elimination/LU-factorization for each value of R x from scratch seems<br />

wasteful.<br />

Ôº¾½ ¾º<br />

where rho (ˆ= ρ) is chosen as in Rem. 2.8.10.<br />

[l,k,rho] ,<br />

△<br />

Idea: • compute (sparse) LU-factorization of A once<br />

• Repeat:<br />

update LU-factors for modified A<br />

+<br />

(partial) forward and backward substitution<br />

Remark 2.8.17 (Testing for near singularity of a matrix).<br />

Very small (w.r.t. matrix norm) element r ii in QR-factor R ↔ A “nearly singular”<br />

△<br />

Problem: Efficient update of matrix factorizations in the case of ‘slight” changes of the matrix [18,<br />

Sect. 12.6], [38, Sect. 4.9].<br />

✸<br />

2.9.0.1 Rank-1-modifications<br />

2.9 ModificationTechniques<br />

Example 2.9.2 (Changing entries/rows/columns of a matrix).<br />

Example 2.9.1 (Resistance to currents map).<br />

Ôº¾½ ¾º<br />

Changing a single entry: given x ∈ K<br />

{<br />

A,Ã ∈ Kn,n a<br />

: ã ij = ij , if (i,j) ≠ (i ∗ , j ∗ ) ,<br />

x + a ij , if (i,j) = (i ∗ , j ∗ ) ,<br />

Ôº¾½ ¾º<br />

, i ∗ ,j ∗ ∈ {1, ...,n} . (2.9.1)

Hooray! Your file is uploaded and ready to be published.

Saved successfully!

Ooh no, something went wrong!