[Trilinos-Users] Thyra::scale interface changes

Bartlett, Roscoe A. bartlettra at ornl.gov
Tue Dec 11 15:46:44 MST 2012


Sorry, Appendix A of:

    http://www.ornl.gov/~8vt/TeuchosMemoryManagementSAND.pdf

-Ross

> -----Original Message-----
> From: trilinos-users-bounces at software.sandia.gov [mailto:trilinos-users-
> bounces at software.sandia.gov] On Behalf Of Bartlett, Roscoe A.
> Sent: Tuesday, December 11, 2012 5:00 PM
> To: 'Hoemmen, Mark'; <trilinos-users at software.sandia.gov>
> Cc: Day, David
> Subject: Re: [Trilinos-Users] Thyra::scale interface changes
> 
> Thyra follows the safe memory management conventions defined in:
> 
> 
> http://trilinos.sandia.gov/packages/docs/dev/packages/thyra/doc/html/clas
> sThyra_1_1MultiVectorBase.html
> 
> See a summary in Appendix A.
> 
> -Ross
> 
> > -----Original Message-----
> > From: trilinos-users-bounces at software.sandia.gov [mailto:trilinos-users-
> > bounces at software.sandia.gov] On Behalf Of Hoemmen, Mark
> > Sent: Tuesday, December 11, 2012 4:56 PM
> > To: <trilinos-users at software.sandia.gov>
> > Cc: Day, David
> > Subject: [Trilinos-Users] Thyra::scale interface changes
> >
> > On Dec 11, 2012, at 11:22 AM, <trilinos-users-
> request at software.sandia.gov>
> >  wrote:
> > > From: David Day <dmday at sandia.gov<mailto:dmday at sandia.gov>>
> > > Date: Tuesday, December 11, 2012 11:52 AM
> > > To: "trilinos-users-bounces at software.sandia.gov<mailto:trilinos-users-
> > bounces at software.sandia.gov>" <trilinos-users-
> > bounces at software.sandia.gov<mailto:trilinos-users-
> > bounces at software.sandia.gov>>
> > > Subject: teuchos
> > >
> > > I am trying to upgrade from an old version of Trilinos to a new version of
> > Trilinos.
> > >
> > >
> > > void aXDpbY(
> > >    Real alpha,
> > >    const Thyra::MultiVectorBase<Real> &X_r,
> > >    const Thyra::MultiVectorBase<Real> &X_i,
> > >    std::vector<Real> &D_r,
> > >    std::vector<Real> &D_i,
> > >    Real beta,
> > >    Thyra::MultiVectorBase<Real> &Y_r,
> > >    Thyra::MultiVectorBase<Real> &Y_i)
> > > {
> > >  // (x_r + i*x_i)*(d_r + i*d_i)
> > >  // = (x_r*d_r - x_i*d_i)
> > >  // + i*(x_r*d_i + x_i*d_r)
> > >
> > >  // Y_r = beta*Y_r + alpha*X_r*D_r - alpha*X_i*D_i
> > >  //Thyra::scale(beta,&Y_r);   // old Trilinos   ,  this is what used to work
> > >  Thyra::scale(beta,Y_r.col(0).ptr());  //   This is what compiles now.
> > > ?
> > >
> > >
> > > Is this the right way to pass a multi ? vector to Thyra::scale ?
> >
> >
> > This is acceptable if Y_r only has one column.  Otherwise, it will only scale
> the
> > first column of Y_r.
> >
> > The issue is that Thyra's nonmember functions (like Thyra::scale()) used to
> > accept raw pointers in some cases.  This has been deprecated for a long
> time,
> > and was removed in the 11.0 release.
> >
> > You can fix this by passing a Ptr<MultiVectorBase<Real> > instead of a
> > MultiVectorBase<Real>*.  In your example, this would be:
> >
> > Thyra::scale (beta, Teuchos::ptr (&Y_r));
> >
> > The interface changed because in debug mode, Ptr<T> checks whether the
> > T* is NULL before dereferencing.  (I would have preferred passing in a T&
> > instead of a Ptr<T>, but it wasn't my decision.)
> >
> > Hope this helps!  Please feel free to ask any more questions you might
> have
> > about this.
> >
> > mfh
> >
> >
> > _______________________________________________
> > Trilinos-Users mailing list
> > Trilinos-Users at software.sandia.gov
> > http://software.sandia.gov/mailman/listinfo/trilinos-users
> 
> 
> 
> _______________________________________________
> Trilinos-Users mailing list
> Trilinos-Users at software.sandia.gov
> http://software.sandia.gov/mailman/listinfo/trilinos-users





More information about the Trilinos-Users mailing list