From 608a32d4f3eb2b670d1da1a325241fab09e6034f Mon Sep 17 00:00:00 2001 From: Samuel GOUGEON Date: Sun, 31 May 2020 19:50:42 +0200 Subject: [PATCH] [doc] find() page improved Change-Id: Ia4a0969e988d3a084eaca1e0cbeb7e5d2e8ad62c --- .../help/en_US/searchandsort/find.xml | 227 ++++++++++++-- .../help/fr_FR/searchandsort/find.xml | 243 +++++++++++++-- .../help/ja_JP/searchandsort/find.xml | 315 ++++++++++++-------- .../help/pt_BR/searchandsort/find.xml | 219 ++++++++++++-- .../help/ru_RU/searchandsort/find.xml | 290 ++++++++++++++++++ 5 files changed, 1087 insertions(+), 207 deletions(-) create mode 100644 scilab/modules/elementary_functions/help/ru_RU/searchandsort/find.xml diff --git a/scilab/modules/elementary_functions/help/en_US/searchandsort/find.xml b/scilab/modules/elementary_functions/help/en_US/searchandsort/find.xml index 51468b1..6f8e724 100644 --- a/scilab/modules/elementary_functions/help/en_US/searchandsort/find.xml +++ b/scilab/modules/elementary_functions/help/en_US/searchandsort/find.xml @@ -2,8 +2,8 @@ - + find - find indices of boolean vector or matrix true elements + gives the indices of %T or non-zero elements Syntax - [ii]=find(x [,nmax]) - [i1,i2,..]=find(x [,nmax]) + + ii = find(x) + [i1,i2,..] = find(x) + .. = find(x, nmax) @@ -30,21 +35,37 @@ x - may be a boolean vector, a boolean matrix, a boolean - hypermatrix, a "standard" matrix or hypermatrix + + Vector, matrix, or hypermatrix of booleans or of numbers. + All non-zero numbers are considered as %T. + Sparse matrices are accepted. nmax - an integer giving the maximum number of indices to return. The default value is -1 which stands for "all". This option can be used for efficiency, to avoid searching all indices. + + an integer giving the maximum number of indices to return. + The default value is -1 which stands for "all". + This option can be used for efficiency, to avoid searching all indices. + + + + + ii + + + row vector of linearized indices of %T or non-zero elements, or empty matrix [] + - ii, i1, i2, .. + i1, i2, .. - integer vectors of indices or empty matrices + + row vectors of directional indices, or empty matrix [] + @@ -75,42 +96,188 @@ Examples + + With input booleans: + + + A = [%F %T %T %F ; %T %F %F %T] + A = + F T T F + T F F T + +--> find(A) + ans = + 2. 3. 5. 8. + +--> find(A,2) + ans = + 2. 3. +]]> + + With input numbers: + + + B = [0 -1 0 3 ; 0 -1 -0.4 0] + B = + 0. -1. 0. 3. + 0. -1. -0.4 0. + +--> find(B) + ans = + 3. 4. 6. 7. + +--> [i, j] = find(B); +--> [i' j'] + ans = + 1. 2. + 2. 2. + 2. 3. + 1. 4. +]]> + + With an input hypermatrix of numbers: + + + E = grand(2,5,2,"uin",1,6) + E = +(:,:,1) + 1. 6. 5. 5. 4. + 6. 5. 3. 4. 4. +(:,:,2) + 2. 4. 3. 6. 5. + 5. 6. 6. 6. 4. + +--> find(E < 4) + ans = + 1. 6. 11. 15. +]]> + + With an input numerical or boolean sparse matrix: + 4 +full(D) +find(D) + ]]> + C = sparse(C); +--> find(C) + ans = + 3. 4. 5. 7. 9. 13. 14. 15. 18. + +-->find(C, 4) + ans = + 3. 4. 5. 7. + +--> // With input boolean sparse +--> D = C > 4 + D = +( 3, 6) sparse boolean matrix +( 1, 3) T +( 1, 5) T +( 2, 5) T +( 3, 1) T +( 3, 6) T -A=rand(1,20); -w=find(A<0.4) -A(w) -w=find(A>100) +--> full(D) + ans = + F F T F T F + F F F F T F + T F F F F T -B=rand(1,20); -w=find(B<0.4,2) //at most 2 returned values +-->find(D) + ans = + 3. 7. 13. 14. 18. +]]> + + With the result of a boolean element-wise condition on texts: + + + find(beers == "Leffe") + ans = + 2. + +--> find(beers == "1664") + ans = + [] +]]> + + Addressing selected elements: + + 0.9) +// b) Directly through the array of their boolean status: +L = H; +L(L < 0) = -10 + ]]> + // a) Through their linearized indices: +--> H = [ 0 -2 -8 4 -5 -1 + > -2 2 -9 5 0 1 + > ]; +--> L = H; +--> L(find(L < 0)) = -10 + L = + 0. -10. -10. 4. -10. -10. + -10. 2. -10. 5. 0. 1. -H(i(1),j(1),k(1)) - ]]> +--> // b) Directly through the array of their boolean status: +--> L = H; +--> L(L < 0) = -10 + L = + 0. -10. -10. 4. -10. -10. + -10. 2. -10. 5. 0. 1. +]]> See also - boolean + vectorfind - extraction + grep - insertion + findobj - vectorfind + boolean diff --git a/scilab/modules/elementary_functions/help/fr_FR/searchandsort/find.xml b/scilab/modules/elementary_functions/help/fr_FR/searchandsort/find.xml index 5f57b23..af9299b 100644 --- a/scilab/modules/elementary_functions/help/fr_FR/searchandsort/find.xml +++ b/scilab/modules/elementary_functions/help/fr_FR/searchandsort/find.xml @@ -2,8 +2,8 @@ - + find - trouve les indices des éléments vrais d'un vecteur ou d'une matrice de booléens + + donne la position des éléments %T ou non nuls d'un tableau booléen ou numérique. + Séquence d'appel - [ii]=find(x [,nmax]) - [i1,i2,..]=find(x [,nmax]) + + ii = find(x) + [i1,i2,..] = find(x) + .. = find(x, nmax) @@ -30,19 +37,40 @@ x - peut être un vecteur booléen, une matrice booléenne, une hypermatrice booléenne, une matrice ou une hypermatrice "standard". + + Vecteur, matrice, ou hypermatrice de booléens ou de nombres. + Tout nombre non nul est équivalent à %T. + Les vecteurs ou matrices creuses sont acceptés. + nmax - un entier donnant le nombre maximal d'indices à retourner. La valeur par défaut est -1 qui signifie "tous". Cette option peut être utilisée dans un but d'efficacité en évitant la recherche de tous les indices. + + un entier donnant le nombre maximal d'indices à retourner. + La valeur par défaut est -1 qui signifie "tous". + Cette option peut être utilisée dans un but d'efficacité + en évitant la recherche de tous les indices. + + + + + ii + + + vecteur ligne des indices linéarisés des éléments %T ou non nuls, + ou matrice vide []. + - ii, i1, i2, .. + i1, i2, .. - vecteurs d'entiers des indices ou matrices vides + + vecteurs ligne des indices directionels des élements %T ou non nuls, + or matrices vides []. + @@ -53,17 +81,20 @@ Si x est une matrice booléenne, - ii=find(x) retourne le vecteur des indices i pour lesquels x(i) est "vrai". Si aucun élément vrai - n'est trouvé find retourne une matrice vide. + ii=find(x) retourne le vecteur des indices + i pour lesquels x(i) est "vrai". + Si aucun élément vrai n'est trouvé find retourne une matrice vide. - [i1,i2,..]=find(x) retourne le vecteur des indices i1 (pour les lignes) et i2 (pour les colonnes),.. + [i1,i2,..]=find(x) retourne le vecteur des indices + i1 (pour les lignes) et i2 (pour les colonnes),.. tel que x(i1(n),i2(n),..) est "vrai". Si aucun élément vrai n'est trouvé find retourne des matrices vides dans i1, i2, ... - Si x est une matrice standard ou une hypermatrice find(x) est interprété comme + Si x est une matrice standard ou une hypermatrice + find(x) est interprété comme find(x<>0). @@ -72,42 +103,188 @@ Exemples + + Avec un tableau booléen : + + + A = [%F %T %T %F ; %T %F %F %T] + A = + F T T F + T F F T + +--> find(A) + ans = + 2. 3. 5. 8. + +--> find(A,2) + ans = + 2. 3. +]]> + + Avec un tableau de nombres : + + B = [0 -1 0 3 ; 0 -1 -0.4 0] + B = + 0. -1. 0. 3. + 0. -1. -0.4 0. -A=rand(1,20); -w=find(A<0.4) -A(w) -w=find(A>100) +--> find(B) + ans = + 3. 4. 6. 7. -B=rand(1,20); -w=find(B<0.4,2) //retourne au plus deux valeurs +--> [i, j] = find(B); +--> [i' j'] + ans = + 1. 2. + 2. 2. + 2. 3. + 1. 4. +]]> + + Avec une hypermatrice de nombres : + + + E = grand(2,5,2,"uin",1,6) + E = +(:,:,1) + 1. 6. 5. 5. 4. + 6. 5. 3. 4. 4. +(:,:,2) + 2. 4. 3. 6. 5. + 5. 6. 6. 6. 4. -H=rand(4,3,5); //une hypermatrice -[i,j,k]=find(H>0.9) +--> find(E < 4) + ans = + 1. 6. 11. 15. +]]> + + Avec une matrice creuse numérique ou booléenne : + + +// Avec une matrice creuse booléenne +D = C > 4 +full(D) +find(D) + ]]> + C = sparse(C); +--> find(C) + ans = + 3. 4. 5. 7. 9. 13. 14. 15. 18. + +-->find(C, 4) + ans = + 3. 4. 5. 7. + +--> // Avec une matrice creuse booléenne +--> D = C > 4 + D = +( 3, 6) sparse boolean matrix +( 1, 3) T +( 1, 5) T +( 2, 5) T +( 3, 1) T +( 3, 6) T + +--> full(D) + ans = + F F T F T F + F F F F T F + T F F F F T + +-->find(D) + ans = + 3. 7. 13. 14. 18. +]]> + + Avec le résultat booléen d'une condition individuelle sur du texte : + + + find(beers == "Leffe") + ans = + 2. + +--> find(beers == "1664") + ans = + [] +]]> + + Adressage des éléments sélectionnés : + + + // a) via leurs indices linéarisés : +--> H = [ 0 -2 -8 4 -5 -1 + > -2 2 -9 5 0 1 + > ]; +--> L = H; +--> L(find(L<0)) = -10 + L = + 0. -10. -10. 4. -10. -10. + -10. 2. -10. 5. 0. 1. + +--> // b) Directement via le tableau de leur statut booléen : +--> L = H; +--> L(L<0) = -10 + L = + 0. -10. -10. 4. -10. -10. + -10. 2. -10. 5. 0. 1. +]]> Voir aussi - boolean + vectorfind - extraction + grep - insertion + findobj - recherche de vecteur + boolean diff --git a/scilab/modules/elementary_functions/help/ja_JP/searchandsort/find.xml b/scilab/modules/elementary_functions/help/ja_JP/searchandsort/find.xml index 487963c..a0c663c 100644 --- a/scilab/modules/elementary_functions/help/ja_JP/searchandsort/find.xml +++ b/scilab/modules/elementary_functions/help/ja_JP/searchandsort/find.xml @@ -1,10 +1,9 @@ - - - - + - find - 論理値ベクトルまたは行列のtrue要素の添え字を見つける - - - 呼び出し手順 - - [ii]=find(x [,nmax]) - - [i1,i2,..]=find(x [,nmax]) - + + ii = find(x) + [i1,i2,..] = find(x) + .. = find(x, nmax) - - - 引数 - - - x - - - は論理値ベクトル,論理値行列,論理値ハイパー行列, - - "標準"行列またはハイパー行列です. - + + ブールまたは数値のベクトル、行列、または超行列. ゼロ以外の数値は%Tと見なされます. + スパース行列が受け入れられます. - - - - nmax - - 返される添え字の最大数を指定する整数. - デフォルト値は"全て"を意味する -1 です. - このオプションは,全ての添え字の探索を避け,処理効率を改善するために - 使用できます. - - - - - - ii, i1, i2, .. - + ii - - 整数ベクトルの添字または空行列 - + + row vector of linearized indices of %T or non-zero elements, or empty matrix []. + + + + + i1, i2, .. + + + row vectors of directional indices, or empty matrix [] + - - - - - 説明 - - x が論理値の場合, - - - ii=find(x) はx(i)が - "true"の添字iのベクトルを返します. - trueとなる要素がみつからない場合,空行列が返されます. - - - [i1,i2,..]=find(x) は, - x(i1(n),i2(n),..)が "true" の - 添字i1 (行の場合) および - i2 (列の場合),..のベクトルを返します. - trueとなる要素がみつからない場合, - i1,i2, ...の空行列を返します. - - - x が標準行列またはハイパー行列の場合, - find(x)はfind(x<>0) - と解釈されます. - - - find([]) は []を返します. - - - - 例 - + + With input booleans: + 100) -B=rand(1,20); -w=find(B<0.4,2) //最大2個の値を返す -H=rand(4,3,5); //ハイパー行列 -[i,j,k]=find(H>0.9) -H(i(1),j(1),k(1)) - ]]> - +A = [%F %T %T %F ; %T %F %F %T] +find(A) +find(A,2) + ]]> + A = [%F %T %T %F ; %T %F %F %T] + A = + F T T F + T F F T + +--> find(A) + ans = + 2. 3. 5. 8. + +--> find(A,2) + ans = + 2. 3. +]]> + + With input numbers: + + + B = [0 -1 0 3 ; 0 -1 -0.4 0] + B = + 0. -1. 0. 3. + 0. -1. -0.4 0. + +--> find(B) + ans = + 3. 4. 6. 7. + +--> [i, j] = find(B); +--> [i' j'] + ans = + 1. 2. + 2. 2. + 2. 3. + 1. 4. +]]> + + With an input hypermatrix of numbers: + + + E = grand(2,5,2,"uin",1,6) + E = +(:,:,1) + 1. 6. 5. 5. 4. + 6. 5. 3. 4. 4. +(:,:,2) + 2. 4. 3. 6. 5. + 5. 6. 6. 6. 4. + +--> find(E < 4) + ans = + 1. 6. 11. 15. +]]> + + With an input numerical or boolean sparse matrix: + + 4 +full(D) +find(D) + ]]> + C = sparse(C); +--> find(C) + ans = + 3. 4. 5. 7. 9. 13. 14. 15. 18. + +-->find(C, 4) + ans = + 3. 4. 5. 7. + +--> // With input boolean sparse +--> D = C > 4 + D = +( 3, 6) sparse boolean matrix +( 1, 3) T +( 1, 5) T +( 2, 5) T +( 3, 1) T +( 3, 6) T + +--> full(D) + ans = + F F T F T F + F F F F T F + T F F F F T + +-->find(D) + ans = + 3. 7. 13. 14. 18. +]]> + + With the result of a boolean element-wise condition on texts + + + find(beers == "Leffe") + ans = + 2. + +--> find(beers == "1664") + ans = + [] +]]> + + Addressing selected elements: + + + // a) Through their linearized indices: +--> H = [ 0 -2 -8 4 -5 -1 + > -2 2 -9 5 0 1 + > ]; +--> L = H; +--> L(find(L < 0)) = -10 + L = + 0. -10. -10. 4. -10. -10. + -10. 2. -10. 5. 0. 1. + +--> // b) Directly through the array of their boolean status: +--> L = H; +--> L(L < 0) = -10 + L = + 0. -10. -10. 4. -10. -10. + -10. 2. -10. 5. 0. 1. +]]> - - 参照 - - - - boolean - + vectorfind - - - extraction - + grep - - - insertion - + findobj - - - vectorfind - + boolean - - - - - + \ No newline at end of file diff --git a/scilab/modules/elementary_functions/help/pt_BR/searchandsort/find.xml b/scilab/modules/elementary_functions/help/pt_BR/searchandsort/find.xml index 4670790..8672870 100644 --- a/scilab/modules/elementary_functions/help/pt_BR/searchandsort/find.xml +++ b/scilab/modules/elementary_functions/help/pt_BR/searchandsort/find.xml @@ -2,8 +2,8 @@ - + find - encontra índices de elementos verdadeiros em uma matriz ou - vetor de booleanos + + fornece os índices de elementos %T ou diferentes de zero Seqüência de Chamamento - [ii]=find(x [,nmax]) - [i1,i2,..]=find(x [,nmax]) + + ii = find(x) + [i1,i2,..] = find(x) + .. = find(x, nmax) @@ -32,8 +37,10 @@ x - pode ser um vetor, matriz ou hipermatriz de booleanos, uma - matriz ou hipermatriz "padrão". + + vetor, matriz ou hipermatriz de booleanos ou de números. + Todos os números diferentes de zero são considerados como %T. + Matrizes esparsas são aceitas. @@ -48,9 +55,20 @@ - ii, i1, i2, .. + ii - vetores de índices inteiros ou matrizes vazias + + vetor de linha de índices linearizados de elementos %T ou diferentes + de zero, ou matriz vazia []. + + + + + i1, i2, .. + + + vetores de linha de índices direcionais, ou matriz vazia []. + @@ -84,35 +102,188 @@ Exemplos + + With input booleans: + + + A = [%F %T %T %F ; %T %F %F %T] + A = + F T T F + T F F T + +--> find(A) + ans = + 2. 3. 5. 8. + +--> find(A,2) + ans = + 2. 3. +]]> + + With input numbers: + + + B = [0 -1 0 3 ; 0 -1 -0.4 0] + B = + 0. -1. 0. 3. + 0. -1. -0.4 0. + +--> find(B) + ans = + 3. 4. 6. 7. + +--> [i, j] = find(B); +--> [i' j'] + ans = + 1. 2. + 2. 2. + 2. 3. + 1. 4. +]]> + + With an input hypermatrix of numbers: + + + E = grand(2,5,2,"uin",1,6) + E = +(:,:,1) + 1. 6. 5. 5. 4. + 6. 5. 3. 4. 4. +(:,:,2) + 2. 4. 3. 6. 5. + 5. 6. 6. 6. 4. + +--> find(E < 4) + ans = + 1. 6. 11. 15. +]]> + + With an input numerical or boolean sparse matrix: + + 4 +full(D) +find(D) + ]]> + C = sparse(C); +--> find(C) + ans = + 3. 4. 5. 7. 9. 13. 14. 15. 18. + +-->find(C, 4) + ans = + 3. 4. 5. 7. + +--> // With input boolean sparse +--> D = C > 4 + D = +( 3, 6) sparse boolean matrix +( 1, 3) T +( 1, 5) T +( 2, 5) T +( 3, 1) T +( 3, 6) T + +--> full(D) + ans = + F F T F T F + F F F F T F + T F F F F T + +-->find(D) + ans = + 3. 7. 13. 14. 18. +]]> + + With the result of a boolean element-wise condition on texts + 100) +beers = ["Desperados", "Leffe", "Kronenbourg", "Heineken"]; +find(beers == "Leffe") +find(beers == "1664") + ]]> + find(beers == "Leffe") + ans = + 2. -B=rand(1,20); -w=find(B<0.4,2) //no máximo dois valores retornados +--> find(beers == "1664") + ans = + [] +]]> + + Addressing selected elements: + + 0.9) +// b) Directly through the array of their boolean status: +L = H; +L(L < 0) = -10 + ]]> + // a) Through their linearized indices: +--> H = [ 0 -2 -8 4 -5 -1 + > -2 2 -9 5 0 1 + > ]; +--> L = H; +--> L(find(L < 0)) = -10 + L = + 0. -10. -10. 4. -10. -10. + -10. 2. -10. 5. 0. 1. -H(i(1),j(1),k(1)) - ]]> +--> // b) Directly through the array of their boolean status: +--> L = H; +--> L(L < 0) = -10 + L = + 0. -10. -10. 4. -10. -10. + -10. 2. -10. 5. 0. 1. +]]> Ver Também - boolean + vectorfind - extraction + grep - insertion + findobj - vectorfind + boolean diff --git a/scilab/modules/elementary_functions/help/ru_RU/searchandsort/find.xml b/scilab/modules/elementary_functions/help/ru_RU/searchandsort/find.xml new file mode 100644 index 0000000..77d0cd7 --- /dev/null +++ b/scilab/modules/elementary_functions/help/ru_RU/searchandsort/find.xml @@ -0,0 +1,290 @@ + + + + + find + даёт индексы элементов с ненулевым значением или значением %T + + + Синтаксис + + ii = find(x) + [i1,i2,..] = find(x) + .. = find(x, nmax) + + + + Аргументы + + + x + + + Вектор, матрица или гиперматрица логических значений или чисел. + Все ненулевые числа считаются значениями %T. Принимаются разрежённые + матрицы. + + + + + nmax + + + целое число, указывающее максимальное количество индексов для возврата. + Значение по умолчанию равно -1, которое стоит для + "все". Эта опция может использоваться для эффективности, чтобы исключить + поиск всех индексов. + + + + + ii + + + вектор-строка линеаризованных индексов с ненулевым значением, или + значением %T или пустая матрица [] + + + + + i1, i2, .. + + + векторы-строки индексов направления или пустая матрица + [] + + + + + + + Описание + + Если x является матрицей логических значений, то + + + ii=find(x) возвращает вектор индексов i, + для которых x(i) соответствует "истине". Если не найден ни один + элемент со значением "истина", то возвращается пустая матрица. + + + [i1,i2,..]=find(x) возвращает векторы индексов + i1 (для строк) и i2 (для столбцов), + .. такие, что x(i1(n),i2(n),..) + соответствует "истине". Если не найден ни один элемент со значением + "истина", то возвращаются пустые матрицы в i1, + i2, ... + + + Если x - это стандартная матрица или гиперматрица, + то find(x) интерпретируется как + find(x<>0) + + + find([]) возвращает []. + + + + Примеры + + С входными логическими значениями: + + + A = [%F %T %T %F ; %T %F %F %T] + A = + F T T F + T F F T + +--> find(A) + ans = + 2. 3. 5. 8. + +--> find(A,2) + ans = + 2. 3. +]]> + + С входными числами: + + + B = [0 -1 0 3 ; 0 -1 -0.4 0] + B = + 0. -1. 0. 3. + 0. -1. -0.4 0. + +--> find(B) + ans = + 3. 4. 6. 7. + +--> [i, j] = find(B); +--> [i' j'] + ans = + 1. 2. + 2. 2. + 2. 3. + 1. 4. +]]> + + С входными гиперматрицами чисел: + + + E = grand(2,5,2,"uin",1,6) + E = +(:,:,1) + 1. 6. 5. 5. 4. + 6. 5. 3. 4. 4. +(:,:,2) + 2. 4. 3. 6. 5. + 5. 6. 6. 6. 4. + +--> find(E < 4) + ans = + 1. 6. 11. 15. +]]> + + С входной числовой или логической разрежённой матрицей: + + 4 +full(D) +find(D) + ]]> + C = sparse(C); +--> find(C) + ans = + 3. 4. 5. 7. 9. 13. 14. 15. 18. + +-->find(C, 4) + ans = + 3. 4. 5. 7. + +--> // With input boolean sparse +--> D = C > 4 + D = +( 3, 6) sparse boolean matrix +( 1, 3) T +( 1, 5) T +( 2, 5) T +( 3, 1) T +( 3, 6) T + +--> full(D) + ans = + F F T F T F + F F F F T F + T F F F F T + +-->find(D) + ans = + 3. 7. 13. 14. 18. +]]> + + С результатом логического поэлементного условия на текстах: + + + find(beers == "Leffe") + ans = + 2. + +--> find(beers == "1664") + ans = + [] +]]> + + Адресация выбранных элементов: + + + // a) Through their linearized indices: +--> H = [ 0 -2 -8 4 -5 -1 + > -2 2 -9 5 0 1 + > ]; +--> L = H; +--> L(find(L < 0)) = -10 + L = + 0. -10. -10. 4. -10. -10. + -10. 2. -10. 5. 0. 1. + +--> // b) Directly through the array of their boolean status: +--> L = H; +--> L(L < 0) = -10 + L = + 0. -10. -10. 4. -10. -10. + -10. 2. -10. 5. 0. 1. +]]> + + + Смотрите также + + + vectorfind + + + grep + + + findobj + + + boolean + + + + -- 1.7.9.5