Пример #1
0
assert ((vcd.data == 3 * vcddat).all())
vcd = vcddat
retn, vcd = lal.swig_lal_test_copyinout_gsl_vector_complex(vcd)
assert (retn)
assert ((vcd == 3 * vcddat).all())
del vcd
del vcdout
del vcddat
lal.CheckMemoryLeaks()
mfdat = numpy.array([[1.2, 2.3, 3.4], [4.5, 5.6, 6.7]], dtype=numpy.float32)
mddat = numpy.array([[3.4, 4.5], [5.6, 6.7], [7.8, 8.9]], dtype=numpy.float64)
mcfdat = numpy.array(numpy.vectorize(complex)(mfdat, 8 + mfdat),
                     dtype=numpy.complex64)
mcddat = numpy.array(numpy.vectorize(complex)(mddat, 16 + mddat),
                     dtype=numpy.complex128)
mf = lal.gsl_matrix_float(mfdat.shape[0], mfdat.shape[1])
mf.data = mfdat
mfout = lal.gsl_matrix_float(mfdat.shape[0], mfdat.shape[1])
mfout.data = numpy.zeros(numpy.shape(mfdat), dtype=mfdat.dtype)
assert (lal.swig_lal_test_viewin_gsl_matrix_float(mfout, mf))
assert ((mfout.data == mf.data).all())
mfout.data = numpy.zeros(numpy.shape(mfdat), dtype=mfdat.dtype)
assert (lal.swig_lal_test_viewin_gsl_matrix_float(mfout, mfdat))
assert ((mfout.data == mfdat).all())
mfout.data = numpy.zeros(numpy.shape(mfdat), dtype=mfdat.dtype)
assert (lal.swig_lal_test_viewinout_gsl_matrix_float(mfout, mf))
assert ((2 * mfout.data == mf.data).all())
mfout.data = numpy.zeros(numpy.shape(mfdat), dtype=mfdat.dtype)
assert (lal.swig_lal_test_viewinout_gsl_matrix_float(mfout, mfdat))
assert ((2 * mfout.data == mfdat).all())
mf.data = mfdat
Пример #2
0
assert((vcdout.data == vcddat).all())
vcdout.data = numpy.zeros(numpy.shape(vcddat), dtype=vcddat.dtype)
assert(lal.swig_lal_test_viewinout_gsl_vector_complex(vcdout, vcd))
assert((2 * vcdout.data == vcd.data).all())
vcdout.data = numpy.zeros(numpy.shape(vcddat), dtype=vcddat.dtype)
assert(lal.swig_lal_test_viewinout_gsl_vector_complex(vcdout, vcddat))
assert((2 * vcdout.data == vcddat).all())
del vcd
del vcdout
del vcddat
lal.CheckMemoryLeaks()
mfdat = numpy.array([[1.2, 2.3, 3.4], [4.5, 5.6, 6.7]], dtype=numpy.float32)
mddat = numpy.array([[3.4, 4.5], [5.6, 6.7], [7.8, 8.9]], dtype=numpy.float64)
mcfdat = numpy.array(numpy.vectorize(complex)(mfdat, 8 + mfdat), dtype=numpy.complex64)
mcddat = numpy.array(numpy.vectorize(complex)(mddat, 16 + mddat), dtype=numpy.complex128)
mf = lal.gsl_matrix_float(mfdat.shape[0], mfdat.shape[1])
mf.data = mfdat
mfout = lal.gsl_matrix_float(mfdat.shape[0], mfdat.shape[1])
mfout.data = numpy.zeros(numpy.shape(mfdat), dtype=mfdat.dtype)
assert(lal.swig_lal_test_viewin_gsl_matrix_float(mfout, mf))
assert((mfout.data == mf.data).all())
mfout.data = numpy.zeros(numpy.shape(mfdat), dtype=mfdat.dtype)
assert(lal.swig_lal_test_viewin_gsl_matrix_float(mfout, mfdat))
assert((mfout.data == mfdat).all())
mfout.data = numpy.zeros(numpy.shape(mfdat), dtype=mfdat.dtype)
assert(lal.swig_lal_test_viewinout_gsl_matrix_float(mfout, mf))
assert((2 * mfout.data == mf.data).all())
mfout.data = numpy.zeros(numpy.shape(mfdat), dtype=mfdat.dtype)
assert(lal.swig_lal_test_viewinout_gsl_matrix_float(mfout, mfdat))
assert((2 * mfout.data == mfdat).all())
del mf