[vsipl++] [patch] support for non-contiguous rows or columns with Cell FFTM

Stefan Seefeld stefan at codesourcery.com
Wed Mar 14 03:58:40 UTC 2007


Please find attached a cleanup patch. (Checked in.)
Comments below...

Stefan Seefeld wrote:
> Don McCoy wrote:

> 
>> Index: tests/fft_be.cpp
>> ===================================================================
>> --- tests/fft_be.cpp	(revision 165340)
>> +++ tests/fft_be.cpp	(working copy)
> 
> [...]
> 
>> @@ -152,24 +166,33 @@
>>    static Domain<D> out_dom(Domain<D> const &dom) { return dom;}
>>  };
>>  
>> -template <typename T>
>> +template <typename T,
>> +          typename OrderT>
>>  const_Vector<T, impl::Generator_expr_block<1, impl::Ramp_generator<T> > const>
>>  ramp(Domain<1> const &dom) 
>>  { return vsip::ramp(T(0.), T(1.), dom.length() * dom.stride());}
>>  
>> -template <typename T>
>> -Matrix<T>
>> +template <typename T,
>> +          typename OrderT>
>> +Matrix<T, Dense<2, T, OrderT> >
>>  ramp(Domain<2> const &dom) 
>>  {
>> +  typedef OrderT order_type;
>> +  typedef Dense<2, T, order_type> block_type;
>>    length_type rows = dom[0].length() * dom[0].stride();
>>    length_type cols = dom[1].length() * dom[1].stride();
>> -  Matrix<T> m(rows, cols);
>> -  for (size_t r = 0; r != rows; ++r)
>> -    m.row(r) = ramp(T(r), T(1.), m.size(1));
>> +  Matrix<T, block_type> m(rows, cols);
>> +  if (impl::Type_equal<row2_type, order_type>::value)
>> +    for (size_t r = 0; r != rows; ++r)
>> +      m.row(r) = ramp(T(r), T(1.), m.size(1));
>> +  else
>> +    for (size_t c = 0; c != cols; ++c)
>> +      m.col(c) = ramp(T(c), T(1.), m.size(0));
>>    return m;
>>  }
> 
> While I like the addition of the dimension-ordering parameter, I think
> the conditional initialization here is a bit misleading: The value of
> matrix(x, y) should be the same, no matter its dimension-ordering.

Having another look at that code I realized that the layout of the
views created by ramp() (and input_creator::create(), for that matter),
doesn't play any role in the actual tests, as they are assigned to other
views only. Thus, I removed the dimension-ordering parameter from the above,
only adding it to the harness in fft_by_ref and fftm_by_ref.
I still need to change the way fft_in_place as well as fftm_in_place handle
their template parameters, so I can easily add the dimension-ordering there,
too, but I'll defer that to some later point.

Thanks,
		Stefan

-- 
Stefan Seefeld
CodeSourcery
stefan at codesourcery.com
(650) 331-3385 x718
-------------- next part --------------
A non-text attachment was scrubbed...
Name: fft_be.cpp.diff
Type: text/x-patch
Size: 4065 bytes
Desc: not available
URL: <http://sourcerytools.com/pipermail/vsipl++/attachments/20070313/c10d496a/attachment.bin>


More information about the vsipl++ mailing list