Generalized feature value of large-scale sparse matrix-CLAPACK and IETL library Attempt

Source: Internet
Author: User
Tags lapack

After trying to write a program to solve the problem, I began to find a variety of libraries on the Internet to solve the feature values and feature vectors, especially the feature values of large-scale sparse matrices, the problem of generalized feature values is not considered because the generalized feature values can be easily converted into general feature values. On the internet I found a good article to tell the author looking for a variety of libraries, which saves me a lot of time: http://blog.csdn.net/MulinB/archive/2010/04/17/5496853.aspx

1. I first looked at the CLAPACK library, because when I searched for it myself, LAPACK was almost the most famous, and many well-known libraries or software referenced it, CLAPACK is the C language version of LAPACK (the LAPACK library is in FORTRAN ). Here I downloaded clapack-3.1.1-visualstudio.zip, The CLAPACK project under VS2005 and the compiled static Link Library, and completed the configuration according to the Chinese introduction on how to configure the CLAPACK project. After performing the steps described in Chinese during the configuration process, the following error occurs:

Error LNK2005: _ invoke_watson has been defined in MSVCRTD. lib (MSVCR80D. dll)

It should be in conflict with MSVCRTD. lib. Therefore, if I set to ignore the MSVCRTD. lib library in the project properties, there will be no errors, and only a bunch of warnings will be left empty.

After the configuration is passed, it is basically necessary to find the function you need. The name of LAPACK is strange, it is still difficult to find the function you want ...... I found out the desired feature in the LAPACK User Guide: Generalized Symmetric Definite Eigenproblems. According to the introduction in this article, I found the corresponding function in clapack, but looking at the comments in the source code of the function, I feel that it is not exactly the same as the instructions on the website. I don't know if it is because the User Guide is LAPACK, and the code I see is CLAPACK. According to the introduction on the website, I did not find the function to solve the generalized feature value problem, however, I saw in the code comment that the generalized feature problem in this library is represented by A * x = lambda * B * x, search for A * x = lambda * B * x in the source code library of the library and obtain A function dggev _. After A try, the generalized feature value problem can be solved normally. However, I did not find any special function for the sparse matrix in the CLAPACK library, nor did I find some feature values for the matrix (not to say that it must not, maybe I didn't find it), and I gave up exploring it for the moment. I personally think it is too difficult to find the desired function in the LAPACK function library.

2. IETL Library: the latest version of IETL 2.2 is downloaded from its website. The IETL library depends on the boost library and is of Version 1.31. It is old. I have a boost library of version 1.41. I tried it and it cannot be used normally, I downloaded another 1.31 boost, and uBlas bindings is required for many examples, and this item is to be put in the boost folder, while Blitz ++ does not find many examples to be used. I am using VS2005. After creating a console project, copy the downloaded IETL file to its directory and put the example power1.cpp in the project, in the project properties, add the boost header file and the directory of the library file correctly, and you can run it normally (you need to download ublas bindings and put it in the corresponding location of the boost folder, if not, some header files cannot be found ). However, if you need to run the inverse or lanczos example, you need to use the lapack And blas libraries. Otherwise, the following problems may occur (several such errors may occur ):

Error LNK2019: the external symbol _ dstev that cannot be parsed

Dstev is the function defined in the LAPACK library. I checked this function in the CLAPACK library that I downloaded earlier, but the function name is dstev _, with one more underline, it may be that CLAPACK and LAPACK have some minor differences. I found various versions of lapack And blas libraries on the Internet, but none of them can solve the above error information (both libraries are compiled using FORTRAN, I downloaded all the compiled libraries ). You can use dumpbin to view the lapack database. You can see the dstev interface. I don't know if it is related to the database version. After a day, I suddenly thought of using the CLAPACK library that was previously called. This library was compiled by myself. You can try it. Therefore, the # define LAPACK_DSYSV FORTRAN_ID (dsysv) in lapack_name.h is changed to # define LAPACK_DSYSV FORTRAN_ID (dsysv _). If there are other similar errors, the same method is followed by an underscore; then add libf2cd to the dependency library of the Project attribute. lib BLASd. lib clapackd. lib tmglibd. lib, and set the path of the dependent library, the above error will be solved.

According to the introduction on the website of this library: LAPACK has been a good solution to the feature value problem of dense matrices, and this library is committed to solving the feature value problem of sparse matrices. The implication is that the feature value of the sparse matrix should be unique, but I have not conducted a detailed test, but I just solved a few small matrices, compared with the matlab results, the correctness of the results is ensured first.

After debugging the IETL library, I used its lanczos example (this is the most effective method to solve large-scale sparse symmetric matrix). After finding that N> 200, the obtained feature vectors are all 0. In the code, I checked them out. The calculation error is smaller than a certain degree, but the program is not processing them, exit only when the number of iterations exceeds the limit. Therefore, the feature vectors corresponding to this feature value cannot be calculated. After checking the thesis, I found that lanczos has many improvement methods to make up for its own shortcomings that do not necessarily converge. Maybe the IETL library didn't take this into consideration. However, it can still correctly extract the feature value, but it is only a problem when the feature vector is resolved. If the IETL library is used to solve the advantages of large-scale symmetric sparse matrix feature values, it is recommended that you do not use it.

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.