Revision of English help pages for different functions (nothing serious).
[scilab.git] / scilab / modules / data_structures / help / en_US / boolean.xml
1 <?xml version="1.0" encoding="UTF-8"?>
2 <!--
3  * Scilab ( http://www.scilab.org/ ) - This file is part of Scilab
4  * Copyright (C) 2007-2008 - INRIA
5  *
6  * This file must be used under the terms of the CeCILL.
7  * This source file is licensed as described in the file COPYING, which
8  * you should have received as part of this distribution.  The terms
9  * are also available at
10  * http://www.cecill.info/licences/Licence_CeCILL_V2-en.txt
11  *
12  -->
13 <refentry xmlns="http://docbook.org/ns/docbook" xmlns:xlink="http://www.w3.org/1999/xlink" xmlns:svg="http://www.w3.org/2000/svg" xmlns:mml="http://www.w3.org/1998/Math/MathML" xmlns:db="http://docbook.org/ns/docbook" xmlns:scilab="http://www.scilab.org" xml:lang="en" xml:id="boolean">
14     <refnamediv>
15         <refname>boolean</refname>
16         <refpurpose>Scilab Objects, boolean variables and operators &amp; | ~  </refpurpose>
17     </refnamediv>
18     <refsection>
19         <title>Description</title>
20         <para>
21             A boolean variable is <constant>%T</constant> (for "true") or <constant>%F</constant> (for "false"). These variables can be used to define matrices of booleans, with the usual syntax. Boolean matrices can be manipulated as ordinary matrices for elements extraction/insertion and concatenation. Note that other usual operations (<literal>+</literal>, <literal>*</literal>, <literal>-</literal>, <literal>^</literal>, etc) are undefined for boolean matrices. Three special operators are defined for boolean matrices:
22         </para>
23         <variablelist>
24             <varlistentry>
25                 <term>~b</term>
26                 <listitem>
27                     <para>
28                         is the element-wise negation of boolean <literal>b</literal> (matrix).
29                     </para>
30                 </listitem>
31             </varlistentry>
32             <varlistentry>
33                 <term>b1 &amp; b2</term>
34                 <listitem>
35                     <para>
36                         is the element-wise logical <literal>and</literal> of
37                         <literal>b1</literal> and <literal>b2</literal>
38                         (matrices).
39                     </para>
40                 </listitem>
41             </varlistentry>
42             <varlistentry>
43                 <term>b1 | b2</term>
44                 <listitem>
45                     <para>
46                         is the  element-wise logical
47                         <literal>or</literal> of <literal>b1</literal>
48                         and <literal>b2</literal> (matrices).
49                     </para>
50                 </listitem>
51             </varlistentry>
52         </variablelist>
53         <para>
54             Boolean variables can be used for indexing matrices or vectors. For instance <code>a([%T,%F,%T],:)</code> returns the submatrix made of rows <literal>1</literal> and <literal>3</literal> of <literal>a</literal>. Boolean sparse matrices are supported.
55         </para>
56     </refsection>
57     <refsection>
58         <title>Examples</title>
59         <programlisting role="example"><![CDATA[
60 [1,2]==[1,3]
61 [1,2]==1
62 a=1:5; a(a>2)
63 ]]></programlisting>
64     </refsection>
65     <refsection role="see also">
66         <title>See Also</title>
67         <simplelist type="inline">
68             <member>
69                 <link linkend="matrices">matrices</link>
70             </member>
71             <member>
72                 <link linkend="or">or</link>
73             </member>
74             <member>
75                 <link linkend="and">and</link>
76             </member>
77             <member>
78                 <link linkend="not">not</link>
79             </member>
80         </simplelist>
81     </refsection>
82 </refentry>