You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@commons.apache.org by Ole Ersoy <ol...@gmail.com> on 2015/12/26 23:21:04 UTC

[math] Thread safe RealVector

Hi,

What do you think of removing iterator(), Entry, and Iterator() from RealVector?  ArrayRealVector can replace these with Vector...I think...Still need to attempt it.  Vector is synchronized so it makes it easier to make ArrayRealVector thread safe.

Cheers,
Ole


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


Re: [math] Thread safe RealVector

Posted by Ole Ersoy <ol...@gmail.com>.

On 12/26/2015 05:22 PM, Gilles wrote:
> On Sat, 26 Dec 2015 16:21:04 -0600, Ole Ersoy wrote:
>> Hi,
>>
>> What do you think of removing iterator(), Entry, and Iterator() from
>> RealVector?  ArrayRealVector can replace these with Vector...I
>> think...Still need to attempt it.  Vector is synchronized so it makes
>> it easier to make ArrayRealVector thread safe.
>
> I don't follow at all.
We're in the same boat :).  I've only half baked my thinking at this point, but java.util.Vector is synchronized, uses a 0 based index, and throws ConcurrentModificationException if it is modified while it is being iterated over, so it would provide thread safety for operations like add(RealVector v).  It also provides a lot of the modification methods provided by RealVector like append, getSubVector, etc....Although they are named differently.  But I think utilities that performs Matrix / Vector operations might be better(Thinking out loud).  For example:

Vector.add(final double[] v1 , final double[] v2) {
     //validate
     //operate
     //return brand new array.
}

That's thread safe without even trying :).

But anyways, please have a look at the long-standing issue on JIRA concerning
> the refactoring of RealVector/RealMatrix.
Will do.
https://issues.apache.org/jira/browse/MATH-765

Just did.  I think it's better to just skip the whole thing and separate the pieces into:
1) Structure:
     One dimensional or two dimensional arrays
2) Structure Manipulation:
     Manipulate one dimensional or two dimensional arrays
3) Operations (Like above Vector.add(), Matrix.add())

Cheers,
Ole


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


Re: [math] Thread safe RealVector

Posted by Gilles <gi...@harfang.homelinux.org>.
On Sat, 26 Dec 2015 16:21:04 -0600, Ole Ersoy wrote:
> Hi,
>
> What do you think of removing iterator(), Entry, and Iterator() from
> RealVector?  ArrayRealVector can replace these with Vector...I
> think...Still need to attempt it.  Vector is synchronized so it makes
> it easier to make ArrayRealVector thread safe.

I don't follow at all.
But anyways, please have a look at the long-standing issue on JIRA 
concerning
the refactoring of RealVector/RealMatrix.

A thing to consider that RealVector actually represents a 1-column or 
1-row
matrix, and not a geometrical vector (or only a Cartesian vector).

Gilles


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