[Numpy-discussion] how to create a matrix based on a vector?

frank wang f.yw@hotmail....
Mon Dec 8 11:27:01 CST 2008


Hi,
 
I want to create a matrix based on a vector. It is difficult to describe the issue for me in english. Here is an example. 
 
Suppose I have an array([3, 6, 8, 12]), I want to create a range based on each element. In this exampe, let us say want to create 4 number with step 2, so I will have
 
[3, 6, 8, 12
 5, 8, 10,14
 7, 10,12,16
 9, 12,14,18]
 
It is a 4 by 4 maxtric in this example. My original array is quite large. but the range I want to create around the number is not big, it is about 30. 
 
Does anyone know how to do this efficiently?
 
Thanks
 
Frank
_________________________________________________________________
Send e-mail faster without improving your typing skills.
http://windowslive.com/Explore/hotmail?ocid=TXT_TAGLM_WL_hotmail_acq_speed_122008
-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://projects.scipy.org/pipermail/numpy-discussion/attachments/20081208/82a7dae6/attachment.html 


More information about the Numpy-discussion mailing list