assert ((mcf == 3 * mcfdat).all()) del mcf del mcfout del mcfdat lal.CheckMemoryLeaks() mcd = lal.gsl_matrix_complex(mcddat.shape[0], mcddat.shape[1]) mcd.data = mcddat mcdout = lal.gsl_matrix_complex(mcddat.shape[0], mcddat.shape[1]) mcdout.data = numpy.zeros(numpy.shape(mcddat), dtype=mcddat.dtype) assert (lal.swig_lal_test_viewin_gsl_matrix_complex(mcdout, mcd)) assert ((mcdout.data == mcd.data).all()) mcdout.data = numpy.zeros(numpy.shape(mcddat), dtype=mcddat.dtype) assert (lal.swig_lal_test_viewin_gsl_matrix_complex(mcdout, mcddat)) assert ((mcdout.data == mcddat).all()) mcdout.data = numpy.zeros(numpy.shape(mcddat), dtype=mcddat.dtype) assert (lal.swig_lal_test_viewinout_gsl_matrix_complex(mcdout, mcd)) assert ((2 * mcdout.data == mcd.data).all()) mcdout.data = numpy.zeros(numpy.shape(mcddat), dtype=mcddat.dtype) assert (lal.swig_lal_test_viewinout_gsl_matrix_complex(mcdout, mcddat)) assert ((2 * mcdout.data == mcddat).all()) mcd.data = mcddat assert (lal.swig_lal_test_copyinout_gsl_matrix_complex(mcd)) assert ((mcd.data == 3 * mcddat).all()) mcd.data = mcddat retn, mcd = lal.swig_lal_test_copyinout_gsl_matrix_complex(mcd) assert (retn) assert ((mcd.data == 3 * mcddat).all()) mcd = mcddat retn, mcd = lal.swig_lal_test_copyinout_gsl_matrix_complex(mcd) assert (retn) assert ((mcd == 3 * mcddat).all())
assert((2 * mcfout.data == mcfdat).all()) del mcf del mcfout del mcfdat lal.CheckMemoryLeaks() mcd = lal.gsl_matrix_complex(mcddat.shape[0], mcddat.shape[1]) mcd.data = mcddat mcdout = lal.gsl_matrix_complex(mcddat.shape[0], mcddat.shape[1]) mcdout.data = numpy.zeros(numpy.shape(mcddat), dtype=mcddat.dtype) assert(lal.swig_lal_test_viewin_gsl_matrix_complex(mcdout, mcd)) assert((mcdout.data == mcd.data).all()) mcdout.data = numpy.zeros(numpy.shape(mcddat), dtype=mcddat.dtype) assert(lal.swig_lal_test_viewin_gsl_matrix_complex(mcdout, mcddat)) assert((mcdout.data == mcddat).all()) mcdout.data = numpy.zeros(numpy.shape(mcddat), dtype=mcddat.dtype) assert(lal.swig_lal_test_viewinout_gsl_matrix_complex(mcdout, mcd)) assert((2 * mcdout.data == mcd.data).all()) mcdout.data = numpy.zeros(numpy.shape(mcddat), dtype=mcddat.dtype) assert(lal.swig_lal_test_viewinout_gsl_matrix_complex(mcdout, mcddat)) assert((2 * mcdout.data == mcddat).all()) del mcd del mcdout del mcddat lal.CheckMemoryLeaks() print("PASSED input views of array structs (GSL)") def check_input_view_type_safety(f, a, b, expect_exception): expected_exception = False if expect_exception: try: f(a, b) expected_exception = True