diff options
author | Karl Berry <karl@freefriends.org> | 2018-04-03 22:35:04 +0000 |
---|---|---|
committer | Karl Berry <karl@freefriends.org> | 2018-04-03 22:35:04 +0000 |
commit | 36b8d1341af4a7ab1f5759d75ad1eecfc375c1f4 (patch) | |
tree | 12d09b686d2c18f245dc6fd492c09cdcd4c02ebc /Build/source/utils/asymptote/runarray.in | |
parent | d73e029b665b866fe734e44508746a2cba513fd7 (diff) |
asy 2.42 sources
git-svn-id: svn://tug.org/texlive/trunk@47274 c570f23f-e606-0410-a88d-b1316a301751
Diffstat (limited to 'Build/source/utils/asymptote/runarray.in')
-rw-r--r-- | Build/source/utils/asymptote/runarray.in | 15 |
1 files changed, 14 insertions, 1 deletions
diff --git a/Build/source/utils/asymptote/runarray.in b/Build/source/utils/asymptote/runarray.in index a5e4692247f..0f1502f6abb 100644 --- a/Build/source/utils/asymptote/runarray.in +++ b/Build/source/utils/asymptote/runarray.in @@ -1102,7 +1102,7 @@ array* :array3Transpose(array *a, array *perm) return c; } -// In a boolean array, find the index of the nth true value or -1 if not found +// Find the index of the nth true value in a boolean array or -1 if not found. // If n is negative, search backwards. Int find(boolarray *a, Int n=1) { @@ -1121,6 +1121,19 @@ Int find(boolarray *a, Int n=1) return j; } +// Find all indices of true values in a boolean array. +Intarray *findall(boolarray *a) +{ + size_t size=checkArray(a); + array *b=new array(0); + for(size_t i=0; i < size; i++) { + if(read<bool>(a,i)) { + b->push((Int) i); + } + } + return b; +} + // construct vector obtained by replacing those elements of b for which the // corresponding elements of a are false by the corresponding element of c. array* :arrayConditional(array *a, array *b, array *c) |