commons-issues mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From S├ębastien Brisard (Commented) (JIRA) <>
Subject [jira] [Commented] (MATH-717) A varied class of Array2DRowRealMatrix is needed to contain float type instead of double.
Date Wed, 14 Dec 2011 14:19:30 GMT


S├ębastien Brisard commented on MATH-717:

If I'm not mistaken, that would mean a complete copy/paste of the code of the class (and its
parents), replacing "double" by "float". This is easy to do once; not nearly as easy to maintain!
I think you're right: from this perspective {{ImageJ}} (to name but one) is a little bit of
a nightmare (byte images, short images, float images, and so on...). It's such a shame that
type parameters require Objects, and not primitive types...

Another thing to be aware is that if the "float" implementation exists, users might start
to ask for other classes in the "linear" package to be converted (e.g. the "...Decomposition"
Actually, I didn't think of that, Gilles, and you convinced me: I was +0 and am now -1.

While writing this post, I'm wondering whether using {{FieldMatrix}} could be an option. For
other purposes, I have implemented doubles and floats as {{FieldElements}}. If required, I
can polish up these implementations, and contribute them. However, I suspect that the memory
footprint of such an object would be larger than that of a primitive {{double}} so that's
probably not the answer you're expecting, Dusan.

To sum up, Dusan, here is another answer you might not like: you could try and implement the
proposed class yourself, and use it locally, without it being included into CM? I'm sure we
would be able to give you a little hand if needed (but I'm also sure it *won't* be needed).
> A varied class of Array2DRowRealMatrix is needed to contain float type instead of double.
> -----------------------------------------------------------------------------------------
>                 Key: MATH-717
>                 URL:
>             Project: Commons Math
>          Issue Type: Improvement
>    Affects Versions: 2.2
>         Environment: All
>            Reporter: Dusan Ku
>              Labels: features
> The current implementation of Array2DRowRealMatrix takes only double type as its base
element value in the matrix.
> However, the memory size of double is bigger than float, the downside of which makes
the matrix dimension quite limited, compared to float type as its base element type. For small
sized problem, this does not make such a big difference, but for large problems, this limits
the usability of this library quite severely. In my case, I easily hit an error even after
I increase the memory option to 1G. This could have been much more enhanced just by using
'float[][]' instead of the current Array2DRowRealMatrix.
> Therefore, the solution I may suggest is to add another class similar to Array2DRowRealMatrix
containing float type for its matrix variable instead of double. Of course, a better way is
welcome as long as the needs can be fulfilled.

This message is automatically generated by JIRA.
If you think it was sent incorrectly, please contact your JIRA administrators:!default.jspa
For more information on JIRA, see:


View raw message