del c16 del c16out del c16dat lal.CheckMemoryLeaks() print("PASSED input views of numeric array structs (LAL)") vfdat = numpy.array([1.2, 2.3, 3.4, 4.5, 5.6], dtype=numpy.float32) vddat = numpy.array([3.4, 4.5, 5.6, 6.7, 7.8, 8.9], dtype=numpy.float64) vcfdat = numpy.array(numpy.vectorize(complex)(vfdat, 8 + vfdat), dtype=numpy.complex64) vcddat = numpy.array(numpy.vectorize(complex)(vddat, 16 + vddat), dtype=numpy.complex128) vf = lal.gsl_vector_float(len(vfdat)) vf.data = vfdat vfout = lal.gsl_vector_float(len(vfdat)) vfout.data = numpy.zeros(numpy.shape(vfdat), dtype=vfdat.dtype) assert (lal.swig_lal_test_viewin_gsl_vector_float(vfout, vf)) assert ((vfout.data == vf.data).all()) vfout.data = numpy.zeros(numpy.shape(vfdat), dtype=vfdat.dtype) assert (lal.swig_lal_test_viewin_gsl_vector_float(vfout, vfdat)) assert ((vfout.data == vfdat).all()) vfout.data = numpy.zeros(numpy.shape(vfdat), dtype=vfdat.dtype) assert (lal.swig_lal_test_viewinout_gsl_vector_float(vfout, vf)) assert ((2 * vfout.data == vf.data).all()) vfout.data = numpy.zeros(numpy.shape(vfdat), dtype=vfdat.dtype) assert (lal.swig_lal_test_viewinout_gsl_vector_float(vfout, vfdat)) assert ((2 * vfout.data == vfdat).all()) vf.data = vfdat assert (lal.swig_lal_test_copyinout_gsl_vector_float(vf)) assert ((vf.data == 3 * vfdat).all()) vf.data = vfdat retn, vf = lal.swig_lal_test_copyinout_gsl_vector_float(vf)
assert(lal.swig_lal_test_viewinout_COMPLEX16VectorSequence(c16out, c16dat)) assert((2 * c16out.data == c16dat).all()) del c16 del c16out del c16dat lal.CheckMemoryLeaks() print("PASSED input views of array structs (LAL)") vfdat = numpy.array([1.2, 2.3, 3.4, 4.5, 5.6], dtype=numpy.float32) vddat = numpy.array([3.4, 4.5, 5.6, 6.7, 7.8, 8.9], dtype=numpy.float64) vcfdat = numpy.array(numpy.vectorize(complex)(vfdat, 8 + vfdat), dtype=numpy.complex64) vcddat = numpy.array(numpy.vectorize(complex)(vddat, 16 + vddat), dtype=numpy.complex128) vf = lal.gsl_vector_float(len(vfdat)) vf.data = vfdat vfout = lal.gsl_vector_float(len(vfdat)) vfout.data = numpy.zeros(numpy.shape(vfdat), dtype=vfdat.dtype) assert(lal.swig_lal_test_viewin_gsl_vector_float(vfout, vf)) assert((vfout.data == vf.data).all()) vfout.data = numpy.zeros(numpy.shape(vfdat), dtype=vfdat.dtype) assert(lal.swig_lal_test_viewin_gsl_vector_float(vfout, vfdat)) assert((vfout.data == vfdat).all()) vfout.data = numpy.zeros(numpy.shape(vfdat), dtype=vfdat.dtype) assert(lal.swig_lal_test_viewinout_gsl_vector_float(vfout, vf)) assert((2 * vfout.data == vf.data).all()) vfout.data = numpy.zeros(numpy.shape(vfdat), dtype=vfdat.dtype) assert(lal.swig_lal_test_viewinout_gsl_vector_float(vfout, vfdat)) assert((2 * vfout.data == vfdat).all()) del vf del vfout del vfdat lal.CheckMemoryLeaks() vd = lal.gsl_vector(len(vddat))