matlab vs taucs

44 views
Skip to first unread message

guerrera_desesperada

unread,
Mar 16, 2009, 2:31:54 PM3/16/09
to matrixprogramming
I want to solve en equation in the form Ax = b where b = L * sigma, L
is an n*n matrix and sigma is a n*1 vector. First I compute b in
Matlab and taucs. I get the following results respectively:

Matlab:
b = -0.1244
0.0944
0.0709
-0.0356
0.0044
0.0226
0.0264
0.0513
0.0259
-0.1008

Taucs:
b = -0.14822593331336975
0.074682575960954026
0.053640816360712051
-0.030279640108346939
0.0044474489986896515
-0.012536907568573952
0.023945368360728025
0.020350200589746237
0.0065053297827641146
-0.092690498568117619

Later I solve the equation A*x = b with the same right hand side both
in Matlab and Taucs. The results I get are given below:

Matlab:
x= 0.124791273241959474;
0.22320798569353395;
0.20655067713551703;
0.14847653431140934;
0.11769784142444831;
0.035095564303853966;
-0.005118735929553144;
-0.09967369944653334;
-0.1432013443593874;
-0.23531385822017092

Taucs:
x = -0.0066731035865185877
0.098591119374648262
0.082850259099170445
0.058563703753251116
0.035099999999999965
0.035942416897506949
0.0030670278529743508
-0.057569235360662982
-0.10011293187188873
-0.18535066591338797

The result I get in Matlab is the correct one. Why does the results in
Taucs are slightly different?

Thanks in advance...

Evgenii Rudnyi

unread,
Mar 16, 2009, 3:48:13 PM3/16/09
to matrixpr...@googlegroups.com
guerrera_desesperada schrieb:

> I want to solve en equation in the form Ax = b where b = L * sigma, L
> is an n*n matrix and sigma is a n*1 vector. First I compute b in
> Matlab and taucs. I get the following results respectively:

...

Please note that the difference is already too big. There is something
wrong already at this stage.

...

> The result I get in Matlab is the correct one. Why does the results in
> Taucs are slightly different?

I would not say slightly. They are just different. Hard to say for sure
but it would be necessary to check how you specify the matrix. As the
matrix vector product is already different, this shows that something is
wrong.

I will try to make a driver that reads the matrix in the Matrix Market
format and runs TAUCS. If all goes well, over the weekend. It may help
to find a problem.

guerrera_desesperada

unread,
Mar 16, 2009, 3:49:47 PM3/16/09
to matrixprogramming
I have figured out that the problem was due to a mistake that occured
while forming the taucs matrix. I have an upper triangular matrix and
I try to create a lowe triangular taucs matrix from it so that I can
use cholesky factorization afterwards. Is there an easy way to create
a lower triangular matrix from an upper triangular one?

Thanks...

On Mar 16, 8:31 pm, guerrera_desesperada <duygu.cey...@gmail.com>
wrote:

Evgenii Rudnyi

unread,
Mar 20, 2009, 4:36:03 PM3/20/09
to matrixpr...@googlegroups.com
guerrera_desesperada schrieb:

> I have figured out that the problem was due to a mistake that occured
> while forming the taucs matrix. I have an upper triangular matrix and
> I try to create a lowe triangular taucs matrix from it so that I can
> use cholesky factorization afterwards. Is there an easy way to create
> a lower triangular matrix from an upper triangular one?

For a symmetric matrix to store the lower part by columns is the same
that to store the upper part by rows. So, I guess you have the upper
part by columns, that corresponds to the lower part by rows.

If I have understood you correctly, you may try Bebop

http://bebop.cs.berkeley.edu/smc/features.html

It is stated that it converts compressed row storage to compressed
column storage.

Mark Hoemmen

unread,
Mar 20, 2009, 5:17:01 PM3/20/09
to matrixpr...@googlegroups.com

You'll also have to take the transpose so that the indices are for the
lower triangle instead of for the upper triangle. In fact I think the
SMC has a "matrix transpose" function that does exactly this.

mfh

Alejandro A. Ortiz Bernardin

unread,
Mar 20, 2009, 6:11:05 PM3/20/09
to matrixpr...@googlegroups.com

-----Mensaje original-----


>>For a symmetric matrix to store the lower part by columns is the same
>>that to store the upper part by rows. So, I guess you have the upper
>>part by columns, that corresponds to the lower part by rows.

>>If I have understood you correctly, you may try Bebop

>>http://bebop.cs.berkeley.edu/smc/features.html

>>It is stated that it converts compressed row storage to compressed
>>column storage.

Why do you need to use a converter? I usually use the upper part of a
symmetric matrix and then use the same vector that points to the diagonal
and the one that has the column indices to use "as is" in TAUCS_LOWER.

Evgenii Rudnyi

unread,
Mar 21, 2009, 5:44:39 AM3/21/09
to matrixpr...@googlegroups.com
Alejandro A. Ortiz Bernardin schrieb:

Let us consider the matrix from your example

http://matrixprogramming.com/TAUCS/src/test_taucs.cpp

TAUCS assumes that one uses compressed columns storage. That is, ia
contains actually the indices for columns and jn are the rows. So, TAUCS
assumes that the matrix is as follows

1.0
0.5 1.0
0.5 1.0
0.5 1.0

that is, it is the lower part indeed. On the other hand, if you assume
that ia contains indices for rows and jn are the columns (compressed row
format), we obtain

1.0 0.5
1.0 0.5
1.0 0.5
1.0

This what I have said, that if one stores a lower part of a symmetric
matrix by columns, it is exactly the same as to store the upper part by
rows.

Yet, imagine that one has stored the upper part by columns or the low
part by rows. Then the transformation is needed.

Alejandro A. Ortiz Bernardin

unread,
Mar 21, 2009, 12:08:30 PM3/21/09
to matrixpr...@googlegroups.com
Oh. I see ... I haven't realized that the vectors were being stored changed
... thanks.


-----Mensaje original-----
De: matrixpr...@googlegroups.com
[mailto:matrixpr...@googlegroups.com] En nombre de Evgenii Rudnyi
Enviado el: Saturday, March 21, 2009 2:45 AM
Para: matrixpr...@googlegroups.com
Asunto: [matrixprogramming] Re: matlab vs taucs
Reply all
Reply to author
Forward
0 new messages