Win10 VS2013 suitesparse-metis-for-windows 1.3.1

Source: Internet
Author: User
Tags lapack

suitesparse-metis-for-windows 1.3.1 Installation package with Suitesparse 4.5.1, Metis 5.1.0 and Lapack 3.4.1

The Suitesparse package on GitHub is suitable for installation in Windows Https://github.com/jlblancoc/suitesparse-metis-for-windows with detailed installation instructions, But there will be a bug.

问题1:metis/GKlib/gk_arch.hThere is a bug in the standard library since C++11 has already supported the Rint function, VS 2013 began to support this function, the repair method

#ifdef __msc__ /*  */#if#define rint (x) ((int) ((x) +0.5)  #endif/*   */#ifndef INFINITY#define INFINITY flt_max#endif#endif  #endif

Post-Installation test methods

1. setting in Environment variablesSuiteSparse_DIR位置是SuiteSoarse的安装位置,例如C:\Program Files (x86)\Suitesparse

2. Test procedures

#include <iostream>#include"Eigen/eigen"#include"Eigen/spqrsupport"using namespace Eigen;intMain () {Sparsematrix<Double> A (4,4); Std::vector< Triplet <Double> >triplets; //Initialize non-0 elements    intr[3] = {0,1,2 }; intc[3] = {1,2,2 }; Doubleval[3] = {6.1,7.2,8.3 };  for(inti =0; I <3; ++i) triplets.push_back (Triplet<Double>(R[i], c[i], val[i])); //Initializing sparse matricesa.setfromtriplets (Triplets.begin (), Triplets.end ()); Std::cout<<"A = \ n"<< A <<Std::endl; //An example of a QR decompositionSPQR < Sparsematrix <Double> >QR; //Calculate DecompositionQr.compute (A); //ask for a x = bVECTOR4D B (1,2,3,4); VECTOR4D x=Qr.solve (b); Std::cout<<"x = \ n"<<x; Std::cout<<"A x = \ n"<< A *x;    GetChar (); Return0;}

2. CMakeLists.txt under the same folder

# -----------------------------------------------# Test CMake script forBuilding against suitesparse# http://code.google.com/p/suitesparse-metis-for-windows/# Created by Jose Luis Blanco (University of Almeria) -# Updated by Jesnault ([email protected]) the- on- +# -----------------------------------------------PROJECT (cholmodexample) cmake_minimum_required (VERSION2.8)# ------------------------------------------------------------------# Detect Suitesparse libraries:# If not found automatically, set Suitesparse_dirinchCMake to the # directory where Suitesparse was built.#------------------------------------------------------------------LIST (APPEND cmake_module_path "${cmake_source_dir}/. /.. /cmakemodule/" ) # ADD the directory where Findsuitesparse.cmake module can be found. Set (Suitesparse_use_lapack_blas on) find_package (Suitesparse QUIET no_module) # 1st:try toLocateThe *config.cmakefile.if(not Suitesparse_found) #set (Suitesparse_verbose on) find_package (Suitesparse REQUIRED) # 2nd:use FindS Uitesparse.cmake module include_directories (${suitesparse_include_dirs})Else() message (STATUS"Find suitesparse:include (${use_suitesparse})") include (${use_suitesparse}) endif () MESSAGE (STATUS"suitesparse_libs: ${suitesparse_libraries}")# ------------------------------------------------------------------# End of Suitesparse detection#------------------------------------------------------------------# ------------------------------------------------------------------# Declare An example program:#------------------------------------------------------------------add_executable (Cholmod-test cholmod-test.c) Target_link_libraries (Cholmod-test ${suitesparse_libraries})

3. Name the folder SRC, and put the above two files in, and create a build folder, using CMake configure and generate Visual Studio2013 engineering files, directly generated can ( Set the position of the variable Cmake_module_path in the CMakeLists.txt according to the location of your Findsuitesparse.cmake file)

4. If you do not use the CMake tool, remember to set the installation location of the Lapack and Suitesparse libraries in the project properties of VS, link to the following libraries

 c:\program files (x86) \suitesparse\lib64\metisd.libc:\program files (x86) \ Suitesparse\lib\suitesparseconfigd.libc:\program files (x86) \suitesparse\lib\libamdd.libc:\program files (x86) \ Suitesparse\lib\libbtfd.libc:\program files (x86) \suitesparse\lib\libcamdd.libc:\program files (x86) \Suitesparse\ Lib\libccolamdd.libc:\program files (x86) \suitesparse\lib\libcolamdd.libc:\program files (x86) \suitesparse\lib\ Libcholmodd.libc:\program files (x86) \suitesparse\lib\libcxsparsed.libc:\program files (x86) \suitesparse\lib\ Libklud.libc:\program files (x86) \suitesparse\lib\libldld.libc:\program files (x86) \suitesparse\lib\ Libumfpackd.libc:\program files (x86) \suitesparse\lib\libspqrd.libc:\program files (x86) \suitesparse\lib\lapack_ Blas_windows\libblas.libc:\program Files (x86) \suitesparse\lib\lapack_blas_windows\ Liblapack.libkernel32.libuser32.libgdi32.libwinspool.libshell32.libole32.liboleaut32.libuuid.libcomdlg32.lib 

#输出结果如下b

Win10 VS2013 suitesparse-metis-for-windows 1.3.1

Related Article

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.