%i_isreal() %i_real() %i_imag() added
[scilab.git] / scilab / modules / data_structures / help / en_US / types / 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  * Copyright (C) 2012 - 2016 - Scilab Enterprises
7  *
8  * This file is hereby licensed under the terms of the GNU GPL v2.0,
9  * pursuant to article 5.3.4 of the CeCILL v.2.1.
10  * This file was originally licensed under the terms of the CeCILL v2.1,
11  * and continues to be available under such terms.
12  * For more information, see the COPYING file which you should have received
13  * along with this program.
14  *
15  -->
16 <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">
17     <refnamediv>
18         <refname>boolean</refname>
19         <refpurpose>Scilab Objects, boolean variables and operators &amp; | ~  </refpurpose>
20     </refnamediv>
21     <refsection>
22         <title>Description</title>
23         <para>
24             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.
25         </para>
26         <para>
27             <note>
28                 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:
29             </note>
30         </para>
31         <variablelist>
32             <varlistentry>
33                 <term>~b</term>
34                 <listitem>
35                     <para>
36                         is the element-wise negation of boolean <literal>b</literal> (matrix).
37                     </para>
38                 </listitem>
39             </varlistentry>
40             <varlistentry>
41                 <term>b1 &amp; b2</term>
42                 <listitem>
43                     <para>
44                         is the element-wise logical <literal>and</literal> of
45                         <literal>b1</literal> and <literal>b2</literal>
46                         (matrices).
47                     </para>
48                 </listitem>
49             </varlistentry>
50             <varlistentry>
51                 <term>b1 | b2</term>
52                 <listitem>
53                     <para>
54                         is the  element-wise logical
55                         <literal>or</literal> of <literal>b1</literal>
56                         and <literal>b2</literal> (matrices).
57                     </para>
58                 </listitem>
59             </varlistentry>
60         </variablelist>
61         <para>
62             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.
63         </para>
64     </refsection>
65     <refsection>
66         <title>Examples</title>
67         <programlisting role="example"><![CDATA[
68 [1,2]==[1,3]
69 [1,2]==1
70 a=1:5; a(a>2)
71 ]]></programlisting>
72     </refsection>
73     <refsection role="see also">
74         <title>See also</title>
75         <simplelist type="inline">
76             <member>
77                 <link linkend="matrices">matrices</link>
78             </member>
79             <member>
80                 <link linkend="or">or</link>
81             </member>
82             <member>
83                 <link linkend="and">and</link>
84             </member>
85             <member>
86                 <link linkend="not">not</link>
87             </member>
88         </simplelist>
89     </refsection>
90 </refentry>