You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@commons.apache.org by Sébastien Brisard <se...@m4x.org> on 2011/09/07 04:19:53 UTC

[math] RealVector.toArray() vs. RealVector.getData()

Hi,
as noted in MATH-653, these two methods are redundant, and one should
go. Pros and cons are
* toArray() is fairly classical in the Java world
* but getData() is consistent with ArrayRealVector.getDataRef().
Personnaly, my preference goes to keeping toArray(). In order to
maintain consistency, should ArrayRealVector.getDataRef() be renamed
getArrayRef() ?

Sébastien

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


Re: [math] RealVector.toArray() vs. RealVector.getData()

Posted by Luc Maisonobe <Lu...@free.fr>.
Le 07/09/2011 08:27, Sébastien Brisard a écrit :
> True enough.
> Maybe the use of one those two could be strongly discouraged.
> I personally was puzzled the first time I saw those two methods. I was
> even wondering wether one of them would not return a shallow copy
> (when possible), while the other would return a deep copy. Had to look
> at the source to finally realize that toArray() and getData() do
> exactly the same thing.
> As for incompatible change, we are talking about 3.0, which gives us
> (that's how I understand it anyway) a little bit of liberty, as long
> as it improves the library.

You are right. We can introduce incompatible changes in 3.0 and in fact 
we will introduce many such changes here. I hope it will be for the 
better ...

Luc

> Sébastien
>
> 2011/9/7 Jochen Wiedmann<jo...@gmail.com>:
>> 2011/9/7 Sébastien Brisard<se...@m4x.org>:
>>> Hi,
>>> as noted in MATH-653, these two methods are redundant, and one should
>>> go. Pros and cons are
>>> * toArray() is fairly classical in the Java world
>>> * but getData() is consistent with ArrayRealVector.getDataRef().
>>> Personnaly, my preference goes to keeping toArray(). In order to
>>> maintain consistency, should ArrayRealVector.getDataRef() be renamed
>>> getArrayRef() ?
>>
>> Another Con; INcompatible change, which should be avoided, if
>> possible. Redundancy is not a compelling reason for such changes.
>>
>> --
>> Capitalism is the astounding belief that the most wickedest of men
>> will do the most wickedest of things for the greatest good of
>> everyone.
>>
>> John Maynard Keynes (http://en.wikiquote.org/wiki/Keynes)
>>
>> https://linuxcounter.net/user/221257.html
>>
>> ---------------------------------------------------------------------
>> 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
>
>


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


Re: [math] RealVector.toArray() vs. RealVector.getData()

Posted by Sébastien Brisard <se...@m4x.org>.
True enough.
Maybe the use of one those two could be strongly discouraged.
I personally was puzzled the first time I saw those two methods. I was
even wondering wether one of them would not return a shallow copy
(when possible), while the other would return a deep copy. Had to look
at the source to finally realize that toArray() and getData() do
exactly the same thing.
As for incompatible change, we are talking about 3.0, which gives us
(that's how I understand it anyway) a little bit of liberty, as long
as it improves the library.
Sébastien

2011/9/7 Jochen Wiedmann <jo...@gmail.com>:
> 2011/9/7 Sébastien Brisard <se...@m4x.org>:
>> Hi,
>> as noted in MATH-653, these two methods are redundant, and one should
>> go. Pros and cons are
>> * toArray() is fairly classical in the Java world
>> * but getData() is consistent with ArrayRealVector.getDataRef().
>> Personnaly, my preference goes to keeping toArray(). In order to
>> maintain consistency, should ArrayRealVector.getDataRef() be renamed
>> getArrayRef() ?
>
> Another Con; INcompatible change, which should be avoided, if
> possible. Redundancy is not a compelling reason for such changes.
>
> --
> Capitalism is the astounding belief that the most wickedest of men
> will do the most wickedest of things for the greatest good of
> everyone.
>
> John Maynard Keynes (http://en.wikiquote.org/wiki/Keynes)
>
> https://linuxcounter.net/user/221257.html
>
> ---------------------------------------------------------------------
> 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


Re: [math] RealVector.toArray() vs. RealVector.getData()

Posted by Jochen Wiedmann <jo...@gmail.com>.
2011/9/7 Sébastien Brisard <se...@m4x.org>:
> Hi,
> as noted in MATH-653, these two methods are redundant, and one should
> go. Pros and cons are
> * toArray() is fairly classical in the Java world
> * but getData() is consistent with ArrayRealVector.getDataRef().
> Personnaly, my preference goes to keeping toArray(). In order to
> maintain consistency, should ArrayRealVector.getDataRef() be renamed
> getArrayRef() ?

Another Con; INcompatible change, which should be avoided, if
possible. Redundancy is not a compelling reason for such changes.

-- 
Capitalism is the astounding belief that the most wickedest of men
will do the most wickedest of things for the greatest good of
everyone.

John Maynard Keynes (http://en.wikiquote.org/wiki/Keynes)

https://linuxcounter.net/user/221257.html

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


Re: [math] RealVector.toArray() vs. RealVector.getData()

Posted by Arne Ploese <ap...@gmx.de>.
I would introduce getArrayRef(), which makes clear what exactly happen.
It is after all the same like spares/dense discussion ...

Arne

Am Mittwoch, den 07.09.2011, 08:11 +0200 schrieb Sébastien Brisard: 
> In fact, getArrayRef does not belong to the RealVector class. It is
> only defined in ArrayRealVector (which is backed by a double[]).
> Sébastien



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


Re: [math] RealVector.toArray() vs. RealVector.getData()

Posted by Sébastien Brisard <se...@m4x.org>.
In fact, getArrayRef does not belong to the RealVector class. It is
only defined in ArrayRealVector (which is backed by a double[]).
Sébastien

2011/9/7 Arne Ploese <ap...@gmx.de>:
> If toArray() returns always a copy and if getArrayRef() throws an
> exception if there is no backing array, it would be much clearer. A
> property isArray() is needed in this case.
>
> Arne
>
> Am Mittwoch, den 07.09.2011, 04:19 +0200 schrieb Sébastien Brisard:
>> Hi,
>> as noted in MATH-653, these two methods are redundant, and one should
>> go. Pros and cons are
>> * toArray() is fairly classical in the Java world
>> * but getData() is consistent with ArrayRealVector.getDataRef().
>> Personnaly, my preference goes to keeping toArray(). In order to
>> maintain consistency, should ArrayRealVector.getDataRef() be renamed
>> getArrayRef() ?
>>
>> Sébastien
>>
>> ---------------------------------------------------------------------
>> 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
>
>

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


Re: [math] RealVector.toArray() vs. RealVector.getData()

Posted by Arne Ploese <ap...@gmx.de>.
If toArray() returns always a copy and if getArrayRef() throws an
exception if there is no backing array, it would be much clearer. A
property isArray() is needed in this case.

Arne

Am Mittwoch, den 07.09.2011, 04:19 +0200 schrieb Sébastien Brisard: 
> Hi,
> as noted in MATH-653, these two methods are redundant, and one should
> go. Pros and cons are
> * toArray() is fairly classical in the Java world
> * but getData() is consistent with ArrayRealVector.getDataRef().
> Personnaly, my preference goes to keeping toArray(). In order to
> maintain consistency, should ArrayRealVector.getDataRef() be renamed
> getArrayRef() ?
> 
> Sébastien
> 
> ---------------------------------------------------------------------
> 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