How to use GSL library in C for diagonalization of a Hermitian Matrix?

匆匆过客 提交于 2019-12-25 14:40:32

问题


I have basic knowledge about C programming language. I know loop structure, array and control statements. Suddenly I need to know that how to diagonalize a Hermitian matrix using the GSL library in C language. Installation of GSL is not a problem. But I would like to know how to use it for this specific purpose. I am reading GSL manual these days but a concise and precise answer would be highly appreciated?


回答1:


Start by looking at section 15.2 Complex Hermitian Matrices.

To compute the eigenvalues you'll first want to look here:

gsl_eigen_herm_workspace * gsl_eigen_herm_alloc (const size_t n)

This function allocates a workspace for computing eigenvalues of n-by-n complex hermitian matrices. The size of the workspace is O(3n).

Then look at:

int gsl_eigen_herm (gsl_matrix_complex * A, gsl_vector * eval, gsl_eigen_herm_workspace * w)

This function computes the eigenvalues of the complex hermitian matrix A. Additional workspace of the appropriate size must be provided in w. The diagonal and lower triangular part of A are destroyed during the computation, but the strict upper triangular part is not referenced. The imaginary parts of the diagonal are assumed to be zero and are not referenced. The eigenvalues are stored in the vector eval and are unordered.

Eigenvalues and Eigenvectors can be found using:

gsl_eigen_hermv_workspace * gsl_eigen_hermv_alloc (const size_t n)

int gsl_eigen_hermv (gsl_matrix_complex * A, gsl_vector * eval, gsl_matrix_complex * evec, gsl_eigen_hermv_workspace * w)


来源:https://stackoverflow.com/questions/26728330/how-to-use-gsl-library-in-c-for-diagonalization-of-a-hermitian-matrix

标签
易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!