"Phil Steitz" <phil.ste...@gmail.com> wrote in message 
news:497ee914.7010...@gmail.com...
> Bill Barker wrote:
>> I've been working on a SparseRealVector that implements RealVector but is 
>> backed by OpenIntToDoubleHashMap.  Unlike SparseRealMatrix, the goal is 
>> more speed than space.  Mostly it is going well, but running into a few 
>> problems where some RealVector methods are almost nonsensical for sparse 
>> vectors (e.g. mapInvToSelf).
>>
>> Since the default value of OpenIntToDoubleHashMap is final, this means 
>> that I currently have to replace the map in this case (so it really isn't 
>> 'self' afterwards).  So what i'm asking is if it is better to have the 
>> default value mutable or to allow the backing to be replaced in a 
>> "*ToSelf" method.
>>
>>
> I don't understand the question.  Is it that different *ToSelf methods 
> require different missingEntries values?  I don't follow how that could be 
> the case.  In any case, the question has me thinking that at least 
> OpenIntToDoubleHashMap should expose a getter for missingEntries.  I agree 
> with Luc though that this field should not be mutable.
>

Well, to preserve sparseness, mapInvToSelf (x -> 1/x) should be infinity, 
mapLogToSelf should be -infinity, mapCosToSelf should be 1, etc.

However, the more I think about it, preserving sparseness is looking like 
more trouble than it is worth to support methods that don't make sense if 
you are using a sparse vector in the first place.  I'll probably just cause 
the vector to become dense for these methods.

I'm +1 for OpenInToDoubleHashMap exposing a getter for missingEntries, but 
it doesn't look like my class will have a use case for it.

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




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

Reply via email to