
"DS" == Daehyok Shin <sdhyok@email.unc.edu> writes:
DS> When I initialize an array, I use a = ones(shape)*initial_val DS> But, I am wondering if Numpy has more efficient way. For example, DS> a = array(initial_value, shape) Looking at the definition of "ones": def ones(shape, typecode='l', savespace=0): """ones(shape, typecode=Int, savespace=0) returns an array of the given dimensions which is initialized to all ones. """ return zeros(shape, typecode, savespace)+array(1, typecode) It looks like you could try a=zeros(shape)+initial_val instead. Hm.. I might do some experimenting. Rob -- ===== rob@hooft.net http://www.hooft.net/people/rob/ ===== ===== R&D, Nonius BV, Delft http://www.nonius.nl/ ===== ===== PGPid 0xFA19277D ========================== Use Linux! =========