[SciPy-user] Dealing with Large Data Sets

Damian Eads eads@soe.ucsc....
Sat May 10 15:27:07 CDT 2008


Damian Eads wrote:

> which perform the operations in an in-place fashion. If data.sum(axis = 
> 2) is large, preallocate an array to store the sum,
> 
>    # for summing over columns
>    sum_result = numpy.zeros(data.shape[0:2])

I meant to include

    data **= 2
    np.sum(data, axis=2, out=sum_result)

which does an in-place, element-wise exponentiate, sums over the 
columns, and stores the result in sum_result.

Damian


More information about the SciPy-user mailing list