<?xml version="1.0" encoding="UTF-8"?>
<rss version="2.0">
  <channel>
    <link>http://www.mathworks.com/matlabcentral/newsreader/view_thread/240418</link>
    <title>MATLAB Central Newsreader - sparsing 3-D array</title>
    <description>Feed for thread: sparsing 3-D array</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>Thu, 04 Dec 2008 10:16:03 -0500</pubDate>
      <title>sparsing 3-D array</title>
      <link>http://www.mathworks.com/matlabcentral/newsreader/view_thread/240418#614983</link>
      <author>Theodor Zouk</author>
      <description>Hi&lt;br&gt;
&lt;br&gt;
Is there any function in matlab that can sparse arrays with a higher dimension than 2?&lt;br&gt;
&lt;br&gt;
What i have is a mulstidimension array that is 256x256x256 elements long. Now, Im know that 4096 of these entries have an value and the rest has the value of zero (= a hell of a lot of zeros =). This multidim array (&quot;cube&quot;) is used in a loop where this array is added,subtracted,multiplied elementwise with other multidim arrays also constisting of a lot of zeros. The 4096 entries can be different from each iteration.&lt;br&gt;
I think that i will gain some execution speed if i can sparse these multidim arrays and then &quot;eliminate&quot; the calculations over the zeros value entries (elements)...&lt;br&gt;
&lt;br&gt;
regards&lt;br&gt;
&lt;br&gt;
Theo &lt;br&gt;
&amp;nbsp;&amp;nbsp;</description>
    </item>
    <item>
      <pubDate>Thu, 04 Dec 2008 10:29:02 -0500</pubDate>
      <title>Re: sparsing 3-D array</title>
      <link>http://www.mathworks.com/matlabcentral/newsreader/view_thread/240418#614993</link>
      <author>Jos </author>
      <description>&quot;Theodor Zouk&quot; &amp;lt;rebet4@hotmail.com&amp;gt; wrote in message &amp;lt;gh8al2$480$1@fred.mathworks.com&amp;gt;...&lt;br&gt;
&amp;gt; Hi&lt;br&gt;
&amp;gt; &lt;br&gt;
&amp;gt; Is there any function in matlab that can sparse arrays with a higher dimension than 2?&lt;br&gt;
&amp;gt; &lt;br&gt;
&amp;gt; What i have is a mulstidimension array that is 256x256x256 elements long. Now, Im know that 4096 of these entries have an value and the rest has the value of zero (= a hell of a lot of zeros =). This multidim array (&quot;cube&quot;) is used in a loop where this array is added,subtracted,multiplied elementwise with other multidim arrays also constisting of a lot of zeros. The 4096 entries can be different from each iteration.&lt;br&gt;
&amp;gt; I think that i will gain some execution speed if i can sparse these multidim arrays and then &quot;eliminate&quot; the calculations over the zeros value entries (elements)...&lt;br&gt;
&amp;gt; &lt;br&gt;
&amp;gt; regards&lt;br&gt;
&amp;gt; &lt;br&gt;
&amp;gt; Theo &lt;br&gt;
&amp;gt;   &lt;br&gt;
&lt;br&gt;
Make your ND arrays a long column vector. When the need arises for getting the row/column/plane indices of the non-zero entries, use IND2SUB. Example&lt;br&gt;
&lt;br&gt;
sz = size(NDarray) ;&lt;br&gt;
B = sparse(NDarray(:)) ;&lt;br&gt;
B = B + 1 ; &lt;br&gt;
[subi{1:numel(sz)}] = IND2SUB(sz,find(B))&lt;br&gt;
&lt;br&gt;
hth&lt;br&gt;
Jos</description>
    </item>
    <item>
      <pubDate>Thu, 04 Dec 2008 12:58:02 -0500</pubDate>
      <title>Re: sparsing 3-D array</title>
      <link>http://www.mathworks.com/matlabcentral/newsreader/view_thread/240418#615020</link>
      <author>Theodor Zouk</author>
      <description>&quot;Jos &quot; &amp;lt;#10584@fileexchange.com&amp;gt; wrote in message &amp;lt;gh8bde$cba$1@fred.mathworks.com&amp;gt;...&lt;br&gt;
&amp;gt; &quot;Theodor Zouk&quot; &amp;lt;rebet4@hotmail.com&amp;gt; wrote in message &amp;lt;gh8al2$480$1@fred.mathworks.com&amp;gt;...&lt;br&gt;
&amp;gt; &amp;gt; Hi&lt;br&gt;
&amp;gt; &amp;gt; &lt;br&gt;
&amp;gt; &amp;gt; Is there any function in matlab that can sparse arrays with a higher dimension than 2?&lt;br&gt;
&amp;gt; &amp;gt; &lt;br&gt;
&amp;gt; &amp;gt; What i have is a mulstidimension array that is 256x256x256 elements long. Now, Im know that 4096 of these entries have an value and the rest has the value of zero (= a hell of a lot of zeros =). This multidim array (&quot;cube&quot;) is used in a loop where this array is added,subtracted,multiplied elementwise with other multidim arrays also constisting of a lot of zeros. The 4096 entries can be different from each iteration.&lt;br&gt;
&amp;gt; &amp;gt; I think that i will gain some execution speed if i can sparse these multidim arrays and then &quot;eliminate&quot; the calculations over the zeros value entries (elements)...&lt;br&gt;
&amp;gt; &amp;gt; &lt;br&gt;
&amp;gt; &amp;gt; regards&lt;br&gt;
&amp;gt; &amp;gt; &lt;br&gt;
&amp;gt; &amp;gt; Theo &lt;br&gt;
&amp;gt; &amp;gt;   &lt;br&gt;
&amp;gt; &lt;br&gt;
&amp;gt; Make your ND arrays a long column vector. When the need arises for getting the row/column/plane indices of the non-zero entries, use IND2SUB. Example&lt;br&gt;
&amp;gt; &lt;br&gt;
&amp;gt; sz = size(NDarray) ;&lt;br&gt;
&amp;gt; B = sparse(NDarray(:)) ;&lt;br&gt;
&amp;gt; B = B + 1 ; &lt;br&gt;
&amp;gt; [subi{1:numel(sz)}] = IND2SUB(sz,find(B))&lt;br&gt;
&amp;gt; &lt;br&gt;
&amp;gt; hth&lt;br&gt;
&amp;gt; Jos&lt;br&gt;
&lt;br&gt;
ok, thanks for the help Jos&lt;br&gt;
/theo</description>
    </item>
  </channel>
</rss>

