<html>
  <head>
    <meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
  </head>
  <body text="#000000" bgcolor="#FFFFFF">
    <br>
    <font face="Courier New">Christophe,<br>
      <br>
      Thanks!<br>
      <br>
      Two more questions (for anybody reading and willing to reply):<br>
      <br>
      1) Is there an exclusive or function? I couldn't find it, a search
      leads to the XOR mode of combining graphic pixels. It would be
      most useful since it is one of the operations in the Galois field
      GF(2). Currently, as I needed it, I created a very simple
      implementtion of the xor using and, or and negation, but I wonder
      if a direct implementation would be more efficient. <br>
      <br>
      2) How much memory does it take a boolean scalar? Does a boolean
      vector eploit the fact that a byte could theoretically host up to
      8 boolean components?<br>
      <br>
      By the way, using booleans I very much improved speed in massive
      operations involving sequences of 0's and 1's respect to using
      decimal o's nd 1's and applying modulo 2 to the sum. <br>
      <br>
      This is a sample code:</font><span
      style="color:rgb(75,149,50);font-style:italic;"><br>
      <br>
      // Defining exclusive or, xor</span>
    <pre style="font-family:Monospaced;font-style:normal;font-size:14.0;"><span style="color:rgb(176,24,19);">function</span> <span style="color:rgb(131,67,16);font-weight:bold;">u</span><span style="color:rgb(92,92,92);">=</span><span style="color:rgb(0,0,0);text-decoration:underline;">xor</span><span style="color:rgb(74,85,219);">(</span><span style="color:rgb(131,67,16);font-weight:bold;">v</span><span style="color:rgb(0,0,0);">, </span><span style="color:rgb(131,67,16);font-weight:bold;">w</span><span style="color:rgb(74,85,219);">)</span>
   // Probably some parenthesis are unnecessary
   <span style="color:rgb(131,67,16);font-weight:bold;">u</span> <span style="color:rgb(92,92,92);">=</span> <span style="color:rgb(74,85,219);">(</span><span style="color:rgb(74,85,219);">(</span><span style="color:rgb(92,92,92);">~</span><span style="color:rgb(131,67,16);font-weight:bold;">v</span><span style="color:rgb(74,85,219);">)</span><span style="color:rgb(92,92,92);">&</span><span style="color:rgb(131,67,16);font-weight:bold;">w</span><span style="color:rgb(74,85,219);">)</span> <span style="color:rgb(92,92,92);">|</span> <span style="color:rgb(74,85,219);">(</span><span style="color:rgb(131,67,16);font-weight:bold;">v</span><span style="color:rgb(92,92,92);">&</span><span style="color:rgb(74,85,219);">(</span><span style="color:rgb(92,92,92);">~</span><span style="color:rgb(131,67,16);font-weight:bold;">w</span><span style="color:rgb(74,85,219);">)</span><span style="color:rgb(74,85,219);">)</span><span style="color:rgb(0,0,0);">;</span>
<span style="color:rgb(176,24,19);">endfunction
</span>
After running this, <span style="color:rgb(176,24,19);">

</span><span style="color:rgb(0,0,0);">n</span> <span style="color:rgb(92,92,92);">=</span> <span style="color:rgb(188,106,143);">11;</span><span style="color:rgb(176,24,19);"></span></pre>
    <pre style="font-family:Monospaced;font-style:normal;font-size:14.0;"><span style="color:rgb(50,185,185);">tic</span>
<span style="color:rgb(75,149,50);font-style:italic;">//A = ones(1,n);</span>
<span style="color:rgb(0,0,0);">A</span> <span style="color:rgb(92,92,92);">=</span> <span style="color:rgb(50,185,185);">ones</span><span style="color:rgb(74,85,219);">(</span><span style="color:rgb(188,106,143);">1</span><span style="color:rgb(0,0,0);">,</span><span style="color:rgb(0,0,0);">n</span><span style="color:rgb(74,85,219);">)</span> <span style="color:rgb(92,92,92);">&</span> <span style="color:rgb(218,112,214);">%t</span><span style="color:rgb(0,0,0);">;</span>
<span style="color:rgb(0,0,0);">no</span> <span style="color:rgb(92,92,92);">=</span> <span style="color:rgb(0,0,0);">n</span> <span style="color:rgb(92,92,92);">-</span> 2<span style="color:rgb(74,85,219);"></span><span style="color:rgb(0,0,0);">;</span>
<span style="color:rgb(160,32,240);">for</span> <span style="color:rgb(0,0,0);">k</span><span style="color:rgb(92,92,92);">=</span><span style="color:rgb(188,106,143);">1</span><span style="color:rgb(255,170,0);">:</span><span style="color:rgb(188,106,143);">2</span><span style="color:rgb(92,92,92);">^</span><span style="color:rgb(0,0,0);">n</span> <span style="color:rgb(92,92,92);">-</span><span style="color:rgb(188,106,143);">1</span>
    <span style="color:rgb(0,0,0);">y</span><span style="color:rgb(74,85,219);">(</span><span style="color:rgb(0,0,0);">k</span><span style="color:rgb(74,85,219);">)</span> <span style="color:rgb(92,92,92);">=</span> <span style="color:rgb(0,0,0);">A</span><span style="color:rgb(74,85,219);">(</span><span style="color:rgb(0,0,0);">n</span><span style="color:rgb(74,85,219);">)</span><span style="color:rgb(0,0,0);">;</span>
    <span style="color:rgb(75,149,50);font-style:italic;">//A = [modulo(A(n)+ A(no), 2), A(1:n-1)];</span>
    <span style="color:rgb(0,0,0);">A</span> <span style="color:rgb(92,92,92);">=</span> <span style="color:rgb(74,85,219);">[</span><span style="color:rgb(74,85,219);">(</span><span style="color:rgb(0,0,0);">xor</span><span style="color:rgb(74,85,219);">(</span><span style="color:rgb(0,0,0);">A</span><span style="color:rgb(74,85,219);">(</span><span style="color:rgb(0,0,0);">n</span><span style="color:rgb(74,85,219);">)</span><span style="color:rgb(0,0,0);">,</span><span style="color:rgb(0,0,0);">A</span><span style="color:rgb(74,85,219);">(</span><span style="color:rgb(0,0,0);">no</span><span style="color:rgb(74,85,219);">)</span><span style="color:rgb(74,85,219);">)</span><span style="color:rgb(0,0,0);">,</span> <span style="color:rgb(0,0,0);">A</span><span style="color:rgb(74,85,219);">(</span><span style="color:rgb(188,106,143);">1</span><span style="color:rgb(255,170,0);">:</span><span style="color:rgb(0,0,0);">n</span><span style="color:rgb(92,92,92);">-</span><span style="color:rgb(188,106,143);">1</span><span style="color:rgb(74,85,219);">)</span><span style="color:rgb(74,85,219);">]</span><span style="color:rgb(0,0,0);">;</span>
<span style="color:rgb(160,32,240);">end</span>
<span style="color:rgb(50,185,185);">toc</span>
<span style="color:rgb(176,24,19);"></span><span style="color:rgb(176,24,19);"></span></pre>
    <font face="Courier New">It can be checked that using the commented
      lines for A instead of the uncommented ones the computing time is
      larger using the modulo 2 way of simulating a XOR than using
      boolean variables. For n larger the difference is even more
      noticeable.<br>
      <br>
      This is part of a code I will post when ready for generating
      maximum length sequences.<br>
      <br>
      Regards,<br>
      <br>
      Federico Miyara  <br>
    </font><br>
    <div class="moz-cite-prefix">On 04/09/2019 04:49, Dang Ngoc Chan,
      Christophe wrote:<br>
    </div>
    <blockquote type="cite"
cite="mid:DB6PR07MB4344E3D28160B44E23A33AFDE5B80@DB6PR07MB4344.eurprd07.prod.outlook.com">
      <pre class="moz-quote-pre" wrap="">Hello,

</pre>
      <blockquote type="cite">
        <pre class="moz-quote-pre" wrap="">De : Federico Miyara
Envoyé : mercredi 4 septembre 2019 09:11

I need to create a boolean vector, such as [%t, %t, %t, %t] […] I
couldn't find a function similar to ones(1,n).

However I've found a workaround:

a = ones(1,n) & %t
[…]
1) Why does it work?
</pre>
      </blockquote>
      <pre class="moz-quote-pre" wrap="">Because "A number is considered as %F (false) if it is 0 or 0+0i. Otherwise (including %nan), it is equivalent to %T (true)."

<a class="moz-txt-link-freetext" href="https://help.scilab.org/docs/6.0.2/en_US/and.html" moz-do-not-send="true">https://help.scilab.org/docs/6.0.2/en_US/and.html</a>

</pre>
      <blockquote type="cite">
        <pre class="moz-quote-pre" wrap="">2) Is there some native function to create bolean matrices
</pre>
      </blockquote>
      <pre class="moz-quote-pre" wrap="">No, but you have several other ways, you may test to find the one that is the less greedy.

I propose this one:

a = (ones(1,n) == 1)

Apart from this, I think most (if not all) functions that require boolean also accept numbers In the same way as and() (but I may be mistaken).

Regards

--
Christophe Dang Ngoc Chan
Mechanical calculation engineer

General
This e-mail may contain confidential and/or privileged information. If you are not the intended recipient (or have received this e-mail in error), please notify the sender immediately and destroy this e-mail. Any unauthorized copying, disclosure or distribution of the material in this e-mail is strictly forbidden.
_______________________________________________
users mailing list
<a class="moz-txt-link-abbreviated" href="mailto:users@lists.scilab.org" moz-do-not-send="true">users@lists.scilab.org</a>
<a class="moz-txt-link-freetext" href="http://lists.scilab.org/mailman/listinfo/users" moz-do-not-send="true">http://lists.scilab.org/mailman/listinfo/users</a>


</pre>
    </blockquote>
    <br>
  <div id="DAB4FAD8-2DD7-40BB-A1B8-4E2AA1F9FDF2"><br /> <table style="border-top: 1px solid #D3D4DE;">
        <tr>
      <td style="width: 55px; padding-top: 18px;"><a href="https://www.avast.com/sig-email?utm_medium=email&utm_source=link&utm_campaign=sig-email&utm_content=emailclient" target="_blank"><img src="https://ipmcdn.avast.com/images/icons/icon-envelope-tick-round-orange-animated-no-repeat-v1.gif" alt="" width="46" height="29" style="width: 46px; height: 29px;" /></a></td>
                <td style="width: 470px; padding-top: 17px; color: #41424e; font-size: 13px; font-family: Arial, Helvetica, sans-serif; line-height: 18px;">Libre de virus. <a href="https://www.avast.com/sig-email?utm_medium=email&utm_source=link&utm_campaign=sig-email&utm_content=emailclient" target="_blank" style="color: #4453ea;">www.avast.com</a>           </td>
        </tr>
</table>
<a href="#DAB4FAD8-2DD7-40BB-A1B8-4E2AA1F9FDF2" width="1" height="1"> </a></div></body>
</html>