Kc @ s d d k Z d d k Td d k l Z d Z d Z e e d Z d Z d Z d Z d Z d Z d Z d Z e d j o e n d S( iN( t *( t broadcast_arraysc C sq g } | D] } | t i | q ~ } t | } g } | D] } | | i qA ~ } | g t | } d S( sc Broadcast a list of arrays with the given input shapes and check the common output shape. N( t npt zerosR t shapet len( t input_shapest expected_shapet _[1]t st inarrayst outarrayst _[2]t at outshapest expected( ( sH /usr/lib64/python2.6/site-packages/numpy/lib/tests/test_stride_tricks.pyt assert_shapes_correct s *$c C s> g } | D] } | t i | q ~ } t t t | d S( sw Broadcast a list of arrays with the given (incompatible) input shapes and check that they raise a ValueError. N( R R t assert_raisest ValueErrorR ( R R R R ( ( sH /usr/lib64/python2.6/site-packages/numpy/lib/tests/test_stride_tricks.pyt assert_incompatible_shapes_raise s *c C s t i | d t } t t i i | } t i | i | } | o | i } | i } n | o* | d d d } | d d d } n | | } t | | \ } } t | | d S( s Broadcast two shapes against each other and check that the data layout is the same as if a ufunc did the broadcasting. t dtypeNi( R R t intt multiplyt reducet aranget reshapet TR t assert_array_equal( t shape0t shape1t transposedt flippedt x0t nt x1t yt b0t b1( ( sH /usr/lib64/python2.6/site-packages/numpy/lib/tests/test_stride_tricks.pyt assert_same_as_ufunc s c C sQ t i d } t i d } t | | \ } } t | | t | | d S( Ni ( R R R R ( t xR# t bxt by( ( sH /usr/lib64/python2.6/site-packages/numpy/lib/tests/test_stride_tricks.pyt test_same- s c C s t i d d d g g } t i d g d g d g g } t | | \ } } t i d d d g d d d g d d d g g } | i } t | | t | | d S( Ni i i ( R t arrayR R R ( R' R# R( R) t bx0t by0( ( sH /usr/lib64/python2.6/site-packages/numpy/lib/tests/test_stride_tricks.pyt test_one_off4 s !3 c c s d d d d d d d d d d g } x\ | D]T } | g } t | | f V| | g } t | | f V| | | g } t | | f Vq+ Wd S( s9 Check that the final shape is just the input shape. i i i N( ( i ( i ( i i ( i i ( i i ( i i ( i i ( i i ( i i ( R ( t dataR R t input_shapes2t input_shapes3( ( sH /usr/lib64/python2.6/site-packages/numpy/lib/tests/test_stride_tricks.pyt test_same_input_shapes= s$ c c s d d g d g d d g d g d d g d g d d g d g d d g d g d d g d g d d g d g d d g d g d d g d g d! d" g d# g d$ d% g d&