Hi Wolfgang, Thank you for the detailed explanation! Actually what I want to do is to evaluate the inverse of a lumped diagonal matrix to mimic the matrix inverse. Anyway, I will write my own loop to avoid using ratio(). Thanks again!
Feimi On Monday, May 14, 2018 at 10:23:12 AM UTC-4, Wolfgang Bangerth wrote: > > On 05/12/2018 12:02 PM, Feimi Yu wrote: > > > > I'm currently using the ratio function for PETSc vectors to compute > vector > > inverse in my parallel code. However, it looks like that ratio() is > > deprecated. I know there is a potential floating point exception due to > > the undefined behavior when the denominator vector contains zero > (because > > PETSc's corresponding function does not check that I guess?). I would > like > > to know if there would be a substitute or new version of this function > > after it is completely removed. > > Feimi, > I don't think there is a replacement function. You will have to write this > operation as a loop over the (locally owned) elements of a vector. > > The vector classes have a large interface that has many member functions > that > are difficult to implement if one wants to add new vector classes (for > example > interfaces to other libraries). A few years ago we went through the > existing > interfaces and tries to classify what are the important functions and > which > ones could be removed. We then tried to separate functions into those that > provide element access (i.e., that are specific to a particular *basis* > for > the vector space) and ones that just represent abstract vector space > concepts > like addition, multiplication by a scalar, dot product, etc. The two > abstract > base classes that represent this are ReadWriteVector and > VectorSpaceVector. > > The ratio() function does not fit this pattern. Taking the ratio of two > vectors is not a vector-space operation but instead depends on a > particular > basis. On the other hand, it is an operation that is applied to all > elements > of a vector at the same time. It is also a rather uncommon operation (your > particular use notwithstanding). So we decided that we should probably > just > get rid of it. It is, after all, easy enough to implement by hand. > > Best > W. > > -- > ------------------------------------------------------------------------ > Wolfgang Bangerth email: [email protected] > <javascript:> > www: http://www.math.colostate.edu/~bangerth/ > > -- The deal.II project is located at http://www.dealii.org/ For mailing list/forum options, see https://groups.google.com/d/forum/dealii?hl=en --- You received this message because you are subscribed to the Google Groups "deal.II User Group" group. To unsubscribe from this group and stop receiving emails from it, send an email to [email protected]. For more options, visit https://groups.google.com/d/optout.
