← Back to team overview

dolfin team mailing list archive

Re: [DOLFIN-DEV] Some Iterative Linear Solver Doubts.

 

On Thu, Sep 25, 2008 at 03:53:01PM +0100, Garth N. Wells wrote:
> 
> 
> Anders Logg wrote:
> > On Thu, Sep 25, 2008 at 03:11:27PM +0100, Garth N. Wells wrote:
> >>
> >> Anders Logg wrote:
> >>> On Thu, Sep 25, 2008 at 12:41:33PM +0100, Garth N. Wells wrote:
> >>>> Nuno David Lopes wrote:
> >>>>> Is there a simple way of setting an initial guess for an Iterative 
> >>>>> LinearSolver? 
> >>>>> In Umfpack and PETSc the default initial guess is the zero vector right?
> >>>> At the moment, yes (note the UMFPACK is an LU solver, so an initial 
> >>>> guess doesn't do anything).
> >>>>
> >>>> It's very simple, and I've been meaning to add an option for using an 
> >>>> initial guess. It's also useful for Newton solvers. I'll add something 
> >>>> in the next few days.
> >>>>
> >>>> Garth
> >>> It would be natural to let the x argument always be the initial
> >>> guess. I thought we already did this.
> >>>
> >>> Would it be enough to make sure that Vector::init() does not reset the
> >>> values to zero?
> >>>
> >> Yes.
> >>
> >> The danger is if someone sends an uninitialised vector to the solver.
> >>
> >> Garth
> > 
> > We can just put something like this in the init() functions:
> > 
> >   if (x && size() == N)
> >     return;
> > 
> > I think we had this a while back but at some point VecZeroEntries was
> > inserted.
> >
> 
> I think that we should have an option whether or not to use an initial 
> guess. The default can be to use the guess (as in your above code extract).
> 
> Garth

I think it would work nicely if the solver calls x.init() and that
will initialize x to a zero vector only if it has not already been
initialized. Then if someone wants to reset the initial guess between
solves, it's enough to do

  x.zero();

before calling solve().

-- 
Anders

Attachment: signature.asc
Description: Digital signature


Follow ups

References