Problem on TAUCS of a Novice

50 views
Skip to first unread message

Kye Wong

unread,
Dec 14, 2009, 9:44:29 AM12/14/09
to matrixprogramming
Hi all:

I'm a novice on taucs and would like to solve the linear equations
using taucs,but I've got some problems on understanding the manual of
taucs 2.2

1 what does the colptr and rowind mean in taucs_ccs_matrix?
for example, a matrix
3,1,0
2,0,4
5,4.0
how to store it in taucs_ccs_matrix structure pls?

2 on solving the linear equation Ax=b
if A is an m*n matrix (m>n) and i want a least-square solution, which
"option" in taucs_linsolve should I use?

3 I've read some discussions on the bugs of taucs on the factorization
and solving of the above mentioned problem, so does it work if I
change "int opt_factor = 1" into " int opt_factor = 0"
and recompile taucs? or must I use the complex low level functions?

Thank you very much for your kindly instructions!

Mark Hoemmen

unread,
Dec 14, 2009, 1:38:57 PM12/14/09
to matrixpr...@googlegroups.com
On Mon, Dec 14, 2009 at 07:44, Kye Wong <wang...@gmail.com> wrote:
> 1 what does the  colptr and rowind mean in  taucs_ccs_matrix?
> for example, a matrix
> 3,1,0
> 2,0,4
> 5,4.0
> how to store it in taucs_ccs_matrix structure pls?

http://www.netlib.org/linalg/html_templates/node92.html#SECTION00931200000000000000

Note carefully the differences in indexing between Fortran and C.

mfh

You Li

unread,
Dec 14, 2009, 1:42:18 PM12/14/09
to matrixpr...@googlegroups.com
Kye Wong wrote:
> Hi all:
>
> I'm a novice on taucs and would like to solve the linear equations
> using taucs,but I've got some problems on understanding the manual of
> taucs 2.2
>
> 1 what does the colptr and rowind mean in taucs_ccs_matrix?
> for example, a matrix
> 3,1,0
> 2,0,4
> 5,4.0
> how to store it in taucs_ccs_matrix structure pls?
>
I believe this link will explain everything:
http://netlib.org/linalg/html_templates/node92.html

> 2 on solving the linear equation Ax=b
> if A is an m*n matrix (m>n) and i want a least-square solution, which
> "option" in taucs_linsolve should I use?
>
This is a over-determined system. So far as I know, Taucs can't solve
over-determined system. But If this is a full-rank matrix, you can try
normal equations method to transform you A into A^T *A.

> 3 I've read some discussions on the bugs of taucs on the factorization
> and solving of the above mentioned problem, so does it work if I
> change "int opt_factor = 1" into " int opt_factor = 0"
> and recompile taucs? or must I use the complex low level functions?
>
> Thank you very much for your kindly instructions!
>
> --
>
> You received this message because you are subscribed to the Google Groups "matrixprogramming" group.
> To post to this group, send email to matrixpr...@googlegroups.com.
> To unsubscribe from this group, send email to matrixprogramm...@googlegroups.com.
> For more options, visit this group at http://groups.google.com/group/matrixprogramming?hl=en.
>
>
>
>

Alejandro A. Ortiz Bernardin

unread,
Dec 14, 2009, 2:11:48 PM12/14/09
to matrixpr...@googlegroups.com

>> 2 on solving the linear equation Ax=b
>> if A is an m*n matrix (m>n) and i want a least-square solution, which
>> "option" in taucs_linsolve should I use?

I don't know the origin of your problem, but you should be able to transform
your problem into one of square matrix where you can use TAUCS. Look at this
paper:

http://www.nealen.net/projects/mls/asapmls.pdf





Kye Wong

unread,
Dec 14, 2009, 9:30:35 PM12/14/09
to matrixpr...@googlegroups.com
Thank you guys!

The first two problems is clear by now!

But what about the third problem? Does taucs really have bugs for separating the factorization and solving operations? Must I use the low-level functions or is there any other easier way of doing these operations just using "taucs_linsolve" pls?

Thank you again for your kindly help!




--

You received this message because you are subscribed to the Google Groups "matrixprogramming" group.
To post to this group, send email to matrixpr...@googlegroups.com.
To unsubscribe from this group, send email to matrixprogramm...@googlegroups.com.
For more options, visit this group at http://groups.google.com/group/matrixprogramming?hl=en.





--
Kye Wong

You Li

unread,
Dec 14, 2009, 10:02:07 PM12/14/09
to matrixpr...@googlegroups.com
There were bugs about using iterative solver, but I didn't have problem
using direct solver.
> <mailto:matrixpr...@googlegroups.com>.
> To unsubscribe from this group, send email to
> matrixprogramm...@googlegroups.com
> <mailto:matrixprogramming%2Bunsu...@googlegroups.com>.

Kye Wong

unread,
Dec 14, 2009, 10:57:14 PM12/14/09
to matrixprogramming
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);
Reply all
Reply to author
Forward
0 new messages