2
from scipy_base import *
3
from scipy_base.fastumath import *
6
if type(a) in [type(1.0),type(1L),type(1),type(1j)]:
8
elif type(a) is ArrayType and len(a)==1:
9
# Takes care of mapping array(number) to array([number])
10
return asarray([a[0]])
14
def check_func(thefunc, x0, args, numinputs, output_shape=None):
15
args = (x0[:numinputs],) + args
16
res = myasarray(apply(thefunc,args))
17
if (output_shape != None) and (res.shape != output_shape):
18
if (output_shape[0] != 1):
19
if len(output_shape) > 1:
20
if output_shape[1] == 1:
22
raise TypeError, "There is a mismatch between the input and output shape of %s." % thefunc.func_name