Thanks!
Then when I try the taucs like follows, "TAUCS_ERROR_NOMEM" always
come out. could you pls give me some idea on that?
Thank you!
double value[6];
int colptr[4];
int rowind[6];
double RHS[3];
// create CCS matrix structure using vector class
value[0]=1;
value[1]=2;
value[2]=3;
value[3]=2;
value[4]=4;
value[5]=3;
colptr[0]=0;
colptr[1]=3;
colptr[2]=5;
colptr[3]=6;
rowind[0]=0;
rowind[1]=0;
rowind[2]=0;
rowind[3]=1;
rowind[4]=1;
rowind[5]=2;
// create right-hand size vector object
RHS[0] = 10;
RHS[1] = 2;
RHS[2] = 3;
// resize vectors.
int dim = 3;
// 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_SYMMETRIC);
A.colptr = colptr;
A.rowind = rowind;
A.values.d = value;
// allocate TAUCS solution vector
double x[3];
// solve the linear system
void* F = NULL;
char* options[] = {"
taucs.factor.LU=true", NULL};
void* opt_arg[] = { NULL };
int i = taucs_linsolve(&A, &F, 1, x, RHS, 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 < 4; j++)
cout << x[j] << endl;
}
// deallocate the factorization
taucs_linsolve(NULL, &F, 0, NULL, NULL, NULL, NULL);