def scale_const(multiplier): """ Returns a scaling transformation with fixed parameter (1 output, 1 input): ``output1 = input1 * <multiplier>``. """ dtype = dtypes.detect_type(multiplier) return Transformation( inputs=1, outputs=1, code="${o1.store}(${func.mul(i1.dtype, numpy." + str(dtype) + ", out=o1.dtype)}(" + "${i1.load}, " + dtypes.c_constant(multiplier, dtype=dtype) + "));")
def scale_const(multiplier): """ Returns a scaling transformation with fixed parameter (1 output, 1 input): ``output1 = input1 * <multiplier>``. """ dtype = dtypes.detect_type(multiplier) return Transformation(inputs=1, outputs=1, code="${o1.store}(${func.mul(i1.dtype, numpy." + str(dtype) + ", out=o1.dtype)}(" + "${i1.load}, " + dtypes.c_constant(multiplier, dtype=dtype) + "));")
def prepare_for(self, max_local_size): local_size, workgroups_num, kwds = self._generate(max_local_size) kwds.update(dict( min_mem_coalesce_width=self._device_params.min_mem_coalesce_width[self._basis.dtype.itemsize], local_mem_banks=self._device_params.local_mem_banks, get_padding=get_padding, normalize=self._normalize, wrap_const=lambda x: dtypes.c_constant(x, dtypes.real_for(self._basis.dtype)), min_blocks=min_blocks, takes_kweights=(self.kweights is not None), pad_in=(self._fft_size != self._fft_size_real and self._pass_num == 0 and not self._reverse_direction), unpad_out=(self._fft_size != self._fft_size_real and self._last_pass and self._reverse_direction), reverse_direction=self._reverse_direction)) local_size = local_size global_size = local_size * workgroups_num return global_size, local_size, kwds
def prepare_for(self, max_local_size): local_size, workgroups_num, kwds = self._generate(max_local_size) kwds.update( dict(min_mem_coalesce_width=self._device_params. min_mem_coalesce_width[self._basis.dtype.itemsize], local_mem_banks=self._device_params.local_mem_banks, get_padding=get_padding, normalize=self._normalize, wrap_const=lambda x: dtypes.c_constant( x, dtypes.real_for(self._basis.dtype)), min_blocks=min_blocks, takes_kweights=(self.kweights is not None), pad_in=(self._fft_size != self._fft_size_real and self._pass_num == 0 and not self._reverse_direction), unpad_out=(self._fft_size != self._fft_size_real and self._last_pass and self._reverse_direction), reverse_direction=self._reverse_direction)) local_size = local_size global_size = local_size * workgroups_num return global_size, local_size, kwds