Reputation: 130
I would like to create an array with the form [1, 2, 4, 8, 16, 32, ...]
. Not always with that spacing between numbers.
Is there a linspace
/arange
type function which allows me to create vector of non equally spaced numbers?
Thanks
Upvotes: 1
Views: 1343
Reputation: 469
Yes, there is also logspace
and geomspace
in NumPy.
np.geomspace(1,32,6)
gives you array([ 1., 2., 4., 8., 16., 32.])
Upvotes: 4