#NEWLINE# def test_rot( ) : #NEWLINE# #INDENT# for dtype in 'fdFD' : #NEWLINE# #INDENT# c = 0.6 #NEWLINE# s = 0.8 #NEWLINE# u = ( np . ones ( 4 , dtype ) * 3 ) #NEWLINE# v = ( np . ones ( 4 , dtype ) * 4 ) #NEWLINE# atol = ( 10 ** ( - ( np . finfo ( dtype ) . precision - 1 ) ) ) #NEWLINE# if ( dtype in 'fd' ) : #NEWLINE# #INDENT# rot = get_blas_funcs ( 'rot' , dtype = dtype ) #NEWLINE# f = 4 #NEWLINE# #UNINDENT# else : #NEWLINE# #INDENT# rot = get_lapack_funcs ( 'rot' , dtype = dtype ) #NEWLINE# s *= ( - 1j ) #NEWLINE# v *= 1j #NEWLINE# f = 4j #NEWLINE# #UNINDENT# assert_allclose ( rot ( u , v , c , s ) , [ [ 5 , 5 , 5 , 5 ] , [ 0 , 0 , 0 , 0 ] ] , atol = atol ) #NEWLINE# assert_allclose ( rot ( u , v , c , s , n = 2 ) , [ [ 5 , 5 , 3 , 3 ] , [ 0 , 0 , f , f ] ] , atol = atol ) #NEWLINE# assert_allclose ( rot ( u , v , c , s , offx = 2 , offy = 2 ) , [ [ 3 , 3 , 5 , 5 ] , [ f , f , 0 , 0 ] ] , atol = atol ) #NEWLINE# assert_allclose ( rot ( u , v , c , s , incx = 2 , offy = 2 , n = 2 ) , [ [ 5 , 3 , 5 , 3 ] , [ f , f , 0 , 0 ] ] , atol = atol ) #NEWLINE# assert_allclose ( rot ( u , v , c , s , offx = 2 , incy = 2 , n = 2 ) , [ [ 3 , 3 , 5 , 5 ] , [ 0 , f , 0 , f ] ] , atol = atol ) #NEWLINE# assert_allclose ( rot ( u , v , c , s , offx = 2 , incx = 2 , offy = 2 , incy = 2 , n = 1 ) , [ [ 3 , 3 , 5 , 3 ] , [ f , f , 0 , f ] ] , atol = atol ) #NEWLINE# assert_allclose ( rot ( u , v , c , s , incx = ( - 2 ) , incy = ( - 2 ) , n = 2 ) , [ [ 5 , 3 , 5 , 3 ] , [ 0 , f , 0 , f ] ] , atol = atol ) #NEWLINE# ( a , b ) = rot ( u , v , c , s , overwrite_x = 1 , overwrite_y = 1 ) #NEWLINE# assert_ ( ( a is u ) ) #NEWLINE# assert_ ( ( b is v ) ) #NEWLINE# assert_allclose ( a , [ 5 , 5 , 5 , 5 ] , atol = atol ) #NEWLINE# assert_allclose ( b , [ 0 , 0 , 0 , 0 ] , atol = atol )