[SciPy-User] scalars vs array of length 1
Victor Eijkhout
eijkhout at tacc.utexas.edu
Thu Jul 8 13:29:08 EDT 2010
On 2010/07/08, at 12:23 PM, David Warde-Farley wrote:
>
> On 2010-07-08, at 12:44 PM, Victor Eijkhout wrote:
>
>> I want to write a function that can accept both a scalar and a vector, when called on a vector it should return a vector of scalar application results. However, scalars seem to be treated differently from length-1 lists.
>
> ...
>
>>
>> How do I get that shape to be the same in both cases?
>
> x = atleast_1d(x)
Fantastic. Thanks!
Victor.
More information about the SciPy-User
mailing list