On Thu, Sep 25, 2008 at 04:18:23PM +0100, Garth N. Wells wrote: > > > Anders Logg wrote: > > 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. > > Sounds a bit dangerous to me that Vector::init() sometimes zeroes a the > vector, and sometimes it doesn't. Should we get rid of Vector::init() > and use Vector::resize() and Vector::zero() instead? No ambiguity then. > > Garth
That sounds good. -- Anders
signature.asc
Description: Digital signature
_______________________________________________ DOLFIN-dev mailing list [email protected] http://www.fenics.org/mailman/listinfo/dolfin-dev
