On Sun, Dec 30, 2012 at 12:16 PM, Konstantin Berlin <kber...@gmail.com>wrote:

>
> ...
> > There would be no burden on the user's side: the visitor pattern has been
> > implemented for RealVectors in version 3.1. Besides, we could provide all
> > the relevant visitors (addition, scaling, …)
>
> There is an additional burden to the user, since if you require
> implementation of the full RealVector or RealMatrix interface, which
> includes a large set of functions not need for the optimizer, since the
> user has no idea which function you will use inside the optimizer and which
> he can leave blank. For example, if a user needs to create their own
> implementation of a vector multiplication, because they have a special case
> which can be handled faster, or because they use a GPU, they are still
> burdened with implementing unnecessary support for the dozens of others
> functions which will never be used. For a GPU example, like Ted has
> pointed out, they can implement a GPU version for basic operations (add,
> multi, etc), but to guarantee general support for any Java function using
> the visitor pattern the user would also need to implement a Java version of
> the visitor pattern.
>


With a good abstract class to inherit from, this isn't much of a problem in
practice.  You should need to implement very little and you should be able
to over-ride what you will without much danger.

It also helps to have standardized tests that can pretty exhaustively test
new implementations for correctness.  To a surprising extent, this allows
new implementations to be well tested nearly on the day they are written.

Reply via email to