Re: [Numpy-discussion] Numpy and iterative procedures
![](https://secure.gravatar.com/avatar/3b4bc97263233a14fef6221dcdfabd91.jpg?s=120&d=mm&r=g)
Thanks Chuck. I am trying to use Successive Over-relaxation to solve linear equations defined by M*v=3Dq. There are several goals: 1. Eventually (in production) I need it to be fast. 2. I am playing with the guts of the algorithm for now, to see how it works. that means i need some control for now. 3. Even in production, there is a chance i'd like to have the ability to tinker with the algorithm. _____ From: numpy-discussion-bounces@scipy.org [mailto:numpy-discussion-bounces@scipy.org] On Behalf Of Charles R Harris Sent: Thursday, February 15, 2007 10:11 AM To: Discussion of Numerical Python Subject: Re: [Numpy-discussion] Numpy and iterative procedures On 2/15/07, Geoffrey Zhu <gzhu@peak6.com> wrote: Hi, I am new to numpy. I'd like to know if it is possible to code efficient iterative procedures with numpy. Specifically, I have the following problem. M is an N*N matrix. Q is a N*1 vector. V is an N*1 vector I am trying to find iteratively from the initial value V_0. The procedure is simply to calculate V_{n+1}[i]=3D3D1/M[I,i]*(q[i]- (M[i,1]*v_{n+1}[1]+M[I,2]*v_{n+1}[2]+..+M[i,i-1]*v_{n+1}[i-1]) - (M[I,i+1]*v_{n}[i+1]+M[I,i+2]*v_{n}[i+2]+..+M[I,N]*v_{n}[N])) I do not see that this is something that can esaily be vectorized, is it? I think it would be better if you stated what the actual problem is. Is it a differential equation, for instance. That way we can determine what the problem class is and what algorithms are available to solve it. Chuck _______________________________________________________=0A= =0A= The information in this email or in any file attached=0A= hereto is intended only for the personal and confiden-=0A= tial use of the individual or entity to which it is=0A= addressed and may contain information that is propri-=0A= etary and confidential. If you are not the intended=0A= recipient of this message you are hereby notified that=0A= any review, dissemination, distribution or copying of=0A= this message is strictly prohibited. This communica-=0A= tion is for information purposes only and should not=0A= be regarded as an offer to sell or as a solicitation=0A= of an offer to buy any financial product. Email trans-=0A= mission cannot be guaranteed to be secure or error-=0A= free. P6070214=0A=
![](https://secure.gravatar.com/avatar/612395b66b3e7959997007b342b3688a.jpg?s=120&d=mm&r=g)
Geoffrey Zhu wrote:
Thanks Chuck.
I am trying to use Successive Over-relaxation to solve linear equations defined by M*v=q.
AFAIK, splitting methods are not the best methods to solve a system of linear equations, iteratively. What can be said about your coefficient matrix M ? Is it spd (symmetric positive definite) ? In that case I suggest to use cg. Anyway, you may try the following solvers which are available in scipy Iterative linear systems solutions cg --- Conjugate gradient (symmetric systems only) cgs --- Conjugate gradient squared qmr --- Quasi-minimal residual gmres --- Generalized minimal residual bicg --- Bi-conjugate gradient bicgstab --- Bi-conjugate gradient stabilized Nils
There are several goals:
1. Eventually (in production) I need it to be fast. 2. I am playing with the guts of the algorithm for now, to see how it works. that means i need some control for now. 3. Even in production, there is a chance i'd like to have the ability to tinker with the algorithm.
------------------------------------------------------------------------ *From:* numpy-discussion-bounces@scipy.org [mailto:numpy-discussion-bounces@scipy.org] *On Behalf Of *Charles R Harris *Sent:* Thursday, February 15, 2007 10:11 AM *To:* Discussion of Numerical Python *Subject:* Re: [Numpy-discussion] Numpy and iterative procedures
On 2/15/07, *Geoffrey Zhu* <gzhu@peak6.com <mailto:gzhu@peak6.com>> wrote:
Hi,
I am new to numpy. I'd like to know if it is possible to code efficient iterative procedures with numpy.
Specifically, I have the following problem.
M is an N*N matrix. Q is a N*1 vector. V is an N*1 vector I am trying to find iteratively from the initial value V_0. The procedure is simply to calculate
V_{n+1}[i]=3D1/M[I,i]*(q[i]- (M[i,1]*v_{n+1}[1]+M[I,2]*v_{n+1}[2]+..+M[i,i-1]*v_{n+1}[i-1]) - (M[I,i+1]*v_{n}[i+1]+M[I,i+2]*v_{n}[i+2]+..+M[I,N]*v_{n}[N]))
I do not see that this is something that can esaily be vectorized, is it?
I think it would be better if you stated what the actual problem is. Is it a differential equation, for instance. That way we can determine what the problem class is and what algorithms are available to solve it.
Chuck
------------------------------------------------------------------------
The information in this email or in any file attached hereto is intended only for the personal and confidential use of the individual or entity to which it is addressed and may contain information that is proprietary and confidential. If you are not the intended recipient of this message you are hereby notified that any review, dissemination, distribution or copying of this message is strictly prohibited. This communication is for information purposes only and should not be regarded as an offer to sell or as a solicitation of an offer to buy any financial product. Email transmission cannot be guaranteed to be secure or error-free. P6070214 ------------------------------------------------------------------------
_______________________________________________ Numpy-discussion mailing list Numpy-discussion@scipy.org http://projects.scipy.org/mailman/listinfo/numpy-discussion
participants (2)
-
Geoffrey Zhu
-
Nils Wagner