1. petsc
  2. PETSc
  3. petsc
  4. Issues
Issue #14 resolved

Add optional scalar value argument to VecMAXPY(), fix all places in code that depend on it.

Jed Brown
created an issue

No description provided.

Comments (4)

  1. BarryFSmith

    There are a bunch of cases where the alpha are multiplied by -1 before being passed to VecMAXPY() maybe a 1/3 to 1/2 the uses in KSP

    There are other cases (in TS) where the alpha are multipled by h before being passed to VecMAXPY()

    Is this change simply to make the calling code simplier and not require the scaling of the alpha initially? Note that to implement the new API efficiently essentially one would scale the alpha on entry and scale them back on exit. No more efficient then today and less efficient when they are not used later and do not need to be scaled back. Is there another way to implement this efficiently?

    I question if this change is for the better good?

  2. Jed Brown reporter
    1. This was one of the "projects" that I transplanted into this issue tracker.

    2. I assumed that the proposal was for a scalar value to be multiplied by Y, yielding the operation

        Y = b*Y + a[0]*X[0] + a[1]*X[1] + ...
    

    not simply an extra scalar factor to distribute across a. This operation currently requires streaming Y through cache one more time than necessary.

  3. BarryFSmith

    I searched all uses in PETSc and found

    two cases of Y <-- bZ + a[0]X[0] + a[1]*X[1] + ... in a nonlinear solver

    many cases of Y <-- Z + a[0]X[0] + a[1]X[1] + ... in TS implemented as VecCopy(Z,Y) followed by VecMAXPY(Y,....)

    and many cases of Y <-- 0 + a[0]X[0] + a[1]X[1] + ... in TS and other places implemented as VecSet(Y,0.0) followed by VecMAXPY(Y,.....)

    plus the usual Y <-- Y + a[0]X[0] + a[1]X[1] + ...

    never a Y <-- bY + a[0]X[0] + a[1]*X[1] + ...

  4. Log in to comment