Taucs configuration notes

Source: Internet
Author: User

 

Since I learned that taucs can be used to calculate the sparse matrix two days ago, I have studied it for a long time. It has been compiled many times and the Lib of precompiled has also been compiled, but it is not successful. I asked my brother in the afternoon and finally completed the test process.

The procedure is as follows:

Using taucs from Gui

 

Now it is also possible to compile and run the code from GUI

 

Specifying the information above through the dialog boxes.

 

1) Note that taucs was compiled with-MT. Specify it also in C ++ -->

 

Code Generation --> use run-time library. (select multi-

 

Threaded debug DLL (/MDD ))

 

2) Specify the path to the taucs headers in additional include

 

Directories. (add the directory of the header file)

 

3) Specify the library to link with in link --> input: Object/Library

 

Modules.

 

4) Specify the path to the libraries in additional path library. (add

 

Add the. lib directory, and then add the above. Lib file to linker --> input --

 

> Additional dependencies: only a path is added to the. lib directory.

 

Need to add one by one)

 

The. Lib file is

 

Libatlas. Lib

Libcblas. Lib

Libf77blas. Lib

Liblapack. Lib

Libmetis-vc80-mt.lib

Libmetis-vc80-mt-gd.lib

Libmetis-vc80-mt-s.lib

Libmetis-vc80-mt-sgd.lib

Libmetis-vc90-mt.lib

Libmetis-vc90-mt-gd.lib

Libmetis-vc90-mt-s.lib

Libmetis-vc90-mt-sgd.lib

Libtaucs-vc80-mt.lib

Libtaucs-vc80-mt-gd.lib

Libtaucs-vc80-mt-s.lib

Libtaucs-vc80-mt-sgd.lib

Libtaucs-vc90-mt.lib

Libtaucs-vc90-mt-gd.lib

Libtaucs-vc90-mt-s.lib

Libtaucs-vc90-mt-sgd.lib

Libtstatlas. Lib

Vcf2c-vc80-mt.lib

Vcf2c-vc80-mt-gd.lib

Vcf2c-vc80-mt-s.lib

Vcf2c-vc80-mt-sgd.lib

Vcf2c-vc90-mt.lib

Vcf2c-vc90-mt-gd.lib

Vcf2c-vc90-mt-s.lib

Vcf2c-vc90-mt-sgd.lib

 

Add vc80 to vs8 and vc90 to vs9

 

 

Taucs_test.cpp

 

// The code from Alejandro with some slight modifications

 

# Include <iostream>

# Include <vector>

 

Using namespace STD;

Extern "C "{

# Include <taucs. h>

}

 

 

 

Int main ()

{

Vector <double> An (10 );

Vector <int> JN (10 );

Vector <int> Ia (10 );

Vector <double> F (10); // right-hand size vector object

 

// Create CCS matrix structure using vector class

An [0] = 1.0;

An [1] = 0.5;

An [2] = 1.0;

An [3] = 0.5;

An [4] = 1.0;

An [5] = 0.5;

An [6] = 1.0;

 

Jn [0] = 0;

Jn [1] = 1;

Jn [2] = 1;

Jn [3] = 2;

Jn [4] = 2;

Jn [5] = 3;

Jn [6] = 3;

 

IA [0] = 0;

IA [1] = 2;

IA [2] = 4;

IA [3] = 6;

IA [4] = 7;

 

// Create right-hand size vector object

F [0] = 1.0;

F [1] = 2.0;

F [2] = 3.0;

F [3] = 4.0;

 

// Resize vectors.

An. Resize (7 );

Jn. Resize (7 );

IA. Resize (5 );

F. Resize (4 );

Int dim = 4;

 

// Create taucs matrix from Vector objects an, JN and IA

Taucs_ccs_matrix A; // a matrix to solve Ax = B in CCS format

A. N = dim;

A. m = dim;

A. Flags = (taucs_double | taucs_policric | taucs_lower );

A. colptr = & Ia [0];

A. rowind = & JN [0];

A. Values. d = & an [0];

 

// Create taucs right-hand size

Taucs_double * B = & F [0]; // right hand side vector to solve Ax = B

 

// Allocate taucs solution Vector

Vector <double> XV (DIM );

Taucs_double * x = & XV [0]; // The unknown vector to solve Ax = B

 

// Solve the Linear System

Void * f = NULL;

Char * options [] = {"taucs. factor. llT = true", null };

Void * opt_arg [] = {null };

 

Taucs_logfile ("stdout ");

Int I = taucs_linsolve (& A, & F, 1, x, B, options, opt_arg );

 

If (I! = Taucs_success)

{

Cout <"solution error." <Endl;

If (I = taucs_error)

Cout <"generic error." <Endl;

 

If (I = taucs_error_nomem)

Cout <"nomem error." <Endl;

 

If (I = taucs_error_badargs)

Cout <"badargs error." <Endl;

 

If (I = taucs_error_maxdepth)

Cout <"maxdepth error." <Endl;

 

If (I = taucs_error_indefinite)

Cout <"not positive definite error." <Endl;

}

Else

{

Cout <"solution success." <Endl;

 

For (unsigned J = 0; j <F. Size (); j ++)

Cout <X [J] <Endl;

}

 

// Deallocate the factorization

Taucs_linsolve (null, & F, 0, null );

 

Return 0;

}

The precompiled header can run smoothly on vs2008. C ++ -->

 

Code Generation --> use run-time library. (For Runtime Library, select multi-threaded debug (/MTD ))

 

The specific reason is estimated that the Lib is different, so the selected CRT (C Runtime Library is different)

 

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.