Google Groups no longer supports new Usenet posts or subscriptions. Historical content remains viewable.
Dismiss

How to convert tall sparse matrix to square matrix

3 views
Skip to first unread message

imi kh

unread,
Dec 28, 2011, 1:57:08 AM12/28/11
to
Hello
I have sparse matrix of size A= <36864x16641 double> and b= <36864x1 double>, i want to solve for x using conjugate gradient method, but it need A to be square, how i convert A to square matrix so that i can apply conjugate gradient method.
BR
Imi

Bruno Luong

unread,
Dec 28, 2011, 3:15:09 AM12/28/11
to
"imi kh" <imran_...@hotmail.com> wrote in message <jdeek4$q0a$1...@newscl01ah.mathworks.com>...
Hint: multiply the linear system on its left side by transposed of A.

Bruno

imi kh

unread,
Dec 28, 2011, 4:19:08 AM12/28/11
to
"Bruno Luong" <b.l...@fogale.findmycountry> wrote in message <jdej6d$995$1...@newscl01ah.mathworks.com>...
Thanks for reply, well i have did it but the problem is now it is not showing accurate result, actually i applying it to construct an image when i multiply left side by transpose of A the over all equation now unbalance how to cope this ?

Matt J

unread,
Dec 28, 2011, 5:16:08 AM12/28/11
to
"imi kh" <imran_...@hotmail.com> wrote in message <jdemuc$jh3$1...@newscl01ah.mathworks.com>...
>
>
> Thanks for reply, well i have did it but the problem is now it is not showing accurate result, actually i applying it to construct an image when i multiply left side by transpose of A the over all equation now unbalance how to cope this ?
===================

Have you checked to see whether the "inaccurate" result satisfies the original equations? If it does, you can only blame the equations that you wrote down.

Bruno Luong

unread,
Dec 28, 2011, 6:41:08 AM12/28/11
to
"imi kh" <imran_...@hotmail.com> wrote in message <jdemuc$jh3$1...@newscl01ah.mathworks.com>...

>
> Thanks for reply, well i have did it but the problem is now it is not showing accurate result, actually i applying it to construct an image when i multiply left side by transpose of A the over all equation now unbalance how to cope this ?

Your system has less unknown than equations. When multiplying it by A' then solving with cg method, you actually solve the least-squares problem, i.e., ,minimizing the l2 norm of the data residual (thus the equations are not exactly solved).

If this l2-norm is "unbalanced" (what ever it means) you might need need to rescale the rhs before forming the system of linear equations.

Bruno

imi kh

unread,
Dec 30, 2011, 2:18:08 AM12/30/11
to
"Bruno Luong" <b.l...@fogale.findmycountry> wrote in message <jdev8k$d25$1...@newscl01ah.mathworks.com>...
Well please provide me any example of this, it would be quite helpful for me

Greg Heath

unread,
Dec 30, 2011, 2:41:38 PM12/30/11
to
On Dec 28, 4:19 am, "imi kh" <imran_111...@hotmail.com> wrote:
> "Bruno Luong" <b.lu...@fogale.findmycountry> wrote in message <jdej6d$99...@newscl01ah.mathworks.com>...
> > "imi kh" <imran_111...@hotmail.com> wrote in message <jdeek4$q0...@newscl01ah.mathworks.com>...
> > > Hello
> > > I have sparse  matrix of size A= <36864x16641 double> and b= <36864x1 double>, i want to solve for x using conjugate gradient method, but it need A to be square, how i convert A to square matrix so that i can apply conjugate gradient method.
> > > BR
> > > Imi
>
> > Hint: multiply the linear system on its left side by transposed of A.
>
> > Bruno
>
> Thanks for reply, well i have did it but the problem is now it is not showing accurate result, actually i applying it to construct an image when i multiply left side by transpose of A the over all equation now unbalance how to cope this ?

I don't know exactly what you mean by unbalanced. However if you
scale your equations so that the maximum absolute value in every
row of the matrix is unity, you should get better results.

Hope this helps.

Greg

Steven_Lord

unread,
Dec 30, 2011, 11:51:22 PM12/30/11
to


"imi kh" <imran_...@hotmail.com> wrote in message
news:jdeek4$q0a$1...@newscl01ah.mathworks.com...
Do you absolutely need to use conjugate gradient? Why not just use backslash
(or if you need an iterative method, why not LSQR?)

http://www.mathworks.com/help/techdoc/ref/lsqr.html

--
Steve Lord
sl...@mathworks.com
To contact Technical Support use the Contact Us link on
http://www.mathworks.com

0 new messages