import numpy as npfrom algopy import UTPM, zerosimport numdifftools.nd_algopy as ndaimport numdifftools as nd
def f(x):
nobs = x.shape[1:] f0 = x[0]**2 * np.sin(x[1])**2 f1 = x[0]**2 * np.cos(x[1])**2 out = zeros((2,) + nobs, dtype=x) out[0,:] = f0 out[1,:] = f1 return out
x = np.array([(1, 2, 3, 4), (5, 6, 7, 8)], dtype=float)y = f(x)
xj = UTPM.init_jacobian(x)j = UTPM.extract_jacobian(f(xj))
---------------------------------------------------------------------------NotImplementedError Traceback (most recent call last)<ipython-input-31-a606a9700adf> in <module>() 19 20 xj = UTPM.init_jacobian(x)---> 21 j = UTPM.extract_jacobian(f(xj)) 22 23 print "x =\n%r\n" % x
<ipython-input-31-a606a9700adf> in f(x) 8 nobs = x.shape[1:] 9 print "nobs: %r" % nobs---> 10 f0 = x[0]**2 * np.sin(x[1])**2 11 f1 = x[0]**2 * np.cos(x[1])**2 12 out = zeros((2,) + nobs, dtype=x)
c:\python27\lib\site-packages\algopy\utpm\utpm.pyc in __mul__(self, rhs) 364 else: 365 err_str = 'binary operations between UTPM instances and object arrays are not supported'--> 366 raise NotImplementedError(err_str) 367 368 elif isinstance(rhs,numpy.ndarray):
NotImplementedError: binary operations between UTPM instances and object arrays are not supported
rhsarray([ UTPM([[ 0.91953576 0.91953576 0.91953576 0.91953576 0.91953576 0.91953576 0.91953576 0.91953576] [ 0. 0. 0. 0. -0.54402111 0. 0. 0. ]]), UTPM([[ 0.07807302 0.07807302 0.07807302 0.07807302 0.07807302 0.07807302 0.07807302 0.07807302] [ 0. 0. 0. 0. 0. -0.53657292 0. 0. ]]), UTPM([[ 0.43163139 0.43163139 0.43163139 0.43163139 0.43163139 0.43163139 0.43163139 0.43163139] [ 0. 0. 0. 0. 0. 0. 0.99060736 0. ]]), UTPM([[ 0.97882974 0.97882974 0.97882974 0.97882974 0.97882974 0.97882974 0.97882974 0.97882974] [ 0. 0. 0. 0. 0. 0. 0. -0.28790332]])],
dtype=object)
--
You received this message because you are subscribed to the Google Groups "algopy" group.
To unsubscribe from this group and stop receiving emails from it, send an email to algopy+un...@googlegroups.com.
For more options, visit https://groups.google.com/d/optout.