Kc@sddkZddkTddklZdZdZeedZdZ dZ d Z d Z d Z d Zd Zedjo endS(iN(t*(tbroadcast_arraysc Csqg}|D]}|ti|q ~}t|}g}|D]}||iqA~}|gt|} dS(sc Broadcast a list of arrays with the given input shapes and check the common output shape. N(tnptzerosRtshapetlen( t input_shapestexpected_shapet_[1]tstinarrayst outarrayst_[2]tat outshapestexpected((sH/usr/lib64/python2.6/site-packages/numpy/lib/tests/test_stride_tricks.pytassert_shapes_corrects * $cCs>g}|D]}|ti|q ~}ttt|dS(sw Broadcast a list of arrays with the given (incompatible) input shapes and check that they raise a ValueError. N(RRt assert_raisest ValueErrorR(RRR R ((sH/usr/lib64/python2.6/site-packages/numpy/lib/tests/test_stride_tricks.pyt assert_incompatible_shapes_raises*c Csti|dt}ttii|}ti|i|}|o|i}|i}n|o*|ddd}|ddd}n||}t||\}} t || dS(s Broadcast two shapes against each other and check that the data layout is the same as if a ufunc did the broadcasting. tdtypeNi( RRtinttmultiplytreducetarangetreshapetTRtassert_array_equal( tshape0tshape1t transposedtflippedtx0tntx1tytb0tb1((sH/usr/lib64/python2.6/site-packages/numpy/lib/tests/test_stride_tricks.pytassert_same_as_ufuncs   cCsQtid}tid}t||\}}t||t||dS(Ni (RRRR(txR#tbxtby((sH/usr/lib64/python2.6/site-packages/numpy/lib/tests/test_stride_tricks.pyt test_same-s  cCstidddgg}tidgdgdgg}t||\}}tidddgdddgdddgg}|i}t||t||dS(Niii(RtarrayRRR(R'R#R(R)tbx0tby0((sH/usr/lib64/python2.6/site-packages/numpy/lib/tests/test_stride_tricks.pyt test_one_off4s!3  c csddddd d d d d dg }x\|D]T}|g}t||fV||g}t||fV|||g}t||fVq+WdS(s9 Check that the final shape is just the input shape. iiiN((i(i(ii(ii(ii(ii(ii(ii(ii(R(tdataRRt input_shapes2t input_shapes3((sH/usr/lib64/python2.6/site-packages/numpy/lib/tests/test_stride_tricks.pyttest_same_input_shapes=s$   ccs ddgdgd d gd gd d gdgddgdgddgdgddgdgddgdgddgdgddgd gd!d"gd#gd$d%gd&gd'd(gd)gd*d+gd,gg }x=|D]5\}}t||fVt|ddd|fVqWdS(-su Check that two different input shapes (of the same length but some have 1s) broadcast to the correct shape. iiiNi(i(i(i(ii(ii(ii(ii(ii(ii(ii(ii(ii(ii(ii(ii(ii(ii(ii(ii(ii(ii(ii(ii(ii(ii(ii(ii(ii(ii(ii(ii(ii(ii(ii(ii(ii(ii(ii(ii(R(R/RR((sH/usr/lib64/python2.6/site-packages/numpy/lib/tests/test_stride_tricks.pyt(test_two_compatible_by_ones_input_shapesWs" ccsvddgdgd d gd gd d gdgddgdgddgdgddgdgddgdgddgdgddgd gd!d"gd#gd$d%gd&gd'd(gd)gd*d+gd,gd-d.gd/gd0d1gd2gd3d4gd5gd6d7gd8gd9d:gd;gd<d=gd>gd?d@gdAgg}x=|D]5\}}t||fVt|ddd|fVq9WdS(Bsf Check that two different input shapes (of different lengths) broadcast to the correct shape. iiiNi((i(i(i(ii(ii(i(ii(ii(i(ii(ii((ii(ii(ii(i(ii(i(ii(ii(i(ii(ii((ii(ii((ii(ii((i(i(i(ii(ii(i(ii(ii(i(ii(ii((ii(ii(ii(i(ii(i(ii(ii(i(ii(ii((ii(ii((ii(ii(R(R/RR((sH/usr/lib64/python2.6/site-packages/numpy/lib/tests/test_stride_tricks.pyt3test_two_compatible_by_prepending_ones_input_shapesos0 ccseddgd d gd d d gddgg}x1|D])}t|fVt|dddfVq4WdS(s@ Check that a ValueError is raised for incompatible shapes. iiiiNi(i(i(ii(i(i(i(i(iii(iii(R(R/R((sH/usr/lib64/python2.6/site-packages/numpy/lib/tests/test_stride_tricks.pyt)test_incompatible_shapes_raise_valueerrors    c#csddgdgdd gd gd d gd gddgdgddgdgddgdgddgdgddgdgddgdgd d!gd"gd#d$gd%gd&d'gd(gd)d*gd+gd,d-gd.gd/d0gd1gd2d3gd4gd5d6gd7gd8d9gd:gd;d<gd=gd>d?gd@gdAdBgdCgdDdEgdFgdGdHgdIgdJdKgdLgdMdNgdOgdPdQgdRgdSdTgdUgdVdWgdXgdYdZgd[gd\d]gd^gd_d`gdagdbdcgddgdedfgdggg!}x|D]\}}t|d|dfVt|d|dfVt|d|dtfVdh|jo<t|d|dttfVt|d|dttfVqqWdS(isM Check that the data layout is the same as if a ufunc did the operation. iiiN(i(i(i(ii(ii(ii(ii(ii(ii(ii(ii(ii(ii(ii(ii(ii(ii(ii(ii(ii(ii(ii(ii(ii(ii(ii(ii(ii(ii(ii(ii(ii(ii(ii(ii(ii(ii(ii(ii((i(i(i(ii(ii(i(ii(ii(i(ii(ii((ii(ii(ii(i(ii(i(ii(ii(i(ii(ii((ii(ii((ii(ii((i(i(i(ii(ii(i(ii(ii(i(ii(ii((ii(ii(ii(i(ii(i(ii(ii(i(ii(ii((ii(ii((ii(ii((R&tTruetFalse(R/RR((sH/usr/lib64/python2.6/site-packages/numpy/lib/tests/test_stride_tricks.pyttest_same_as_ufuncsR  t__main__(tnumpyRt numpy.testingtnumpy.lib.stride_tricksRRRR7R&R*R.R2R3R4R5R8t__name__trun_module_suite(((sH/usr/lib64/python2.6/site-packages/numpy/lib/tests/test_stride_tricks.pyts         3