<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
</head>
<body text="#000000" bgcolor="#FFFFFF">
<div class="moz-cite-prefix">Le 24/11/2019 à 20:01, Samuel Gougeon a
écrit :<br>
</div>
<blockquote type="cite"
cite="mid:d730fcc0-d71a-5092-7378-de591983f0c0@free.fr">
<meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
<div class="moz-cite-prefix">Le 24/11/2019 à 19:53, fujimoto2005 a
écrit :<br>
</div>
<blockquote type="cite"
cite="mid:1574621580901-0.post@n3.nabble.com">
<pre class="moz-quote-pre" wrap="">Is it posible to get a 2-dimension matrix y(j,k) =Σ_i x(i,j,k) from 3
dimension hyper- matrix x(i,j,k) without using k-loop?
If there is such a way, please teach me.</pre>
</blockquote>
<p><font size="-1"><tt>--> h = grand(4,3,2,"uin",0,3)</tt><tt><br>
</tt><tt> h = </tt><tt><br>
</tt><tt>(:,:,1)</tt><tt><br>
</tt><tt> 0. 0. 2.</tt><tt><br>
</tt><tt> 2. 3. 3.</tt><tt><br>
</tt><tt> 2. 1. 3.</tt><tt><br>
</tt><tt> 1. 1. 1.</tt><tt><br>
</tt><tt>(:,:,2)</tt><tt><br>
</tt><tt> 0. 3. 1.</tt><tt><br>
</tt><tt> 2. 0. 1.</tt><tt><br>
</tt><tt> 3. 1. 3.</tt><tt><br>
</tt><tt> 0. 2. 3.</tt><tt><br>
</tt><tt><br>
</tt><tt>--> matrix(sum(h,1),-1,size(h,2))</tt><tt><br>
</tt><tt> ans =</tt><tt><br>
</tt><tt> 5. 9. 6.</tt><tt><br>
</tt><tt> 5. 5. 8.</tt><tt><br>
</tt></font></p>
</blockquote>
<p><br>
</p>
<p><tt><font size="-1">Sorry, the correct algorithm is <br>
</font></tt></p>
<tt><font size="-1">--> h = grand(4,3,2,"uin",0,3)</font></tt><br>
<p><tt><font size="-1"> h = <br>
(:,:,1)<br>
2. 0. 1.<br>
2. 3. 2.<br>
0. 0. 2.<br>
1. 1. 3.<br>
(:,:,2)<br>
1. 0. 1.<br>
1. 2. 0.<br>
3. 3. 1.<br>
0. 0. 2.<br>
<br>
--> matrix(sum(h,1),size(h,2), -1)<br>
ans =<br>
5. 5.<br>
4. 5.<br>
8. 4.<br>
</font></tt></p>
<p>Samuel</p>
<p><br>
</p>
</body>
</html>