commons-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Luc Maisonobe <>
Subject [math] comments on MATH-391
Date Sun, 03 Oct 2010 18:21:53 GMT
Hi all,

I have fixed MATH-391. Now vectors can be built with 0 length using
several constructors.

There is however one remaining problem, for Field-based vectors (i.e.
ArrayFieldVector). For these vectors, we need to store the field in
addition to the vector components. For example a Fraction Vectors also
stores a reference to FractionField. When a vector is built from a non
empty array, the field can be retrieved from the first element, using
d[0].getField(). Since 0 length vectors are now allowed, I add to create
additional constructors that pass the field as an additional constructor
parameter. This is much cleaner than the previous choice.

Since the field is mainly a compile-time constant for a given program
(people now when they use Fraction or Complex or Dfp), I would like to
deprecate the former constructors in 2.2 and remove them in 3.0. This
means someone building a Fraction vector would use:

  Fraction[] data = ...;
  ArrayFieldVector<Fraction> vector =
    new ArrayFieldVector<Fraction>(FractionField.getInstance(),
                                   data, false);

instead of:

  Fraction[] data = ...;
  ArrayFieldVector<Fraction> vector =
    new ArrayFieldVector<Fraction>(data, false);

which don't work for zero-length.

What do you think about this proposed deprecation ?


To unsubscribe, e-mail:
For additional commands, e-mail:

View raw message