1 <?xml version="1.0" encoding="UTF-8"?>
3 * Scilab ( http://www.scilab.org/ ) - This file is part of Scilab
4 * Copyright (C) 2008 - INRIA - Farid BELAHCENE
5 * Copyright (C) 2013 - Samuel GOUGEON: restriction to decimal numbers removed. Examples added for booleans, integer-encoded numbers, text, polynomials, rationals
7 * Copyright (C) 2012 - 2016 - Scilab Enterprises
9 * This file is hereby licensed under the terms of the GNU GPL v2.0,
10 * pursuant to article 5.3.4 of the CeCILL v.2.1.
11 * This file was originally licensed under the terms of the CeCILL v2.1,
12 * and continues to be available under such terms.
13 * For more information, see the COPYING file which you should have received
14 * along with this program.
17 <refentry xmlns="http://docbook.org/ns/docbook" xmlns:xlink="http://www.w3.org/1999/xlink" xmlns:svg="http://www.w3.org/2000/svg" xmlns:ns5="http://www.w3.org/1999/xhtml" xmlns:mml="http://www.w3.org/1998/Math/MathML" xmlns:db="http://docbook.org/ns/docbook" xmlns:scilab="http://www.scilab.org" xml:id="flipdim" xml:lang="fr">
19 <refname>flipdim</refname>
21 inverse l'ordre des (blocs de) lignes, colonnes, pages.. d'une matrice ou hypermatrice
25 <title>Séquence d'appel</title>
26 <synopsis>y = flipdim(x, dim [,sb])</synopsis>
28 <refsection role="parameters">
29 <title>Paramètres</title>
34 <para>scalaires, vecteurs, matrices, ou hypermatrices de n'importe quel type, de même taille</para>
41 entier positif, la dimension de <literal>x</literal> selon laquelle les éléments seront retournés
48 <para>entier positif, la taille des blocs à permuter</para>
53 <refsection role="description">
54 <title>Description</title>
56 A partir de <literal>x</literal>, un scalaire/vecteur/matrice/hypermatrice de n'importe quel type et
57 deux entiers positifs <literal>dim</literal> et <literal>sb</literal>, cette fonction retourne les éléments de
58 <literal>x</literal> par blocs de taille <literal>sb</literal> selon le nombre dimension <literal>dim</literal> de
59 <literal>x</literal> (<literal>x</literal> et <literal>y</literal> ont la même taille)
62 Le paramètre optionnel <literal>sb</literal> (pour Size Block) permet de retounerles éléments de <literal>x</literal>
63 par blocs de taille <literal>sb*size(x,2)</literal> (<literal>dim=1</literal>)
64 ou <literal>size(x,1)*sb</literal> (<literal>dim=2</literal>).
67 <refsection role="examples">
68 <title>Exemples</title>
69 <programlisting role="example"><![CDATA[
70 // Exemple 1 : selon la première dimension
71 x = [1 2 3 4; 5 6 7 8]
75 // Exemple 2 : selon la deuxième dimension
79 // Exemple 3 : selon la troisième dimension
80 x = matrix(1:24, [3 2 4])
84 // Exemple 4 : premier exemple, mais avec des complexes
85 x = [1+%i 2*%i 3 4; 5 6-%i 7 8*%pi*%i]
90 x = int16(grand(4, 3, 2, "uin", -9, 9))
94 x = (grand(3, 4, "uin", -9, 9) > 0)
98 x = matrix(strsplit("a":"x", 1:23), 4, 6);
103 x = inv_coeff(grand(3, 9, "uin", 0, 3), 2)
107 n = inv_coeff(grand(3, 9, "uin", 0 ,3), 2);
108 d = inv_coeff(grand(3, 9, "uin", 0, 3), 2);
113 Exemples utilisant <literal>sb</literal> :
115 <programlisting role="example"><![CDATA[
116 X = [0 1 2 3 4 5 6 7 8 9 10 11];
117 flipdim(X, 2, 2) // => [10 11 8 9 6 7 4 5 2 3 0 1] // Taille du bloc = 2.
118 flipdim(X, 2, 3) // => [9 10 11 6 7 8 3 4 5 0 1 2]
119 flipdim(X, 2, 4) // => [8 9 10 11 4 5 6 7 0 1 2 3]
120 flipdim(X, 2, 6) // => [6 7 8 9 10 11 0 1 2 3 4 5]
122 // Erreur si sb ne divise pas la dimension ciblée de x.
123 y = flipdim(x, 2, 5); // size(X) = [1 12] et sb=5 ne divise pas 12.
126 <refsection role="history">
127 <title>History</title>
130 <revnumber>5.5.0</revnumber>
132 Extension de décimaux à tout type : booléens, entiers, chaines de caractères, polynômes et fractions rationnelles.
133 Nouveau paramètre optionnel <literal>sb</literal> pour retourner <literal>x</literal> par blocs.