• 设为首页
  • 点击收藏
  • 手机版
    手机扫一扫访问
    迪恩网络手机版
  • 关注官方公众号
    微信扫一扫关注
    迪恩网络公众号

Python numpy.complex64函数代码示例

原作者: [db:作者] 来自: [db:来源] 收藏 邀请

本文整理汇总了Python中numpy.complex64函数的典型用法代码示例。如果您正苦于以下问题:Python complex64函数的具体用法?Python complex64怎么用?Python complex64使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。



在下文中一共展示了complex64函数的20个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的Python代码示例。

示例1: testCountingLoopHandrolledC64

  def testCountingLoopHandrolledC64(self):
    # Define a function for the loop body
    @function.Defun(dtypes.int32, dtypes.complex64)
    def loop_body(step, rsum):
      step_out = step + constant_op.constant(1, dtype=dtypes.int32)
      sum_out = rsum + constant_op.constant(1.5 + 2j, dtype=dtypes.complex64)
      return step_out, sum_out

    # Define a function for the loop condition
    @function.Defun(dtypes.int32, dtypes.complex64)
    def loop_cond(step, rsum):
      del rsum
      return step < 10

    with self.cached_session() as sess:
      init_index = array_ops.placeholder(dtypes.int32, [])
      init_sum = array_ops.placeholder(dtypes.complex64, [])
      with self.test_scope():
        loop_outputs = xla.while_loop([init_index, init_sum], loop_cond,
                                      loop_body)

      result = sess.run(loop_outputs, {init_index: 0, init_sum: 0.0})
      self.assertAllClose(result[1], np.complex64(15 + 20j), rtol=1e-3)
      no_iters_result = sess.run(loop_outputs, {init_index: 10, init_sum: 0.0})
      self.assertAllClose(no_iters_result[1], np.complex64(0), rtol=1e-3)
开发者ID:Ajaycs99,项目名称:tensorflow,代码行数:25,代码来源:while_test.py


示例2: test_cublasCgemmBatched

    def test_cublasCgemmBatched(self):
        l, m, k, n = 11, 7, 5, 3
        A = (np.random.rand(l, m, k)+1j*np.random.rand(l, m, k)).astype(np.complex64)
        B = (np.random.rand(l, k, n)+1j*np.random.rand(l, k, n)).astype(np.complex64)

        C_res = np.einsum('nij,njk->nik', A, B)

        a_gpu = gpuarray.to_gpu(A)
        b_gpu = gpuarray.to_gpu(B)
        c_gpu = gpuarray.empty((l, m, n), np.complex64)

        alpha = np.complex64(1.0)
        beta = np.complex64(0.0)

        a_arr = bptrs(a_gpu)
        b_arr = bptrs(b_gpu)
        c_arr = bptrs(c_gpu)

        cublas.cublasCgemmBatched(self.cublas_handle, 'n','n',
                                  n, m, k, alpha,
                                  b_arr.gpudata, n,
                                  a_arr.gpudata, k,
                                  beta, c_arr.gpudata, n, l)

        assert np.allclose(C_res, c_gpu.get())
开发者ID:Brainiarc7,项目名称:scikit-cuda,代码行数:25,代码来源:test_cublas.py


示例3: runTest

	def runTest(self):
		node_list = ['n1', 'n2', 'n3']
		V = np.complex64(( 1.02500000+0.0j, 1.00057074-0.03669173j, 1.02970624+0.0245978j))
		phase = np.complex64((0.0, -0.03665437, 0.02388363))

		P = np.complex64((1.00010597, -4.0, 3.0))
		Q = np.complex64((0.90512173, -2.0, 1.36935805))

		netlist = Netlist()

		
		# Check values are close to what we expect
		

		try:
			netlist.load_from_file("testing/inputfile2.txt")
			netlist.run()

			# print abs(netlist.result.V)- abs(V)

			print netlist.result.V
			print netlist.result.P


			# assert (np.allclose(netlist.result.V, V, rtol=1e-3, atol=1e-3))
			# assert (np.allclose(netlist.result.phase, phase, rtol=1e-3, atol=1e-3))
			# assert (np.allclose(netlist.result.P, P, rtol=1e-3, atol=1e-3))
			# assert (np.allclose(netlist.result.Q, Q, rtol=1e-3, atol=1e-3))
		finally:
			del netlist
开发者ID:Bobalot,项目名称:Powerflow,代码行数:30,代码来源:unittests.py


示例4: test_numpy

    def test_numpy(self):
        assert chash(np.bool_(True)) == chash(np.bool_(True))

        assert chash(np.int8(1)) == chash(np.int8(1))
        assert chash(np.int16(1))
        assert chash(np.int32(1))
        assert chash(np.int64(1))

        assert chash(np.uint8(1))
        assert chash(np.uint16(1))
        assert chash(np.uint32(1))
        assert chash(np.uint64(1))

        assert chash(np.float32(1)) == chash(np.float32(1))
        assert chash(np.float64(1)) == chash(np.float64(1))
        assert chash(np.float128(1)) == chash(np.float128(1))

        assert chash(np.complex64(1+1j)) == chash(np.complex64(1+1j))
        assert chash(np.complex128(1+1j)) == chash(np.complex128(1+1j))
        assert chash(np.complex256(1+1j)) == chash(np.complex256(1+1j))

        assert chash(np.datetime64('2000-01-01')) == chash(np.datetime64('2000-01-01'))
        assert chash(np.timedelta64(1,'W')) == chash(np.timedelta64(1,'W'))

        self.assertRaises(ValueError, chash, np.object())

        assert chash(np.array([[1, 2], [3, 4]])) == \
            chash(np.array([[1, 2], [3, 4]]))
        assert chash(np.array([[1, 2], [3, 4]])) != \
            chash(np.array([[1, 2], [3, 4]]).T)
        assert chash(np.array([1, 2, 3])) == chash(np.array([1, 2, 3]))
        assert chash(np.array([1, 2, 3], dtype=np.int32)) != \
            chash(np.array([1, 2, 3], dtype=np.int64))
开发者ID:lebedov,项目名称:chash,代码行数:33,代码来源:test_chash.py


示例5: test_dump_np_scalars

def test_dump_np_scalars():
	data = [
		int8(-27),
		complex64(exp(1)+37j),
		(
			{
				'alpha': float64(-exp(10)),
				'str-only': complex64(-1-1j),
			},
			uint32(123456789),
			float16(exp(-1)),
			{
				int64(37),
				uint64(-0),
			},
		),
	]
	replaced = encode_scalars_inplace(deepcopy(data))
	json = dumps(replaced)
	rec = loads(json)
	print(data)
	print(rec)
	assert data[0] == rec[0]
	assert data[1] == rec[1]
	assert data[2][0] == rec[2][0]
	assert data[2][1] == rec[2][1]
	assert data[2][2] == rec[2][2]
	assert data[2][3] == rec[2][3]
	assert data[2] == tuple(rec[2])
开发者ID:mverleg,项目名称:pyjson_tricks,代码行数:29,代码来源:test_utils.py


示例6: __get_excit_wfm

    def __get_excit_wfm(filepath):
        """
        Returns the excitation BE waveform present in the more parms.mat file
        
        Parameters
        ------------
        filepath : String / unicode
            Absolute filepath of the .mat parameter file
        
        Returns
        -----------
        ex_wfm : 1D numpy float array
            Band Excitation waveform

        """
        if not path.exists(filepath):
            warn('BEPSndfTranslator - NO more_parms.mat file found')
            return np.zeros(1000, dtype=np.float32)

        if 'more_parms' in filepath:
            matread = loadmat(filepath, variable_names=['FFT_BE_wave'])
            fft_full = np.complex64(np.squeeze(matread['FFT_BE_wave']))
            bin_inds = None
            fft_full_rev = None
        else:
            matread = loadmat(filepath, variable_names=['FFT_BE_wave', 'FFT_BE_rev_wave', 'BE_bin_ind'])
            bin_inds = np.uint(np.squeeze(matread['BE_bin_ind'])) - 1
            fft_full = np.complex64(np.squeeze(matread['FFT_BE_wave']))
            fft_full_rev = np.complex64(np.squeeze(matread['FFT_BE_rev_wave']))

        return fft_full, fft_full_rev, bin_inds
开发者ID:pycroscopy,项目名称:pycroscopy,代码行数:31,代码来源:beps_ndf.py


示例7: test_arrays_replicated_3d

    def test_arrays_replicated_3d(self):
        s = readsav(path.join(DATA_PATH, 'struct_arrays_replicated_3d.sav'), verbose=False)

        # Check column types
        assert_(s.arrays_rep.a.dtype.type is np.object_)
        assert_(s.arrays_rep.b.dtype.type is np.object_)
        assert_(s.arrays_rep.c.dtype.type is np.object_)
        assert_(s.arrays_rep.d.dtype.type is np.object_)

        # Check column shapes
        assert_equal(s.arrays_rep.a.shape, (4, 3, 2))
        assert_equal(s.arrays_rep.b.shape, (4, 3, 2))
        assert_equal(s.arrays_rep.c.shape, (4, 3, 2))
        assert_equal(s.arrays_rep.d.shape, (4, 3, 2))

        # Check values
        for i in range(4):
            for j in range(3):
                for k in range(2):
                    assert_array_identical(s.arrays_rep.a[i, j, k],
                                           np.array([1, 2, 3], dtype=np.int16))
                    assert_array_identical(s.arrays_rep.b[i, j, k],
                                           np.array([4., 5., 6., 7.],
                                                    dtype=np.float32))
                    assert_array_identical(s.arrays_rep.c[i, j, k],
                                           np.array([np.complex64(1+2j),
                                                     np.complex64(7+8j)]))
                    assert_array_identical(s.arrays_rep.d[i, j, k],
                                           np.array([b"cheese", b"bacon", b"spam"],
                                                    dtype=np.object))
开发者ID:hitej,项目名称:meta-core,代码行数:30,代码来源:test_idl.py


示例8: generate

    def generate(self, width, height, real_axis_range, imag_axis_range, tasks):
        if not is_gpu_accelerated():
            self._logger.error(
                'No GPU acceleration is available, please use CPU.')
            return

        iterations = np.empty(width * height, np.int32)
        iterations_gpu = gpuarray.to_gpu(iterations)

        z_values = np.empty(width * height, np.float32)
        z_values_gpu = gpuarray.to_gpu(z_values)

        cmin = complex(real_axis_range[0], imag_axis_range[0])
        cmax = complex(real_axis_range[1], imag_axis_range[1])
        dc = cmax - cmin

        dx, mx = divmod(width, self._block_size[0])
        dy, my = divmod(height, self._block_size[1])
        grid_size = ((dx + (mx > 0)), (dy + (my > 0)))

        self._get_pixel_iterations(
            iterations_gpu, z_values_gpu,
            np.int32(width), np.int32(height),
            np.complex64(cmin), np.complex64(dc),
            block=self._block_size, grid=grid_size)

        return (iterations_gpu, z_values_gpu, abs(dc))
开发者ID:gkostadinov,项目名称:py-mandelbrot,代码行数:27,代码来源:mandelbrot_gpu.py


示例9: hiss_removal

def hiss_removal(audio):
    pend = len(audio)-(4410+1102)
    song = sonify(audio, 44100) 
    song.FrameGenerator().__next__()
    song.window() 
    song.Spectrum()
    noise_fft = song.fft(song.windowed_x)[:song.H+1]
    noise_power = np.log10(np.abs(noise_fft + 2 ** -16))
    noise_floor = np.exp(2.0 * noise_power.mean())                                    
    mn = song.magnitude_spectrum
    e_n = energy(mn)   
    pin = 0                
    output = np.zeros(len(audio))
    hold_time = 0
    ca = 0
    cr = 0
    amp = audio.max()
    while pin < pend:
        selection = pin+2048
        song.frame = audio[pin:selection] 
        song.window()     
        song.M = 2048            
        song.Spectrum()
        e_m = energy(song.magnitude_spectrum)
        SNR = 10 * np.log10(e_m / e_n)
        ft = song.fft(song.windowed_x)[:song.H+1]
        power_spectral_density = np.abs(ft) ** 2
        song.Envelope()
        song.AttackTime()
        rel_time = rel(song.attack_time)
        rel_coef = to_coef(rel_time, 44100)
        at_coef = to_coef(song.attack_time, 44100)
        ca = ca + song.attack_time
        cr = cr + rel_time 
        if SNR > 0:                
            np.add.at(output, range(pin, selection), audio[pin:selection])                                
        else:                    
            if np.any(power_spectral_density < noise_floor):                                    
                gc = dyn_constraint_satis(ft, [power_spectral_density, noise_floor], 0.12589254117941673) 
                if ca > hold_time:
                    gc = np.complex64([at_coef * gc[i- 1] + (1 - at_coef) * x if x > gc[i- 1] else x for i,x in enumerate(gc)])
                if ca <= hold_time:
                    gc = np.complex64([gc[i- 1] for i,x in enumerate(gc)])
                if cr > hold_time:
                    gc = np.complex64([rel_coef * gc[i- 1] + (1 - rel_coef) * x if x <= gc[i- 1] else x for i,x in enumerate(gc)])
                if cr <= hold_time:
                    gc = np.complex64([gc[i- 1] for i,x in enumerate(gc)])
                print ("Reducing noise floor, this is taking some time")
                song.Phase(song.fft(song.windowed_x))
                song.phase = song.phase[:song.magnitude_spectrum.size]
                ft *= gc
                song.magnitude_spectrum = np.sqrt(pow(ft.real,2) + pow(ft.imag,2))
                np.add.at(output, range(pin, selection), song.ISTFT(song.magnitude_spectrum))
            else:
                np.add.at(output, range(pin, selection), audio[pin:selection])                                              
        pin = pin + song.H
        hold_time += selection/44100
    hissless = amp * output / output.max() #amplify to normal level                                                 
    return np.float32(hissless) 
开发者ID:sonidosmutantes,项目名称:apicultor,代码行数:59,代码来源:quality.py


示例10: energy_density_at_origin

def energy_density_at_origin(k):
    K = complex64(ellipk(k**2))
    E = complex64(ellipe(k**2))
    k1 = sqrt(1-k**2)

    A = 32*(k**2 *(-K**2 * k**2 +E**2-4*E*K+3* K**2 + k**2)-2*(E-K)**2)**2/(k**8 * K**4 * k1**2)

    return A.real
开发者ID:davidbraden,项目名称:monopole,代码行数:8,代码来源:energy_density.py


示例11: sc_complex_dot

def sc_complex_dot(x_gpu, y_gpu, c_gpu, transa='N', transb='N', handle=None):
    """
    modified version of linalg.dot which allows for the target output array to be specified.
    This function does not return anything.
    """
    if handle is None:
        handle = scikits.cuda.misc._global_cublas_handle

    assert len(x_gpu.shape) == 2
    assert len(y_gpu.shape) == 2
    assert len(c_gpu.shape) == 2
    assert x_gpu.dtype == np.complex64
    assert y_gpu.dtype == np.complex64 
    assert c_gpu.dtype == np.complex64

    # Get the shapes of the arguments
    x_shape = x_gpu.shape
    y_shape = y_gpu.shape
    
    # Perform matrix multiplication for 2D arrays:
    alpha = np.complex64(1.0)
    beta = np.complex64(0.0)
    
    transa = string.lower(transa)
    transb = string.lower(transb)

    if transb in ['t', 'c']:
        m, k = y_shape
    elif transb in ['n']:
        k, m = y_shape
    else:
        raise ValueError('invalid value for transb')

    if transa in ['t', 'c']:
        l, n = x_shape
    elif transa in ['n']:
        n, l = x_shape
    else:
        raise ValueError('invalid value for transa')

    if l != k:
        raise ValueError('objects are not aligned')

    if transb == 'n':
        lda = max(1, m)
    else:
        lda = max(1, k)

    if transa == 'n':
        ldb = max(1, k)
    else:
        ldb = max(1, n)

    ldc = max(1, m)

    cublas.cublasCgemm(handle, transb, transa, m, n, k, alpha, y_gpu.gpudata,
                lda, x_gpu.gpudata, ldb, beta, c_gpu.gpudata, ldc)
开发者ID:HarveyLiuFly,项目名称:theano_fftconv,代码行数:57,代码来源:cufftop.py


示例12: _update_filtered

	def _update_filtered(self, translated):
		if translated is not None and self._taps_n is not None and self._taps_p is not None:
			filtered_data_1 = TimeData(numpy.complex64(scipy.signal.lfilter(self._taps_n, 1, translated.samples)), translated.sampling_rate)
			filtered_data_2 = TimeData(numpy.complex64(scipy.signal.lfilter(self._taps_p, 1, translated.samples)), translated.sampling_rate)
			self.eye_view.data = (filtered_data_1.abs, filtered_data_2.abs)
			self.burst.filtered = TimeData(filtered_data_2.abs.samples - filtered_data_1.abs.samples, filtered_data_1.sampling_rate)
		else:
			self.eye_view.data = (None, None)
			self.burst.filtered = None
开发者ID:Cyan27,项目名称:tpms,代码行数:9,代码来源:burst_inspect.py


示例13: __init__

    def __init__(self,timeSeries=None,
                 lenSeries=2**18,
                 numChannels=1,
                 fMin=400,fMax=800,
                 sampTime=None,
                 noiseRMS=0.1):
        """ Initializes the AmplitudeTimeSeries instance. 
        If a array is not passed, then a random whitenoise dataset is generated.
        Inputs: 
        Len -- Number of time data points (usually a power of 2) 2^38 gives about 65 seconds 
        of 400 MHz sampled data
        The time binning is decided by the bandwidth
        fMin -- lowest frequency (MHz)
        fMax -- highest frequency (MHz)
        noiseRMS -- RMS value of noise (TBD)
        noiseAlpha -- spectral slope (default is white noise) (TBD)
        ONLY GENERATES WHITE NOISE RIGHT NOW!
        """
        self.shape = (np.uint(numChannels),np.uint(lenSeries))
        self.fMax = fMax
        self.fMin = fMin        
        
        if sampTime is None:
            self.sampTime = np.uint(numChannels)*1E-6/(fMax-fMin)
        else:
            self.sampTime = sampTime

        if timeSeries is None:
            # then use the rest of the data to generate a random timeseries
            if VERBOSE:
                print "AmplitudeTimeSeries __init__ did not get new data, generating white noise data"

            self.timeSeries = np.complex64(noiseRMS*(np.float16(random.standard_normal(self.shape))
                                                     +np.float16(random.standard_normal(self.shape))*1j)/np.sqrt(2))
            
        else:
            if VERBOSE:
                print "AmplitudeTimeSeries __init__ got new data, making sure it is reasonable."

            if len(timeSeries.shape) == 1:
                self.shape = (1,timeSeries.shape[0])
                
            else:
                self.shape = timeSeries.shape

            self.timeSeries = np.reshape(np.complex64(timeSeries),self.shape)
            
            self.fMin = fMin
            self.fMax = fMax

            if sampTime is None:
                self.sampTime = numChannels*1E-6/(fMax-fMin)
            else:
                self.sampTime = sampTime

        return None
开发者ID:shriharshtendulkar,项目名称:FRBSignalGeneration,代码行数:56,代码来源:FRBSignalGeneration.py


示例14: add_vdot

def add_vdot(M, v, out, beta=0.0, transM='N', handle=None):
    if handle is None:
        handle = scm._global_cublas_handle

    assert M.strides[1] <= M.strides[0], 'only C-order arrays supported'

    transM = transM.lower()
    if transM == 'n':
        trans = 't'
        m = M.shape[1]
        n = M.shape[0]
        alpha = 1.0
        lda = M.strides[0] // M.dtype.itemsize
        if v.shape[0] != M.shape[1] or out.shape[0] != M.shape[0]:
            raise ValueError('dimension mismatch: %s %s %s' %
                             (M.shape, v.shape, out.shape))
    elif transM == 't':
        trans = 'n'
        m = M.shape[1]
        n = M.shape[0]
        alpha = 1.0
        lda = M.strides[0] // M.dtype.itemsize
        if v.shape[0] != M.shape[0] or out.shape[0] != M.shape[1]:
            raise ValueError('dimension mismatch: %s %s %s' %
                             (M.shape, v.shape, out.shape))
    else:
        raise ValueError('transM must be n or t')

    if (M.dtype == np.complex64 and v.dtype == np.complex64):
        cublas_func = scikits.cuda.cublas.cublasCgemv
        alpha = np.complex64(alpha)
        beta = np.complex64(beta)
    elif (M.dtype == np.float32 and v.dtype == np.float32):
        cublas_func = scikits.cuda.cublas.cublasSgemv
        alpha = np.float32(alpha)
        beta = np.float32(beta)
    elif (M.dtype == np.complex128 and v.dtype == np.complex128):
        cublas_func = scikits.cuda.cublas.cublasZgemv
        alpha = np.complex128(alpha)
        beta = np.complex128(beta)
    elif (M.dtype == np.float64 and v.dtype == np.float64):
        cublas_func = scikits.cuda.cublas.cublasDgemv
        alpha = np.float64(alpha)
        beta = np.float64(beta)
    else:
        raise ValueError('unsupported combination of input types')

    incx = 1
    incy = 1
    cublas_func(handle,
                trans, m, n,
                alpha,
                M.gpudata, lda,
                v.gpudata, incx,
                beta,
                out.gpudata, incy)
开发者ID:subhasis256,项目名称:pythonn,代码行数:56,代码来源:utils.py


示例15: test_compressed

 def test_compressed(self):
     s = idlsave.read(path.join(DATA_PATH, 'various_compressed.sav'), verbose=False)
     assert_identical(s.i8u, np.uint8(234))
     assert_identical(s.f32, np.float32(-3.1234567e+37))
     assert_identical(s.c64, np.complex128(1.1987253647623157e+112-5.1987258887729157e+307j))
     assert_equal(s.array5d.shape, (4, 3, 4, 6, 5))
     assert_identical(s.arrays.a[0], np.array([1, 2, 3], dtype=np.int16))
     assert_identical(s.arrays.b[0], np.array([4., 5., 6., 7.], dtype=np.float32))
     assert_identical(s.arrays.c[0], np.array([np.complex64(1+2j), np.complex64(7+8j)]))
     assert_identical(s.arrays.d[0], np.array(asbytes_nested(["cheese", "bacon", "spam"]), dtype=np.object))
开发者ID:chetstar,项目名称:idlsave,代码行数:10,代码来源:test_read.py


示例16: test_dtypes

def test_dtypes():
    a = afnumpy.random.random((2,3))
    b = numpy.array(a)
    fassert(afnumpy.int32(a), numpy.int32(b))
    fassert(afnumpy.complex64(a), numpy.complex64(b))
    assert(afnumpy.float(a.sum()), numpy.float(b.sum()))
    fassert(afnumpy.complex64(b), numpy.complex64(a))
    assert(type(afnumpy.complex64(b)), afnumpy.multiarray.ndarray)
    assert(type(afnumpy.complex64([1,2,3])), afnumpy.multiarray.ndarray)
    assert(type(afnumpy.bool8(True)), numpy.bool_)
开发者ID:Brainiarc7,项目名称:afnumpy,代码行数:10,代码来源:test_core.py


示例17: get_workspace

    def get_workspace(self, n):
        from pyfft.cuda import Plan as pycufftplan
        import pycuda.gpuarray as gpuarray

        ws = self.get(n)
        if ws: return ws
        return self.setdefault(n,
            (pycufftplan(int(n), stream=self.stream, normalize=False),
             gpuarray.empty(n, dtype=complex64(0.).dtype),
             gpuarray.empty(n, dtype=complex64(0.).dtype)))
开发者ID:GeraintPratten,项目名称:lalsuite,代码行数:10,代码来源:overlap_cuda.py


示例18: dmus

def dmus(zeta, x, k):

    K = complex64(ellipk(k**2))

    E = complex64(ellipe(k**2))

    cm= (2*E-K)/K

    k1 = sqrt(1-k**2)

    xp = x[0]+complex(0,1)*x[1]
    xm = x[0]-complex(0,1)*x[1]
    S =  sqrt(K**2-4*xp*xm)
    SP = sqrt(K**2-4*xp**2)
    SM = sqrt(K**2-4*xm**2)
    SPM = sqrt(-k1**2*(K**2*k**2-4*xm*xp)+(xm-xp)**2)
    R = 2*K**2*k1**2-S**2-8*x[2]**2
    RM = complex(0,1)*SM**2*(xm*(2*k1**2-1)+xp)-(16*complex(0,1))*xm*x[2]**2
    RP = complex(0,1)*SM**2*(xp*(2*k1**2-1)+xm)+(16*complex(0,1))*xp*x[2]**2
    RMBAR=-complex(0,1)*SP**2*( xp*(2*k1**2-1)+xm ) +16*complex(0,1)*xp*x[2]**2
    RPBAR=-complex(0,1)*SP**2*( xm*(2*k1**2-1)+xp ) -16*complex(0,1)*xm*x[2]**2
    r=sqrt(x[0]**2+x[1]**2+x[2]**2)

    DM = [None,None,None,None]

    DM[0] = [None]*3
    DM[1] = [None]*3
    DM[2] = [None]*3
    DM[3] = [None]*3

    DM[0][0] = complex(0, 1) * (E * K * zeta[0] ** 2 - K ** 2 * zeta[0] ** 2 + 4 * zeta[0] ** 2 * x[0] ** 2 + complex(0, -4) * zeta[0] ** 2 * x[1] * x[0] + E * K - K ** 2 + 4 * x[0] ** 2 + complex(0, -8) * zeta[0] * x[2] * x[0] + complex(0, 4) * x[0] * x[1]) / (4 * zeta[0] ** 3 * x[0] ** 2 + complex(0, -8) * zeta[0] ** 3 * x[0] * x[1] + 2 * K ** 2 * k1 ** 2 * zeta[0] - K ** 2 * zeta[0] ** 3 + 4 * x[0] ** 2 * zeta[0] + complex(0, -12) * zeta[0] ** 2 * x[0] * x[2] - 4 * zeta[0] ** 3 * x[1] ** 2 - 12 * zeta[0] ** 2 * x[1] * x[2] - K ** 2 * zeta[0] + complex(0, -4) * x[0] * x[2] + 4 * x[1] ** 2 * zeta[0] - 8 * zeta[0] * x[2] ** 2 + 4 * x[1] * x[2])

    DM[1][0] = complex(0, 1) * (E * K * zeta[1] ** 2 - K ** 2 * zeta[1] ** 2 + 4 * zeta[1] ** 2 * x[0] ** 2 + complex(0, -4) * zeta[1] ** 2 * x[1] * x[0] + E * K - K ** 2 + 4 * x[0] ** 2 + complex(0, -8) * zeta[1] * x[2] * x[0] + complex(0, 4) * x[0] * x[1]) / (4 * zeta[1] ** 3 * x[0] ** 2 + complex(0, -8) * zeta[1] ** 3 * x[0] * x[1] + 2 * K ** 2 * k1 ** 2 * zeta[1] - K ** 2 * zeta[1] ** 3 + 4 * x[0] ** 2 * zeta[1] + complex(0, -12) * zeta[1] ** 2 * x[0] * x[2] - 4 * zeta[1] ** 3 * x[1] ** 2 - 12 * zeta[1] ** 2 * x[1] * x[2] - K ** 2 * zeta[1] + complex(0, -4) * x[0] * x[2] + 4 * x[1] ** 2 * zeta[1] - 8 * zeta[1] * x[2] ** 2 + 4 * x[1] * x[2])

    DM[2][0] = complex(0, 1) * (E * K * zeta[2] ** 2 - K ** 2 * zeta[2] ** 2 + 4 * zeta[2] ** 2 * x[0] ** 2 + complex(0, -4) * zeta[2] ** 2 * x[1] * x[0] + E * K - K ** 2 + 4 * x[0] ** 2 + complex(0, -8) * zeta[2] * x[2] * x[0] + complex(0, 4) * x[0] * x[1]) / (4 * zeta[2] ** 3 * x[0] ** 2 + complex(0, -8) * zeta[2] ** 3 * x[0] * x[1] + 2 * K ** 2 * k1 ** 2 * zeta[2] - K ** 2 * zeta[2] ** 3 + 4 * x[0] ** 2 * zeta[2] + complex(0, -12) * zeta[2] ** 2 * x[0] * x[2] - 4 * zeta[2] ** 3 * x[1] ** 2 - 12 * zeta[2] ** 2 * x[1] * x[2] - K ** 2 * zeta[2] + complex(0, -4) * x[0] * x[2] + 4 * x[1] ** 2 * zeta[2] - 8 * zeta[2] * x[2] ** 2 + 4 * x[1] * x[2])

    DM[3][0] = complex(0, 1) * (E * K * zeta[3] ** 2 - K ** 2 * zeta[3] ** 2 + 4 * zeta[3] ** 2 * x[0] ** 2 + complex(0, -4) * zeta[3] ** 2 * x[1] * x[0] + E * K - K ** 2 + 4 * x[0] ** 2 + complex(0, -8) * zeta[3] * x[2] * x[0] + complex(0, 4) * x[0] * x[1]) / (4 * zeta[3] ** 3 * x[0] ** 2 + complex(0, -8) * zeta[3] ** 3 * x[0] * x[1] + 2 * K ** 2 * k1 ** 2 * zeta[3] - K ** 2 * zeta[3] ** 3 + 4 * x[0] ** 2 * zeta[3] + complex(0, -12) * zeta[3] ** 2 * x[0] * x[2] - 4 * zeta[3] ** 3 * x[1] ** 2 - 12 * zeta[3] ** 2 * x[1] * x[2] - K ** 2 * zeta[3] + complex(0, -4) * x[0] * x[2] + 4 * x[1] ** 2 * zeta[3] - 8 * zeta[3] * x[2] ** 2 + 4 * x[1] * x[2])

    DM[0][1] = (complex(0, 4) * zeta[0] ** 2 * x[1] * x[0] + E * K * zeta[0] ** 2 + 4 * zeta[0] ** 2 * x[1] ** 2 + complex(0, 4) * x[0] * x[1] + 8 * zeta[0] * x[1] * x[2] - E * K - 4 * x[1] ** 2) / (4 * zeta[0] ** 3 * x[0] ** 2 + complex(0, -8) * zeta[0] ** 3 * x[0] * x[1] + 2 * K ** 2 * k1 ** 2 * zeta[0] - K ** 2 * zeta[0] ** 3 + 4 * x[0] ** 2 * zeta[0] + complex(0, -12) * zeta[0] ** 2 * x[0] * x[2] - 4 * zeta[0] ** 3 * x[1] ** 2 - 12 * zeta[0] ** 2 * x[1] * x[2] - K ** 2 * zeta[0] + complex(0, -4) * x[0] * x[2] + 4 * x[1] ** 2 * zeta[0] - 8 * zeta[0] * x[2] ** 2 + 4 * x[1] * x[2])

    DM[1][1] = (complex(0, 4) * zeta[1] ** 2 * x[1] * x[0] + E * K * zeta[1] ** 2 + 4 * zeta[1] ** 2 * x[1] ** 2 + complex(0, 4) * x[0] * x[1] + 8 * zeta[1] * x[1] * x[2] - E * K - 4 * x[1] ** 2) / (4 * zeta[1] ** 3 * x[0] ** 2 + complex(0, -8) * zeta[1] ** 3 * x[0] * x[1] + 2 * K ** 2 * k1 ** 2 * zeta[1] - K ** 2 * zeta[1] ** 3 + 4 * x[0] ** 2 * zeta[1] + complex(0, -12) * zeta[1] ** 2 * x[0] * x[2] - 4 * zeta[1] ** 3 * x[1] ** 2 - 12 * zeta[1] ** 2 * x[1] * x[2] - K ** 2 * zeta[1] + complex(0, -4) * x[0] * x[2] + 4 * x[1] ** 2 * zeta[1] - 8 * zeta[1] * x[2] ** 2 + 4 * x[1] * x[2])

    DM[2][1] = (complex(0, 4) * zeta[2] ** 2 * x[1] * x[0] + E * K * zeta[2] ** 2 + 4 * zeta[2] ** 2 * x[1] ** 2 + complex(0, 4) * x[0] * x[1] + 8 * zeta[2] * x[1] * x[2] - E * K - 4 * x[1] ** 2) / (4 * zeta[2] ** 3 * x[0] ** 2 + complex(0, -8) * zeta[2] ** 3 * x[0] * x[1] + 2 * K ** 2 * k1 ** 2 * zeta[2] - K ** 2 * zeta[2] ** 3 + 4 * x[0] ** 2 * zeta[2] + complex(0, -12) * zeta[2] ** 2 * x[0] * x[2] - 4 * zeta[2] ** 3 * x[1] ** 2 - 12 * zeta[2] ** 2 * x[1] * x[2] - K ** 2 * zeta[2] + complex(0, -4) * x[0] * x[2] + 4 * x[1] ** 2 * zeta[2] - 8 * zeta[2] * x[2] ** 2 + 4 * x[1] * x[2])

    DM[3][1] = (complex(0, 4) * zeta[3] ** 2 * x[1] * x[0] + E * K * zeta[3] ** 2 + 4 * zeta[3] ** 2 * x[1] ** 2 + complex(0, 4) * x[0] * x[1] + 8 * zeta[3] * x[1] * x[2] - E * K - 4 * x[1] ** 2) / (4 * zeta[3] ** 3 * x[0] ** 2 + complex(0, -8) * zeta[3] ** 3 * x[0] * x[1] + 2 * K ** 2 * k1 ** 2 * zeta[3] - K ** 2 * zeta[3] ** 3 + 4 * x[0] ** 2 * zeta[3] + complex(0, -12) * zeta[3] ** 2 * x[0] * x[2] - 4 * zeta[3] ** 3 * x[1] ** 2 - 12 * zeta[3] ** 2 * x[1] * x[2] - K ** 2 * zeta[3] + complex(0, -4) * x[0] * x[2] + 4 * x[1] ** 2 * zeta[3] - 8 * zeta[3] * x[2] ** 2 + 4 * x[1] * x[2])

    DM[0][2] = 2 * (-K ** 2 * k1 ** 2 * zeta[0] + complex(0, 2) * zeta[0] ** 2 * x[0] * x[2] + 2 * zeta[0] ** 2 * x[1] * x[2] + E * K * zeta[0] + complex(0, 2) * x[0] * x[2] + 4 * zeta[0] * x[2] ** 2 - 2 * x[1] * x[2]) / (4 * zeta[0] ** 3 * x[0] ** 2 + complex(0, -8) * zeta[0] ** 3 * x[0] * x[1] + 2 * K ** 2 * k1 ** 2 * zeta[0] - K ** 2 * zeta[0] ** 3 + 4 * x[0] ** 2 * zeta[0] + complex(0, -12) * zeta[0] ** 2 * x[0] * x[2] - 4 * zeta[0] ** 3 * x[1] ** 2 - 12 * zeta[0] ** 2 * x[1] * x[2] - K ** 2 * zeta[0] + complex(0, -4) * x[0] * x[2] + 4 * x[1] ** 2 * zeta[0] - 8 * zeta[0] * x[2] ** 2 + 4 * x[1] * x[2])

    DM[1][2] = 2 * (-K ** 2 * k1 ** 2 * zeta[1] + complex(0, 2) * zeta[1] ** 2 * x[0] * x[2] + 2 * zeta[1] ** 2 * x[1] * x[2] + E * K * zeta[1] + complex(0, 2) * x[0] * x[2] + 4 * zeta[1] * x[2] ** 2 - 2 * x[1] * x[2]) / (4 * zeta[1] ** 3 * x[0] ** 2 + complex(0, -8) * zeta[1] ** 3 * x[0] * x[1] + 2 * K ** 2 * k1 ** 2 * zeta[1] - K ** 2 * zeta[1] ** 3 + 4 * x[0] ** 2 * zeta[1] + complex(0, -12) * zeta[1] ** 2 * x[0] * x[2] - 4 * zeta[1] ** 3 * x[1] ** 2 - 12 * zeta[1] ** 2 * x[1] * x[2] - K ** 2 * zeta[1] + complex(0, -4) * x[0] * x[2] + 4 * x[1] ** 2 * zeta[1] - 8 * zeta[1] * x[2] ** 2 + 4 * x[1] * x[2])

    DM[2][2] = 2 * (-K ** 2 * k1 ** 2 * zeta[2] + complex(0, 2) * zeta[2] ** 2 * x[0] * x[2] + 2 * zeta[2] ** 2 * x[1] * x[2] + E * K * zeta[2] + complex(0, 2) * x[0] * x[2] + 4 * zeta[2] * x[2] ** 2 - 2 * x[1] * x[2]) / (4 * zeta[2] ** 3 * x[0] ** 2 + complex(0, -8) * zeta[2] ** 3 * x[0] * x[1] + 2 * K ** 2 * k1 ** 2 * zeta[2] - K ** 2 * zeta[2] ** 3 + 4 * x[0] ** 2 * zeta[2] + complex(0, -12) * zeta[2] ** 2 * x[0] * x[2] - 4 * zeta[2] ** 3 * x[1] ** 2 - 12 * zeta[2] ** 2 * x[1] * x[2] - K ** 2 * zeta[2] + complex(0, -4) * x[0] * x[2] + 4 * x[1] ** 2 * zeta[2] - 8 * zeta[2] * x[2] ** 2 + 4 * x[1] * x[2])

    DM[3][2] = 2 * (-K ** 2 * k1 ** 2 * zeta[3] + complex(0, 2) * zeta[3] ** 2 * x[0] * x[2] + 2 * zeta[3] ** 2 * x[1] * x[2] + E * K * zeta[3] + complex(0, 2) * x[0] * x[2] + 4 * zeta[3] * x[2] ** 2 - 2 * x[1] * x[2]) / (4 * zeta[3] ** 3 * x[0] ** 2 + complex(0, -8) * zeta[3] ** 3 * x[0] * x[1] + 2 * K ** 2 * k1 ** 2 * zeta[3] - K ** 2 * zeta[3] ** 3 + 4 * x[0] ** 2 * zeta[3] + complex(0, -12) * zeta[3] ** 2 * x[0] * x[2] - 4 * zeta[3] ** 3 * x[1] ** 2 - 12 * zeta[3] ** 2 * x[1] * x[2] - K ** 2 * zeta[3] + complex(0, -4) * x[0] * x[2] + 4 * x[1] ** 2 * zeta[3] - 8 * zeta[3] * x[2] ** 2 + 4 * x[1] * x[2])

    return DM
开发者ID:davidbraden,项目名称:monopole,代码行数:55,代码来源:dmus.py


示例19: test_output_dtype

    def test_output_dtype(self):
        '''Test to see if the output_dtype property returns the correct thing
        '''
        self.assertEqual(self.fft.output_dtype, self.output_array.dtype)

        new_input_array = numpy.complex64(self.input_array)
        new_output_array = numpy.complex64(self.output_array)

        new_fft = FFTW(new_input_array, new_output_array)

        self.assertEqual(new_fft.output_dtype, new_output_array.dtype)
开发者ID:francispoulin,项目名称:pyFFTW,代码行数:11,代码来源:test_pyfftw_class_misc.py


示例20: test_compressed

    def test_compressed(self):
        s = readsav(path.join(DATA_PATH, "various_compressed.sav"), verbose=False)

        assert_identical(s.i8u, np.uint8(234))
        assert_identical(s.f32, np.float32(-3.1234567e37))
        assert_identical(s.c64, np.complex128(1.1987253647623157e112 - 5.1987258887729157e307j))
        assert_equal(s.array5d.shape, (4, 3, 4, 6, 5))
        assert_identical(s.arrays.a[0], np.array([1, 2, 3], dtype=np.int16))
        assert_identical(s.arrays.b[0], np.array([4.0, 5.0, 6.0, 7.0], dtype=np.float32))
        assert_identical(s.arrays.c[0], np.array([np.complex64(1 + 2j), np.complex64(7 + 8j)]))
        assert_identical(s.arrays.d[0], np.array([b"cheese", b"bacon", b"spam"], dtype=np.object))
开发者ID:annapowellsmith,项目名称:scipy,代码行数:11,代码来源:test_idl.py



注:本文中的numpy.complex64函数示例由纯净天空整理自Github/MSDocs等源码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。


鲜花

握手

雷人

路过

鸡蛋
该文章已有0人参与评论

请发表评论

全部评论

专题导读
上一篇:
Python numpy.complex_函数代码示例发布时间:2022-05-27
下一篇:
Python numpy.complex128函数代码示例发布时间:2022-05-27
热门推荐
阅读排行榜

扫描微信二维码

查看手机版网站

随时了解更新最新资讯

139-2527-9053

在线客服(服务时间 9:00~18:00)

在线QQ客服
地址:深圳市南山区西丽大学城创智工业园
电邮:jeky_zhao#qq.com
移动电话:139-2527-9053

Powered by 互联科技 X3.4© 2001-2213 极客世界.|Sitemap