1 <?xml version="1.0" encoding="UTF-8"?>
3 * Scilab ( http://www.scilab.org/ ) - This file is part of Scilab
4 * Copyright (C) 2007-2008 - INRIA
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
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">
15 <refname>boolean</refname>
16 <refpurpose>Scilab Objects, boolean variables and operators & | ~ </refpurpose>
19 <title>Description</title>
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:
28 is the element-wise negation of boolean <literal>b</literal> (matrix).
33 <term>b1 & b2</term>
36 is the element-wise logical <literal>and</literal> of
37 <literal>b1</literal> and <literal>b2</literal>
46 is the element-wise logical
47 <literal>or</literal> of <literal>b1</literal>
48 and <literal>b2</literal> (matrices).
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.
58 <title>Examples</title>
59 <programlisting role="example"><![CDATA[
65 <refsection role="see also">
66 <title>See Also</title>
67 <simplelist type="inline">
69 <link linkend="matrices">matrices</link>
72 <link linkend="or">or</link>
75 <link linkend="and">and</link>
78 <link linkend="not">not</link>