MCPcopy Create free account
hub / github.com/clMathLibraries/clFFT / Parameters

Method Parameters

src/tests/accuracy_test_random.cpp:245–526  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

243 }
244
245 Parameters()
246 : precision( static_cast<clfftPrecision>(random_int(CLFFT_SINGLE,CLFFT_DOUBLE)) )
247 , dimensions( static_cast<clfftDim>(random_int(CLFFT_1D,ENDDIMENSION-1)) )
248 , placeness( static_cast<clfftResultLocation>(random_int(CLFFT_INPLACE, CLFFT_OUTOFPLACE)) )
249 , input_layout( static_cast<clfftLayout>(random_int(CLFFT_COMPLEX_INTERLEAVED, CLFFT_REAL)) )
250 , forward_scale( static_cast<float>(random_int())/static_cast<float>(random_int()) )
251 , backward_scale( static_cast<float>(random_int())/static_cast<float>(random_int()) )
252 , pattern( erratic )
253 , data_seed( random_int() )
254 {
255 try
256 {
257 // input and output layouts have strict requirements, so we'll base the output layout
258 // off of our randomly selected input layout
259 if( input_layout == CLFFT_REAL )
260 {
261 if( placeness == CLFFT_INPLACE )
262 output_layout = CLFFT_HERMITIAN_INTERLEAVED;
263 else if( placeness == CLFFT_OUTOFPLACE )
264 output_layout = static_cast<clfftLayout>(random_int(CLFFT_HERMITIAN_INTERLEAVED, CLFFT_HERMITIAN_PLANAR));
265 else
266 throw std::runtime_error( "parameter generator invalid placeness" );
267 }
268 else if( input_layout == CLFFT_HERMITIAN_INTERLEAVED )
269 {
270 output_layout = CLFFT_REAL;
271 }
272 else if( input_layout == CLFFT_HERMITIAN_PLANAR )
273 {
274 // in-place transforms not supported with hermitian planar
275 placeness = CLFFT_OUTOFPLACE;
276
277 output_layout = CLFFT_REAL;
278 }
279 else if( input_layout == CLFFT_COMPLEX_INTERLEAVED || input_layout == CLFFT_COMPLEX_PLANAR )
280 {
281 // complex is a little simpler. we can do them together here
282 if( placeness == CLFFT_INPLACE )
283 output_layout = input_layout;
284 else
285 output_layout = static_cast<clfftLayout>(random_int(CLFFT_COMPLEX_INTERLEAVED, CLFFT_COMPLEX_PLANAR));
286 }
287 else
288 {
289 throw std::runtime_error( "parameter generator invalid input layout" );
290 }
291
292 direction = random_int(0,1) ? CLFFT_FORWARD : CLFFT_BACKWARD;
293
294 lengths = random_supported_problem_size(dimensions, precision, input_layout);
295
296 // strides and distances
297
298 if( fifty_percent_chance() ) // about half the time, we just want unit strides
299 {
300 // input_strides and output_strides remain empty
301
302 input_distance = 0;

Callers

nothing calls this directly

Calls 4

random_intFunction · 0.85
handle_exceptionFunction · 0.85

Tested by

no test coverage detected