On Tue, Nov 27, 2012 at 04:44:27AM +0100, Sébastien Brisard wrote:
> Hi,
> 
> 
> 2012/11/27 Gilles Sadowski <gil...@harfang.homelinux.org>
> 
> > Hello.
> >
> > > > > in MATH-803 [1] it was decided to deprecate
> > > > RealVector.ebeMultiply/Divide,
> > > > > because these methods were difficult to support with sparse vectors.
> > > > > However, in MATH-870, we decided to deprecate sparse vectors
> > altogether.
> > > > >
> > > > > I'm therefore having second thoughts on MATH-803. Since the
> > problematic
> > > > > implementations of RealVector are removed, why not keep these quite
> > handy
> > > > > methods?
> >
> > The goal was also to "clean up" the matrix and vector implementations.
> >
> > True, but all good scientific packages (matlab, scilab, numpy) have these
> operations. If we do not keep them in the interface of RealVector (which
> I'm OK about), we need to provide a clean alternative. At the moment,
> visitors are not clean.

Is "ebeDivide" a (mathematical) "vector" operation?
IMHO, it's an operation on 2 lists of values.

> 
> 
> > I'd rather suggest to add such features in the "MathArrays" class:
> > -----
> > public static double[] ebeDivide(double[] numer,
> >                                  double[] denom) {
> >   if (numer.length != denom.length) {
> >     throw new DimensionMismatchException(numer.length, denom.length);
> >   }
> >
> >   final double[] result = numer.clone();
> >   for (int i = 0; i < numer.length; i++) {
> >     result[i] /= denom[i];
> >   }
> >
> >   return result;
> > }
> > -----
> >
> 
> I'm not adverse to the idea, but actually, cleaning recently took place the
> other way round. In RealVector, we removed all methods which took an array
> in place of a vector, since constructing an ArrayRealVector from an array
> is almost costless (using the right constructor).

So?
This method is to be placed in "MathArrays", not "RealVector". Then, it
would be used (e.g. in "JacobiPreconditioner") as:
-----
public RealVector operate(final RealVector x) {
  // Dimension check is carried out by ebeDivide
  // return x.ebeDivide(diag); // XXX deprecated.
  return new ArrayRealVector(MathArrays.ebeDivide(x.toArray(),
                                                  diag.toArray()),
                             false);
}
-----


Regards,
Gilles

---------------------------------------------------------------------
To unsubscribe, e-mail: dev-unsubscr...@commons.apache.org
For additional commands, e-mail: dev-h...@commons.apache.org

Reply via email to