Computational Physics - Department of Physics
5.7 Exercises 149 Use Gauss-Legendre quadrature and compute the integral by integrating for each variable x 1 ,y 1 ,z 1 ,x 2 ,y ...
...
Part II Linear Algebra and Eigenvalues ...
This part of the text aims at giving an overview over several methods to solve linear al- gebra and eigenvalue problems. These m ...
Chapter 6 Linear Algebra AbstractThis chapter introduces several matrix related topics, from the solution of linear equations, c ...
154 6 Linear Algebra Various matrix and vector operations are provided through optional integration with BLAS and LAPACK. 6.2 Ma ...
6.2 Mathematical Intermezzo 155 Upper triangular ifai j= 0 fori>j, which for a 4 × 4 matrix is of the form a 11 a 12 ...
156 6 Linear Algebra y=Ax=⇒yi= n ∑ j= 1 ai jxj, (6.3) matrix-matrix multiplication A=BC=⇒ai j= n ∑ k= 1 bikck j, (6.4) transposi ...
6.3 Programming Details 157 ||x+y|| 2 ≤||x|| 2 +||y|| 2. Proofs can be found in for example Ref. [28]. As discussed in chapter 2 ...
158 6 Linear Algebra Fig. 6.1Segmentation fault, again and again! Alas, this is a situation you will most likely end up in, unle ...
6.3 Programming Details 159 Inline dwe have the function definition of subfunction(). Theintvec[] is a pointer to an integer. Al ...
160 6 Linear Algebra quired for the variables is released. In the present case memory for all variables in main() are reserved d ...
6.3 Programming Details 161 cout << Content of vector vec in subfunction:''<< endl; for(k = 0; k < col; k++){ cou ...
162 6 Linear Algebra returnNULL; } i = (rowcolnum_bytes)/sizeof(char); pointer[0] =new(nothrow)char[i]; if(!pointer[0]){ cout &l ...
6.3 Programming Details 163 double∗∗A =⇒double∗A[ 0 ... 3 ] A[ 0 ][ 0 ] A[ 0 ][ 1 ] A[ 0 ][ 2 ] A[ 0 ][ 3 ] A[ 1 ][ 0 ] A[ 1 ][ ...
164 6 Linear Algebra while in Fortran we would have DOj=1, n DOi=1, n a(i,j)=b(i,j)+c(i,j) ENDDO ENDDO Fig. 6.3 shows how a 3 × ...
6.3 Programming Details 165 for(k=0 ; k < n ; k++){ a[i][j]+=b[i][k]*c[k][j] } } } and in Fortran we have DOj=1, n DOi=1, n D ...
166 6 Linear Algebra a[i][j]+=b[i][k]*c[k][j] } } } The fact that we have the constrainti≤jleads to the requirement for the comp ...
6.3 Programming Details 167 P 1 =A 11 B 11 ,U 1 =P 1 +P 2 , P 2 =A 12 B 21 ,U 2 =P 1 +P 4 , P 3 =S 1 T 1 , U 3 =U 2 +P 5 , P 4 = ...
168 6 Linear Algebra One of the better features of Fortran is dynamic storage allocation. That is, the size of an array can be c ...
«
4
5
6
7
8
9
10
11
12
13
»
Free download pdf