Current File : //usr/lib64/python2.7/site-packages/numpy/lib/tests/test_stride_tricks.pyc
�
E�`Qc@s�ddlZddlTddlmZd�Zd�Zeed�Zd�Z	d�Z
d	�Zd
�Zd�Z
d�Zd
�Zedkr�e�ndS(i����N(t*(tbroadcast_arrayscCsng|D]}tj|�^q}t|�}g|D]}|j^q5}|gt|�}t||�dS(sc Broadcast a list of arrays with the given input shapes and check the
    common output shape.
    N(tnptzerosRtshapetlentassert_equal(tinput_shapestexpected_shapetstinarrayst	outarraystat	outshapestexpected((sH/usr/lib64/python2.7/site-packages/numpy/lib/tests/test_stride_tricks.pytassert_shapes_corrects
"cCs6g|D]}tj|�^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(RR	R
((sH/usr/lib64/python2.7/site-packages/numpy/lib/tests/test_stride_tricks.pyt assert_incompatible_shapes_raises"c
Cs�tj|dt�}ttjj|��}tj|�j|�}|r`|j}|j}n|r�|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.7/site-packages/numpy/lib/tests/test_stride_tricks.pytassert_same_as_ufuncs	
cCsQtjd�}tjd�}t||�\}}t||�t||�dS(Ni
(RRRR(txR"tbxtby((sH/usr/lib64/python2.7/site-packages/numpy/lib/tests/test_stride_tricks.pyt	test_same-s

cCs�tjdddgg�}tjdgdgdgg�}t||�\}}tjdddgdddgdddgg�}|j}t||�t||�dS(Niii(RtarrayRRR(R&R"R'R(tbx0tby0((sH/usr/lib64/python2.7/site-packages/numpy/lib/tests/test_stride_tricks.pyttest_one_off4s!3	
cCs�ddddd	d
ddd
dg
}xY|D]Q}|g}t||�||g}t||�|||g}t||�q+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.7/site-packages/numpy/lib/tests/test_stride_tricks.pyttest_same_input_shapes=s"	
	

cCsddgdgd	d
gdgdd
gdgddgdgddgdgddgdgddgdgddgdgddgd gd!d"gd#gd$d%gd&gd'd(gd)gd*d+gd,gg
}x;|D]3\}}t||�t|ddd�|�q�WdS(-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.7/site-packages/numpy/lib/tests/test_stride_tricks.pyt(test_two_compatible_by_ones_input_shapesWs 
cCstddgdgd	d
gdgd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]3\}}t||�t|ddd�|�q9WdS(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.7/site-packages/numpy/lib/tests/test_stride_tricks.pyt3test_two_compatible_by_prepending_ones_input_shapesos.
cCscddgd	d
gddd
gddgg}x/|D]'}t|�t|ddd��q4WdS(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.7/site-packages/numpy/lib/tests/test_stride_tricks.pyt)test_incompatible_shapes_raise_valueerror�s		

c#Cs�ddgdgd	d
gdgdd
gdgddgdgddgdgddgdgddgdgddgdgddgd gd!d"gd#gd$d%gd&gd'd(gd)gd*d+gd,gd-d.gd/gd0d1gd2gd3d4gd5gd6d7gd8gd9d:gd;gd<d=gd>gd?d@gdAgdBdCgdDgdEdFgdGgdHdIgdJgdKdLgdMgdNdOgdPgdQdRgdSgdTdUgdVgdWdXgdYgdZd[gd\gd]d^gd_gd`dagdbgdcddgdegdfdggdhgg!}x�|D]�\}}t|d|dd|d|df�t|d|d�t|d|dt�di|kr�t|d|dtt�t|d|dtt�q�q�WdS(jsM Check that the data layout is the same as if a ufunc did the operation.
    iiis
Shapes: %s %sN(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.7/site-packages/numpy/lib/tests/test_stride_tricks.pyttest_same_as_ufunc�sRt__main__(tnumpyRt
numpy.testingtnumpy.lib.stride_tricksRRRR6R%R)R-R1R2R3R4R7t__name__trun_module_suite(((sH/usr/lib64/python2.7/site-packages/numpy/lib/tests/test_stride_tricks.pyt<module>s
	
									4