Uploaded image for project: 'Commons Math'
  1. Commons Math
  2. MATH-613

Equivalent of Blas DAXPY

    XMLWordPrintableJSON

Details

    • New Feature
    • Status: Closed
    • Minor
    • Resolution: Fixed
    • 3.0
    • 3.0
    • None

    Description

      In Blas, the method DAXPY computes an in-place linear combination of two vectors. More precisely, a call to DAXPY(a, x, y) updates vector y with the value of a * x + y. This can lead to very compact code, which I feel the need for in Commons-Math. However, DAXPY also has its limitations. For example, it cannot perform the other combination y <- x + a * y.
      I think it would be useful that RealVector had a method for computing a * this + b * y, and storing the result in this. In the spirit of the mapToSelf method, I propose to create two new methods in Interface RealVector

      RealVector map(BivariateRealFunction f, RealVector y)

      and

      RealVector mapToSelf(BivariateRealFunction f, RealVector y)

      The former would return a new vector v such that

      v[i] <- f(this[i], y[i])}}

      and the latter would update this,

      this[i] <- f(this[i], y[i])

      Emulating DAXPY would then simply be a matter of implementing the appropriate bivariate function.
      While we are at it, how about

      RealVector map(TrivariateRealFunction f, RealVector y, RealVector z)
      RealVector mapToSelf(TrivariateRealFunction f, RealVector y, RealVector z)

      Attachments

        1. MATH-613-20110727.patch
          26 kB
          Sebastien Brisard
        2. MATH-613-20110727.patch
          25 kB
          Sebastien Brisard
        3. MATH-613-20110727.patch
          24 kB
          Sebastien Brisard

        Activity

          People

            Unassigned Unassigned
            celestin Sebastien Brisard
            Votes:
            0 Vote for this issue
            Watchers:
            0 Start watching this issue

            Dates

              Created:
              Updated:
              Resolved: