<?xml version="1.0" encoding="UTF-8"?>
<rss version="2.0">
  <channel>
    <link>http://www.mathworks.com/matlabcentral/newsreader/view_thread/265266</link>
    <title>MATLAB Central Newsreader - FFT and small prime factors</title>
    <description>Feed for thread: FFT and small prime factors</description>
    <language>en-us</language>
    <copyright>&amp;copy;1994-2012 by MathWorks, Inc.</copyright>
    <webmaster>webmaster@mathworks.com</webmaster>
    <generator>MATLAB Central Newsreader</generator>
    <docs>http://blogs.law.harvard.edu/tech/rss</docs>
    <ttl>60</ttl>
    <image>
      <title>MathWorks</title>
      <url>http://www.mathworks.com/images/membrane_icon.gif</url>
    </image>
    <item>
      <pubDate>Sun, 08 Nov 2009 03:46:02 -0500</pubDate>
      <title>FFT and small prime factors</title>
      <link>http://www.mathworks.com/matlabcentral/newsreader/view_thread/265266#692955</link>
      <author>Rodrigo </author>
      <description>I'm writing some code that will be used to convolve large amounts of data in a little time as possible (~1 million 1D ffts, each of of which has a few thousand entries).  To make this run as fast as possible I was wondering if anyone knew of an algorithm that approximates a number N with the closest number M such that M=2^a*3^b*5^c (a,b,c integers)&lt;br&gt;
&lt;br&gt;
Doing this for a single prime factor is trivial, but the resolution in M is such that you end up padding with too many zeros or throwing away a lot of data.  Adding the extra factors improves the resolution and should not reduce the performance of the algorithm too much.&lt;br&gt;
&lt;br&gt;
I can think of a direct search algorithm for this using the distance of a point to a hyperplane as a metric, but I was hoping there was a more elegant solution to this.&lt;br&gt;
&lt;br&gt;
Cheers</description>
    </item>
    <item>
      <pubDate>Sun, 08 Nov 2009 23:18:01 -0500</pubDate>
      <title>Re: FFT and small prime factors</title>
      <link>http://www.mathworks.com/matlabcentral/newsreader/view_thread/265266#693092</link>
      <author>Rodrigo </author>
      <description>&quot;Rodrigo&quot; &amp;lt;guerra.remove.this@physics.harvard.edu&amp;gt; wrote in message &amp;lt;hd5etq$j9f$1@fred.mathworks.com&amp;gt;...&lt;br&gt;
&amp;gt; I'm writing some code that will be used to convolve large amounts of data in a little time as possible (~1 million 1D ffts, each of of which has a few thousand entries).  To make this run as fast as possible I was wondering if anyone knew of an algorithm that approximates a number N with the closest number M such that M=2^a*3^b*5^c (a,b,c integers)&lt;br&gt;
&amp;gt; &lt;br&gt;
&amp;gt; Doing this for a single prime factor is trivial, but the resolution in M is such that you end up padding with too many zeros or throwing away a lot of data.  Adding the extra factors improves the resolution and should not reduce the performance of the algorithm too much.&lt;br&gt;
&amp;gt; &lt;br&gt;
&amp;gt; I can think of a direct search algorithm for this using the distance of a point to a hyperplane as a metric, but I was hoping there was a more elegant solution to this.&lt;br&gt;
&amp;gt; &lt;br&gt;
&amp;gt; Cheers&lt;br&gt;
&lt;br&gt;
Any thoughts?</description>
    </item>
    <item>
      <pubDate>Sun, 08 Nov 2009 23:42:07 -0500</pubDate>
      <title>Re: FFT and small prime factors</title>
      <link>http://www.mathworks.com/matlabcentral/newsreader/view_thread/265266#693100</link>
      <author>TideMan</author>
      <description>On Nov 9, 12:18&#160;pm, &quot;Rodrigo&quot; &amp;lt;guerra.remove.t...@physics.harvard.edu&amp;gt;&lt;br&gt;
wrote:&lt;br&gt;
&amp;gt; &quot;Rodrigo&quot; &amp;lt;guerra.remove.t...@physics.harvard.edu&amp;gt; wrote in message &amp;lt;hd5etq$j9...@fred.mathworks.com&amp;gt;...&lt;br&gt;
&amp;gt; &amp;gt; I'm writing some code that will be used to convolve large amounts of data in a little time as possible (~1 million 1D ffts, each of of which has a few thousand entries). &#160;To make this run as fast as possible I was wondering if anyone knew of an algorithm that approximates a number N with the closest number M such that M=2^a*3^b*5^c (a,b,c integers)&lt;br&gt;
&amp;gt;&lt;br&gt;
&amp;gt; &amp;gt; Doing this for a single prime factor is trivial, but the resolution in M is such that you end up padding with too many zeros or throwing away a lot of data. &#160;Adding the extra factors improves the resolution and should not reduce the performance of the algorithm too much.&lt;br&gt;
&amp;gt;&lt;br&gt;
&amp;gt; &amp;gt; I can think of a direct search algorithm for this using the distance of a point to a hyperplane as a metric, but I was hoping there was a more elegant solution to this.&lt;br&gt;
&amp;gt;&lt;br&gt;
&amp;gt; &amp;gt; Cheers&lt;br&gt;
&amp;gt;&lt;br&gt;
&amp;gt; Any thoughts?&lt;br&gt;
&lt;br&gt;
I looked at it and couldn't figure out what you were getting at.&lt;br&gt;
Do you want an algorithm that calculates numbers that have primes of&lt;br&gt;
2, 3, 5 (a la Singleton's FFT that takes numbers with primes up to&lt;br&gt;
23), or what?&lt;br&gt;
And if each FFT is for only a few thousand points, I don't know what&lt;br&gt;
you're worried about.&lt;br&gt;
Just use Matlab's FFT on whatever number you have.  It is very fast.</description>
    </item>
    <item>
      <pubDate>Mon, 09 Nov 2009 00:28:46 -0500</pubDate>
      <title>Re: FFT and small prime factors</title>
      <link>http://www.mathworks.com/matlabcentral/newsreader/view_thread/265266#693109</link>
      <author>dbd</author>
      <description>On Nov 7, 7:46&#160;pm, &quot;Rodrigo&quot; &amp;lt;guerra.remove.t...@physics.harvard.edu&amp;gt;&lt;br&gt;
wrote:&lt;br&gt;
&amp;gt; I'm writing some code that will be used to convolve large amounts of data in a little time as possible (~1 million 1D ffts, each of of which has a few thousand entries). &#160;To make this run as fast as possible I was wondering if anyone knew of an algorithm that approximates a number N with the closest number M such that M=2^a*3^b*5^c (a,b,c integers)&lt;br&gt;
&amp;gt;&lt;br&gt;
&amp;gt; Doing this for a single prime factor is trivial, but the resolution in M is such that you end up padding with too many zeros or throwing away a lot of data. &#160;Adding the extra factors improves the resolution and should not reduce the performance of the algorithm too much.&lt;br&gt;
&amp;gt;&lt;br&gt;
&amp;gt; I can think of a direct search algorithm for this using the distance of a point to a hyperplane as a metric, but I was hoping there was a more elegant solution to this.&lt;br&gt;
&amp;gt;&lt;br&gt;
&amp;gt; Cheers&lt;br&gt;
&lt;br&gt;
Rodrigo&lt;br&gt;
&lt;br&gt;
I'm not going to suggest an algorithm for you, but I will suggest&lt;br&gt;
reasons why I don't think the algorithm you seek will provide the most&lt;br&gt;
efficient solution to your fft application.&lt;br&gt;
1) solutions should be weighted by the 'efficiency' of the kernels&lt;br&gt;
used&lt;br&gt;
2) the most efficient kernels may well not be primes.&lt;br&gt;
3) the values of the weights depend on the particulars of the hardware&lt;br&gt;
and software implementations considered.&lt;br&gt;
&lt;br&gt;
I would suggest that you look at the 'automatic generation of fft&lt;br&gt;
codes' literature to find examples of solutions that might match your&lt;br&gt;
intended implementation. There has been considerable effort towards&lt;br&gt;
optimization specific to implementation characteristics.&lt;br&gt;
&lt;br&gt;
A couple of examples for different architectures that include&lt;br&gt;
discussion of the problem and some if the approaches that have been&lt;br&gt;
tried are:&lt;br&gt;
&lt;br&gt;
&lt;a href=&quot;http://vgrads.rice.edu/publications/pdfs/AEOS_Codegenerator_For_FFT.pdf&quot;&gt;http://vgrads.rice.edu/publications/pdfs/AEOS_Codegenerator_For_FFT.pdf&lt;/a&gt;&lt;br&gt;
&lt;a href=&quot;http://www.iseclab.org/people/pw/papers/vecpar04&quot;&gt;http://www.iseclab.org/people/pw/papers/vecpar04&lt;/a&gt;&lt;br&gt;
&lt;br&gt;
Google can find you many more. If you have knowledge of the intended&lt;br&gt;
platform, language, software environment, etc., consider adding that&lt;br&gt;
to your search terms.&lt;br&gt;
&lt;br&gt;
Dale B. Dalrymple</description>
    </item>
    <item>
      <pubDate>Wed, 14 Apr 2010 09:52:03 -0400</pubDate>
      <title>Re: FFT and small prime factors</title>
      <link>http://www.mathworks.com/matlabcentral/newsreader/view_thread/265266#735986</link>
      <author>Timothy </author>
      <description>&lt;br&gt;
This will do it for integers lower than your input (just supply the largest prime factor). It is easy to make it find the next highest integer, also (just put a while loop and increase j on each iteration).&lt;br&gt;
&lt;br&gt;
function out = nearestLowPrimeFac(in,low)&lt;br&gt;
&lt;br&gt;
for i=1:in-1&lt;br&gt;
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&lt;br&gt;
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;j = in - i;&lt;br&gt;
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&lt;br&gt;
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;if max(factor(j)) == low, break, end&lt;br&gt;
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&lt;br&gt;
end&lt;br&gt;
&lt;br&gt;
out = j;&lt;br&gt;
&lt;br&gt;
end&lt;br&gt;
&lt;br&gt;
&lt;br&gt;
&quot;Rodrigo&quot; &amp;lt;guerra.remove.this@physics.harvard.edu&amp;gt; wrote in message &amp;lt;hd5etq$j9f$1@fred.mathworks.com&amp;gt;...&lt;br&gt;
&amp;gt; I'm writing some code that will be used to convolve large amounts of data in a little time as possible (~1 million 1D ffts, each of of which has a few thousand entries).  To make this run as fast as possible I was wondering if anyone knew of an algorithm that approximates a number N with the closest number M such that M=2^a*3^b*5^c (a,b,c integers)&lt;br&gt;
&amp;gt; &lt;br&gt;
&amp;gt; Doing this for a single prime factor is trivial, but the resolution in M is such that you end up padding with too many zeros or throwing away a lot of data.  Adding the extra factors improves the resolution and should not reduce the performance of the algorithm too much.&lt;br&gt;
&amp;gt; &lt;br&gt;
&amp;gt; I can think of a direct search algorithm for this using the distance of a point to a hyperplane as a metric, but I was hoping there was a more elegant solution to this.&lt;br&gt;
&amp;gt; &lt;br&gt;
&amp;gt; Cheers</description>
    </item>
    <item>
      <pubDate>Wed, 14 Apr 2010 12:34:05 -0400</pubDate>
      <title>Re: FFT and small prime factors</title>
      <link>http://www.mathworks.com/matlabcentral/newsreader/view_thread/265266#736032</link>
      <author>John D'Errico</author>
      <description>&quot;Rodrigo&quot; &amp;lt;guerra.remove.this@physics.harvard.edu&amp;gt; wrote in message &amp;lt;hd5etq$j9f$1@fred.mathworks.com&amp;gt;...&lt;br&gt;
&amp;gt; I'm writing some code that will be used to convolve large amounts of data in a little time as possible (~1 million 1D ffts, each of of which has a few thousand entries).  To make this run as fast as possible I was wondering if anyone knew of an algorithm that approximates a number N with the closest number M such that M=2^a*3^b*5^c (a,b,c integers)&lt;br&gt;
&amp;gt; &lt;br&gt;
&amp;gt; Doing this for a single prime factor is trivial, but the resolution in M is such that you end up padding with too many zeros or throwing away a lot of data.  Adding the extra factors improves the resolution and should not reduce the performance of the algorithm too much.&lt;br&gt;
&amp;gt; &lt;br&gt;
&amp;gt; I can think of a direct search algorithm for this using the distance of a point to a hyperplane as a metric, but I was hoping there was a more elegant solution to this.&lt;br&gt;
&amp;gt; &lt;br&gt;
&lt;br&gt;
You can do it using integer (linear) programming.&lt;br&gt;
I.e., take the log of your target number, as well&lt;br&gt;
as any candidate small primes. Then the goal is&lt;br&gt;
to minimize the distance in log space, where you&lt;br&gt;
can form your target as the sum of integer amounts&lt;br&gt;
of the logs of your small primes.&lt;br&gt;
&lt;br&gt;
Of course, to do this, you need an IP solver for&lt;br&gt;
the linear programming problem. &lt;br&gt;
&lt;br&gt;
HTH,&lt;br&gt;
John</description>
    </item>
  </channel>
</rss>

