commons-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Phil Steitz <phil.ste...@gmail.com>
Subject Re: [math] comments on MATH-391
Date Sun, 03 Oct 2010 19:24:20 GMT
On 10/3/10 2:21 PM, Luc Maisonobe wrote:
> 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 ?

+1 - nice solution

Phil
>
> Luc
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: dev-unsubscribe@commons.apache.org
> For additional commands, e-mail: dev-help@commons.apache.org
>


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


Mime
View raw message