commons-issues mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "Luc Maisonobe (JIRA)" <>
Subject [jira] [Commented] (MATH-573) in ArrayFielVector i.e. subtract calls wrong constructor
Date Sat, 14 May 2011 10:05:49 GMT


Luc Maisonobe commented on MATH-573:

I have tried to specify field wherever it was possible. Thanks for the tip about removing
the constructor and fixing the errors. I have left many calls of the no-field constructors
in the tests, for testing purposes, there are no such calls left in the library itself.

We know ArrayFieldVector leaks out in the interface. This was on purpose when people already
know they want to use this implementation. They are however free to have different implementations
for storage, so the interface is also useful (but not to the same users). In fact, when we
have a method that returns a FieldVector in the interface, we should say it returns an ArrayFieldVector
in the implementation if we know this is what always happen. Implementing or overriding a
method with a narrowed return type is allowed by the Java language. We did not do it on all
methods, so I agree we are inconsistent here.

The two implementations of premultiply are different. One uses the generic getEntry methods
and the other uses direct array access. At that time, it was done for efficiency. We did not
benchmark it recently with new JVMs, but it may not be needed anymore. The usefulness of this
overriding is really JVM dependent.

> in ArrayFielVector i.e. subtract calls wrong constructor
> --------------------------------------------------------
>                 Key: MATH-573
>                 URL:
>             Project: Commons Math
>          Issue Type: Bug
>    Affects Versions: 3.0
>            Reporter: Arne Plöse
>            Priority: Minor
>             Fix For: 3.0
> I.E. subtract calls
> "return new ArrayFieldVector<T>(out)" this constructor clones the array...
> "return new ArrayFieldVector<T>(field, out, false)" would be better (preserving
field as well)

This message is automatically generated by JIRA.
For more information on JIRA, see:

View raw message