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

Function precallback_complex_to_complex

src/tests/accuracy_test_common.h:125–204  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

123// tightly packed is inferred from strides.empty()
124template< class T, class cl_T, class fftw_T >
125void precallback_complex_to_complex( data_pattern pattern, direction::direction_t direction,
126 std::vector<size_t> lengths, size_t batch,
127 std::vector<size_t> input_strides, std::vector<size_t> output_strides,
128 size_t input_distance, size_t output_distance,
129 layout::buffer_layout_t in_layout, layout::buffer_layout_t out_layout,
130 placeness::placeness_t placeness, T scale = 1.0f, bool hasUserDatatype = false )
131{
132 clfft<T, cl_T> test_fft( static_cast<clfftDim>(lengths.size()), &lengths[0],
133 input_strides.empty() ? NULL : &input_strides[0],
134 output_strides.empty() ? NULL : &output_strides[0],
135 batch, input_distance, output_distance,
136 cl_layout(in_layout), cl_layout(out_layout),
137 cl_placeness(placeness) );
138
139 fftw<T, fftw_T> reference( lengths.size(), &lengths[0], batch, c2c );
140
141 //initialize input
142 if( pattern == sawtooth )
143 {
144 test_fft.set_input_to_sawtooth( 1.0f );
145 reference.set_data_to_sawtooth( 1.0f );
146 }
147 else if( pattern == value )
148 {
149 test_fft.set_input_to_value( 2.0f, 2.5f );
150 reference.set_all_data_to_value( 2.0f, 2.5f );
151 }
152 else if( pattern == impulse )
153 {
154 test_fft.set_input_to_impulse();
155 reference.set_data_to_impulse();
156 }
157 else if( pattern == erratic )
158 {
159 test_fft.set_input_to_random();
160 reference.set_data_to_random();
161 }
162 else
163 {
164 throw std::runtime_error( "invalid pattern type in complex_to_complex()" );
165 }
166
167 // if we're starting with unequal data, we're destined for failure
168 EXPECT_EQ( true, test_fft.input_buffer() == reference.input_buffer() );
169
170 //set precallback values
171 if (hasUserDatatype)
172 {
173 test_fft.set_input_precallback_userdatatype();
174 }
175 else
176 {
177 test_fft.set_input_precallback();
178 }
179 reference.set_input_precallback();
180
181 if( direction == direction::forward )
182 {

Callers

nothing calls this directly

Calls 15

cl_layoutFunction · 0.85
cl_placenessFunction · 0.85
sizeMethod · 0.80
set_input_to_sawtoothMethod · 0.80
set_data_to_sawtoothMethod · 0.80
set_input_to_valueMethod · 0.80
set_all_data_to_valueMethod · 0.80
set_input_to_impulseMethod · 0.80
set_data_to_impulseMethod · 0.80
set_input_to_randomMethod · 0.80
set_data_to_randomMethod · 0.80

Tested by

no test coverage detected