Statistical Calculations

Hi,

I am fetching very large data sets out of a database.

The values that I am fetching are doubles.

I am wanting to know what sort of array would be most suitable for speed and memory consumption for iterating through to do calculations like mean, max, median, mode, min, std dev etc.

Currently I am using ArrayList - can anyone tell me if this is suitable or if I can gain any extra performance by using something else like hash maps?

Thanks

[480 byte] By [ianrippinga] at [2007-11-27 8:59:18]
# 1

> I am wanting to know what sort of array would be most

There is only one sort of array.

> suitable for speed and memory consumption for

> iterating through to do calculations like mean, max,

> median, mode, min, std dev etc.

>

> Currently I am using ArrayList - can anyone tell me

Which isn't an array but an array-backed List.

> if this is suitable or if I can gain any extra

> performance by using something else like hash maps?

Performance for just iterating over the whole thing? No. Won't be faster than an ArrayList, except for maybe a normal array since you avoid one method call.

Actually, if you have a double[], it should surely be preferred to an ArrayList<Double>, because you can avoid autoboxing that way.

CeciNEstPasUnProgrammeura at 2007-7-12 21:26:30 > top of Java-index,Java Essentials,Java Programming...
# 2
I've made something very similar and used arrays of doubles.Manuel Leiria
manuel.leiriaa at 2007-7-12 21:26:31 > top of Java-index,Java Essentials,Java Programming...
# 3
> ... to do calculations like mean, max,> median, mode, min, std dev etc. ...You can do it yourself, or use some existing API, like this one: http://jakarta.apache.org/commons/math/
prometheuzza at 2007-7-12 21:26:31 > top of Java-index,Java Essentials,Java Programming...