99# NOTE: Tests below fail for tolerance 1e-4 (error executing plan).
1010
1111DTYPES = [np .float32 , np .float64 ]
12- SHAPES = [(16 ,), (16 , 16 ), (16 , 16 , 16 )]
12+ SHAPES = [(16 ,), (16 , 16 ), (16 , 16 , 16 ), ( 19 ,), ( 17 , 19 ), ( 17 , 19 , 24 ) ]
1313MS = [256 , 1024 , 4096 ]
1414TOLS = [1e-3 , 1e-6 ]
1515OUTPUT_ARGS = [False , True ]
1616CONTIGUOUS = [False , True ]
17+ MODEORDS = [0 , 1 ]
1718
1819
1920@pytest .mark .parametrize ("dtype" , DTYPES )
2021@pytest .mark .parametrize ("shape" , SHAPES )
2122@pytest .mark .parametrize ("M" , MS )
2223@pytest .mark .parametrize ("tol" , TOLS )
2324@pytest .mark .parametrize ("output_arg" , OUTPUT_ARGS )
24- def test_type1 (to_gpu , to_cpu , dtype , shape , M , tol , output_arg ):
25+ @pytest .mark .parametrize ("modeord" , MODEORDS )
26+ def test_type1 (to_gpu , to_cpu , dtype , shape , M , tol , output_arg , modeord ):
2527 complex_dtype = utils ._complex_dtype (dtype )
2628
2729 k , c = utils .type1_problem (dtype , shape , M )
2830
2931 k_gpu = to_gpu (k )
3032 c_gpu = to_gpu (c )
3133
32- plan = Plan (1 , shape , eps = tol , dtype = complex_dtype )
34+ plan = Plan (1 , shape , eps = tol , dtype = complex_dtype , modeord = modeord )
3335
3436 # Since k_gpu is an array of shape (dim, M), this will expand to
3537 # plan.setpts(k_gpu[0], ..., k_gpu[dim]), allowing us to handle all
@@ -43,6 +45,8 @@ def test_type1(to_gpu, to_cpu, dtype, shape, M, tol, output_arg):
4345 fk_gpu = plan .execute (c_gpu )
4446
4547 fk = to_cpu (fk_gpu )
48+ if modeord == 1 :
49+ fk = np .fft .fftshift (fk )
4650
4751 utils .verify_type1 (k , c , fk , tol )
4852
@@ -53,12 +57,13 @@ def test_type1(to_gpu, to_cpu, dtype, shape, M, tol, output_arg):
5357@pytest .mark .parametrize ("tol" , TOLS )
5458@pytest .mark .parametrize ("output_arg" , OUTPUT_ARGS )
5559@pytest .mark .parametrize ("contiguous" , CONTIGUOUS )
56- def test_type2 (to_gpu , to_cpu , dtype , shape , M , tol , output_arg , contiguous ):
60+ @pytest .mark .parametrize ("modeord" , MODEORDS )
61+ def test_type2 (to_gpu , to_cpu , dtype , shape , M , tol , output_arg , contiguous , modeord ):
5762 complex_dtype = utils ._complex_dtype (dtype )
5863
5964 k , fk = utils .type2_problem (dtype , shape , M )
6065
61- plan = Plan (2 , shape , eps = tol , dtype = complex_dtype )
66+ plan = Plan (2 , shape , eps = tol , dtype = complex_dtype , modeord = modeord )
6267
6368 check_result = True
6469
@@ -81,7 +86,12 @@ def _execute(*args, **kwargs):
8186 return plan .execute (* args , ** kwargs )
8287
8388 k_gpu = to_gpu (k )
84- fk_gpu = to_gpu (fk )
89+
90+ if modeord == 1 :
91+ _fk = np .fft .ifftshift (fk )
92+ else :
93+ _fk = fk
94+ fk_gpu = to_gpu (_fk )
8595
8696 plan .setpts (* k_gpu )
8797
0 commit comments