Đang chuẩn bị liên kết để tải về tài liệu:
Computational Physics - M. Jensen Episode 1 Part 5

Đang chuẩn bị nút TẢI XUỐNG, xin hãy chờ

Tham khảo tài liệu 'computational physics - m. jensen episode 1 part 5', kỹ thuật - công nghệ, cơ khí - chế tạo máy phục vụ nhu cầu học tập, nghiên cứu và làm việc hiệu quả | Chapter 5 Linear algebra 5.1 Introduction In this chapter we deal with basic matrix operations such as the solution of linear equations calculate the inverse of a matrix its determinant etc. This chapter serves also the purpose of introducing important programming details such as handling memory allocation for matrices introducing the concept of classes and templates and the auxiliary library Blitz . The matrices we will deal with are primarily symmetric or hermitian. Thus before we proceed with the more detailed description of algorithms a brief summary of matrix properties may be appropriate. For the sake of simplicity let us look at a 4 X 4 matrix A and a corresponding identity matrix I an al2 al3 an an a22 a23 a24 41 a42 a43 an J 1 0 0 0 0 10 0 0 0 10 0 0 0 1 5.1 The inverse of a matrix is defined by A-1 A 1 Other essential features are given in table 5.1. Finally an important property of hermitian and symmetric matrices is that they have real eigenvalues. 5.2 Programming details In the following discussion matrices are always two-dimensional arrays while vectors are onedimensional arrays. Many programming problems arise from improper treatment of arrays. In this section we will discuss some important points such as array declaration memory allocation and array transfer between functions. We distinguish between two cases a array declarations 69 70 CHAPTERS. LINEAR ALGEBRA Table 5.1 Matrix properties Relations Name matrix elements H H H H H X ỹ symmetric real orthogonal real matrix hermitian unitary . X 52 aik ljk 52 akiakj Vi where the array size is given at compilation time and b where the array size is determined during the execution of the program so-called dymanic memory allocation. 5.2.1 Declaration of fixed-sized vectors and matrices Table 5.2 presents a small program which treats essential features of vector and matrix handling where the dimensions are declared in the program code. In line a we have a standard C declaration of a vector. The compiler .