On 02/01/2009, Luc Maisonobe <[email protected]> wrote:
> Phil Steitz a écrit :
>
> > I am still working through this class and the sparse matrix class that
>  > it was extracted from (thanks, Ismael and Sugit!), so I am not sure if
>  > changing this would cause problems, but the current setup (returning 0
>  > for missing keys) limits usefulness of this class.   I see how this is
>  > convenient for sparse matrices; but I would see NaN as a more natural
>  > return value for non-existent keys in the general case.  Alternatively,
>  > I guess we could add another method get(int key, double missingReturn).
>  >
>  > Thoughts?
>
>
> I had exactly the same thought while extracting the class.
>  I also prefer to use Double.NaN for numbers that have never been
>  initialized explicitly, but I also understand 0 is more logical in the
>  special case of sparse matrices.

+0 (I never used Math, but seems sensible)

>  What about having a configurable value for missing entries ? It should
>  probably be configured at construction time (with a default value to
>  Double.NaN if not specified) and never changed afterwards. In the case
>  of sparse matrices, we should configure this value to 0.0.

+1 to never changing the value - making it final would be best for
thread safety.

>
>  Luc
>
>
>  >
>  > Phil
>  >
>  > ---------------------------------------------------------------------
>  > To unsubscribe, e-mail: [email protected]
>  > For additional commands, e-mail: [email protected]
>  >
>
>
>  ---------------------------------------------------------------------
>  To unsubscribe, e-mail: [email protected]
>  For additional commands, e-mail: [email protected]
>
>

---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]

Reply via email to