2014-09-10 23 views

回答

0

您需要查看包含两次浮子数量漂浮为复数阵列:

>>> shared_array_base = multiprocessing.Array(ctypes.c_double, 3*3*2) 
>>> shared_array = np.ctypeslib.as_array(shared_array_base.get_obj()) 
>>> shared_array = shared_array.view(np.complex128).reshape(3, 3) 

复数格式为[RE0,IM0,RE1,IM1,RE2,IM2,...] :

>>> shared_array[1,1] = 1+2j 
>>> shared_array.base 
array([ 0., 0., 0., 0., 0., 0., 0., 0., 1., 2., 0., 0., 0., 
     0., 0., 0., 0., 0.]) 
>>> shared_array.base.base 
<multiprocessing.sharedctypes.c_double_Array_18 object at 0x7f7c1b5d1f80> 
相关问题