Mercurial > octave-dspies
annotate liboctave/util/nz-iterators.h @ 19006:2e0613dadfee draft
All calls to "find" use the same generic implementation (bug #42408, 42421)
* find.cc: Rewrite.
Move generic "find" logic to find.h
(Ffind) : Changed calls to find_nonzero_elem_idx to find_templated
Added unit test for bug #42421
* Array.cc (and .h) (Array::find): Deleted function. Replaced with find::find(Array)
from find.h
* Array.h: Added typedef for array_iterator (in nz-iterators.h) as
Array::iter_type
* DiagArray2.h: Added typedef for diag_iterator (in nz-iterators.h) as
DiagArray2::iter_type
* PermMatrix.h: Added typedef for perm_iterator (in nz-iterators.h) as
PermMatrix::iter_type
Also added typedef for bool as PermMatrix::element_type
(not octave_idx_type)
Added an nnz() function (which is an alias for perm_length) and a
perm_elem(i) function for retrieving the ith element of the permutation
* Sparse.h: Added typedef for sparse_iterator (in nz-iterators.h) as
Sparse::iter_type
Added a short comment documenting the the argument to the numel
function
* idx-vector.cc (idx_vector::idx_mask_rep::as_array): Changed Array.find to
find::find(Array) (in find.h)
* (new file) find.h
* (new file) interp-idx.h: Simple methods for converting between interpreter
index type and internal octave_idx_type/row-col pair
* (new file) min-with-nnz.h: Fast methods for taking an arbitrary matrix M and
an octave_idx_type n and finding min(M.nnz(), n)
* (new file) nz-iterators.h: Iterators for traversing (in column-major order)
the nonzero elements of any array or matrix backwards or forwards
* (new file) direction.h: Generic methods for simplifying code has to deal with
a "backwards or forwards" template argument
* build-sparse-tests.sh: Removed 5-return-value calls to "find" in unit-tests;
Admittedly this commit breaks this "feature" which was undocumented and only
partially supported to begin with (ie never worked for full matrices,
permutation matrices, or diagonal matrices)
author | David Spies <dnspies@gmail.com> |
---|---|
date | Tue, 17 Jun 2014 16:41:11 -0600 |
parents | |
children | 8d47ce2053f2 |
rev | line source |
---|---|
19006
2e0613dadfee
All calls to "find" use the same generic implementation (bug #42408, 42421)
David Spies <dnspies@gmail.com>
parents:
diff
changeset
|
1 /* |
2e0613dadfee
All calls to "find" use the same generic implementation (bug #42408, 42421)
David Spies <dnspies@gmail.com>
parents:
diff
changeset
|
2 |
2e0613dadfee
All calls to "find" use the same generic implementation (bug #42408, 42421)
David Spies <dnspies@gmail.com>
parents:
diff
changeset
|
3 Copyright (C) 2014 David Spies |
2e0613dadfee
All calls to "find" use the same generic implementation (bug #42408, 42421)
David Spies <dnspies@gmail.com>
parents:
diff
changeset
|
4 |
2e0613dadfee
All calls to "find" use the same generic implementation (bug #42408, 42421)
David Spies <dnspies@gmail.com>
parents:
diff
changeset
|
5 This file is part of Octave. |
2e0613dadfee
All calls to "find" use the same generic implementation (bug #42408, 42421)
David Spies <dnspies@gmail.com>
parents:
diff
changeset
|
6 |
2e0613dadfee
All calls to "find" use the same generic implementation (bug #42408, 42421)
David Spies <dnspies@gmail.com>
parents:
diff
changeset
|
7 Octave is free software; you can redistribute it and/or modify it |
2e0613dadfee
All calls to "find" use the same generic implementation (bug #42408, 42421)
David Spies <dnspies@gmail.com>
parents:
diff
changeset
|
8 under the terms of the GNU General Public License as published by the |
2e0613dadfee
All calls to "find" use the same generic implementation (bug #42408, 42421)
David Spies <dnspies@gmail.com>
parents:
diff
changeset
|
9 Free Software Foundation; either version 3 of the License, or (at your |
2e0613dadfee
All calls to "find" use the same generic implementation (bug #42408, 42421)
David Spies <dnspies@gmail.com>
parents:
diff
changeset
|
10 option) any later version. |
2e0613dadfee
All calls to "find" use the same generic implementation (bug #42408, 42421)
David Spies <dnspies@gmail.com>
parents:
diff
changeset
|
11 |
2e0613dadfee
All calls to "find" use the same generic implementation (bug #42408, 42421)
David Spies <dnspies@gmail.com>
parents:
diff
changeset
|
12 Octave is distributed in the hope that it will be useful, but WITHOUT |
2e0613dadfee
All calls to "find" use the same generic implementation (bug #42408, 42421)
David Spies <dnspies@gmail.com>
parents:
diff
changeset
|
13 ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or |
2e0613dadfee
All calls to "find" use the same generic implementation (bug #42408, 42421)
David Spies <dnspies@gmail.com>
parents:
diff
changeset
|
14 FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License |
2e0613dadfee
All calls to "find" use the same generic implementation (bug #42408, 42421)
David Spies <dnspies@gmail.com>
parents:
diff
changeset
|
15 for more details. |
2e0613dadfee
All calls to "find" use the same generic implementation (bug #42408, 42421)
David Spies <dnspies@gmail.com>
parents:
diff
changeset
|
16 |
2e0613dadfee
All calls to "find" use the same generic implementation (bug #42408, 42421)
David Spies <dnspies@gmail.com>
parents:
diff
changeset
|
17 You should have received a copy of the GNU General Public License |
2e0613dadfee
All calls to "find" use the same generic implementation (bug #42408, 42421)
David Spies <dnspies@gmail.com>
parents:
diff
changeset
|
18 along with Octave; see the file COPYING. If not, see |
2e0613dadfee
All calls to "find" use the same generic implementation (bug #42408, 42421)
David Spies <dnspies@gmail.com>
parents:
diff
changeset
|
19 <http://www.gnu.org/licenses/>. |
2e0613dadfee
All calls to "find" use the same generic implementation (bug #42408, 42421)
David Spies <dnspies@gmail.com>
parents:
diff
changeset
|
20 |
2e0613dadfee
All calls to "find" use the same generic implementation (bug #42408, 42421)
David Spies <dnspies@gmail.com>
parents:
diff
changeset
|
21 */ |
2e0613dadfee
All calls to "find" use the same generic implementation (bug #42408, 42421)
David Spies <dnspies@gmail.com>
parents:
diff
changeset
|
22 #if !defined (octave_nz_iterators_h) |
2e0613dadfee
All calls to "find" use the same generic implementation (bug #42408, 42421)
David Spies <dnspies@gmail.com>
parents:
diff
changeset
|
23 #define octave_nz_iterators_h 1 |
2e0613dadfee
All calls to "find" use the same generic implementation (bug #42408, 42421)
David Spies <dnspies@gmail.com>
parents:
diff
changeset
|
24 |
2e0613dadfee
All calls to "find" use the same generic implementation (bug #42408, 42421)
David Spies <dnspies@gmail.com>
parents:
diff
changeset
|
25 #include "interp-idx.h" |
2e0613dadfee
All calls to "find" use the same generic implementation (bug #42408, 42421)
David Spies <dnspies@gmail.com>
parents:
diff
changeset
|
26 #include "oct-inttypes.h" |
2e0613dadfee
All calls to "find" use the same generic implementation (bug #42408, 42421)
David Spies <dnspies@gmail.com>
parents:
diff
changeset
|
27 #include "Array.h" |
2e0613dadfee
All calls to "find" use the same generic implementation (bug #42408, 42421)
David Spies <dnspies@gmail.com>
parents:
diff
changeset
|
28 #include "DiagArray2.h" |
2e0613dadfee
All calls to "find" use the same generic implementation (bug #42408, 42421)
David Spies <dnspies@gmail.com>
parents:
diff
changeset
|
29 #include "PermMatrix.h" |
2e0613dadfee
All calls to "find" use the same generic implementation (bug #42408, 42421)
David Spies <dnspies@gmail.com>
parents:
diff
changeset
|
30 #include "Sparse.h" |
2e0613dadfee
All calls to "find" use the same generic implementation (bug #42408, 42421)
David Spies <dnspies@gmail.com>
parents:
diff
changeset
|
31 #include "direction.h" |
2e0613dadfee
All calls to "find" use the same generic implementation (bug #42408, 42421)
David Spies <dnspies@gmail.com>
parents:
diff
changeset
|
32 |
2e0613dadfee
All calls to "find" use the same generic implementation (bug #42408, 42421)
David Spies <dnspies@gmail.com>
parents:
diff
changeset
|
33 // This file contains generic column-major iterators over |
2e0613dadfee
All calls to "find" use the same generic implementation (bug #42408, 42421)
David Spies <dnspies@gmail.com>
parents:
diff
changeset
|
34 // the nonzero elements of any array or matrix. If you have a matrix mat |
2e0613dadfee
All calls to "find" use the same generic implementation (bug #42408, 42421)
David Spies <dnspies@gmail.com>
parents:
diff
changeset
|
35 // of type M, you can construct the proper iterator type using |
2e0613dadfee
All calls to "find" use the same generic implementation (bug #42408, 42421)
David Spies <dnspies@gmail.com>
parents:
diff
changeset
|
36 // M::iter_type iter(mat) and iter will iterate efficiently (forwards |
2e0613dadfee
All calls to "find" use the same generic implementation (bug #42408, 42421)
David Spies <dnspies@gmail.com>
parents:
diff
changeset
|
37 // or backwards) over the nonzero elements of mat. |
2e0613dadfee
All calls to "find" use the same generic implementation (bug #42408, 42421)
David Spies <dnspies@gmail.com>
parents:
diff
changeset
|
38 // |
2e0613dadfee
All calls to "find" use the same generic implementation (bug #42408, 42421)
David Spies <dnspies@gmail.com>
parents:
diff
changeset
|
39 // The parameter T is the element-type except for PermMatrix where |
2e0613dadfee
All calls to "find" use the same generic implementation (bug #42408, 42421)
David Spies <dnspies@gmail.com>
parents:
diff
changeset
|
40 // the element type is always bool |
2e0613dadfee
All calls to "find" use the same generic implementation (bug #42408, 42421)
David Spies <dnspies@gmail.com>
parents:
diff
changeset
|
41 // |
2e0613dadfee
All calls to "find" use the same generic implementation (bug #42408, 42421)
David Spies <dnspies@gmail.com>
parents:
diff
changeset
|
42 // Use a dir_handler to indicate which direction you intend to iterate. |
2e0613dadfee
All calls to "find" use the same generic implementation (bug #42408, 42421)
David Spies <dnspies@gmail.com>
parents:
diff
changeset
|
43 // (see step-dir.h). begin() resets the iterator to the beginning or |
2e0613dadfee
All calls to "find" use the same generic implementation (bug #42408, 42421)
David Spies <dnspies@gmail.com>
parents:
diff
changeset
|
44 // end of the matrix (for dir_handler<FORWARD> and <BACKWARD> respectively). |
2e0613dadfee
All calls to "find" use the same generic implementation (bug #42408, 42421)
David Spies <dnspies@gmail.com>
parents:
diff
changeset
|
45 // finished(dirc) indicates whether the iterators has finished traversing |
2e0613dadfee
All calls to "find" use the same generic implementation (bug #42408, 42421)
David Spies <dnspies@gmail.com>
parents:
diff
changeset
|
46 // the nonzero elements. step(dirc) steps from one element to the next. |
2e0613dadfee
All calls to "find" use the same generic implementation (bug #42408, 42421)
David Spies <dnspies@gmail.com>
parents:
diff
changeset
|
47 // |
2e0613dadfee
All calls to "find" use the same generic implementation (bug #42408, 42421)
David Spies <dnspies@gmail.com>
parents:
diff
changeset
|
48 // You can, for instance, use a for-loop as follows: |
2e0613dadfee
All calls to "find" use the same generic implementation (bug #42408, 42421)
David Spies <dnspies@gmail.com>
parents:
diff
changeset
|
49 // |
2e0613dadfee
All calls to "find" use the same generic implementation (bug #42408, 42421)
David Spies <dnspies@gmail.com>
parents:
diff
changeset
|
50 // typedef M::iter_type iter_t; |
2e0613dadfee
All calls to "find" use the same generic implementation (bug #42408, 42421)
David Spies <dnspies@gmail.com>
parents:
diff
changeset
|
51 // typedef M::element_type T; |
2e0613dadfee
All calls to "find" use the same generic implementation (bug #42408, 42421)
David Spies <dnspies@gmail.com>
parents:
diff
changeset
|
52 // |
2e0613dadfee
All calls to "find" use the same generic implementation (bug #42408, 42421)
David Spies <dnspies@gmail.com>
parents:
diff
changeset
|
53 // iter_t iter(mat); |
2e0613dadfee
All calls to "find" use the same generic implementation (bug #42408, 42421)
David Spies <dnspies@gmail.com>
parents:
diff
changeset
|
54 // dir_handler<1> dirc; |
2e0613dadfee
All calls to "find" use the same generic implementation (bug #42408, 42421)
David Spies <dnspies@gmail.com>
parents:
diff
changeset
|
55 // |
2e0613dadfee
All calls to "find" use the same generic implementation (bug #42408, 42421)
David Spies <dnspies@gmail.com>
parents:
diff
changeset
|
56 // for(iter.begin (dirc); !iter.finished (dirc); iter.step (dirc)) |
2e0613dadfee
All calls to "find" use the same generic implementation (bug #42408, 42421)
David Spies <dnspies@gmail.com>
parents:
diff
changeset
|
57 // { |
2e0613dadfee
All calls to "find" use the same generic implementation (bug #42408, 42421)
David Spies <dnspies@gmail.com>
parents:
diff
changeset
|
58 // octave_idx_type row = iter.row(); |
2e0613dadfee
All calls to "find" use the same generic implementation (bug #42408, 42421)
David Spies <dnspies@gmail.com>
parents:
diff
changeset
|
59 // octave_idx_type col = iter.col(); |
2e0613dadfee
All calls to "find" use the same generic implementation (bug #42408, 42421)
David Spies <dnspies@gmail.com>
parents:
diff
changeset
|
60 // double doub_index = iter.interp_index (); |
2e0613dadfee
All calls to "find" use the same generic implementation (bug #42408, 42421)
David Spies <dnspies@gmail.com>
parents:
diff
changeset
|
61 // T elem = iter.data(); |
2e0613dadfee
All calls to "find" use the same generic implementation (bug #42408, 42421)
David Spies <dnspies@gmail.com>
parents:
diff
changeset
|
62 // // ... Do something with these |
2e0613dadfee
All calls to "find" use the same generic implementation (bug #42408, 42421)
David Spies <dnspies@gmail.com>
parents:
diff
changeset
|
63 // } |
2e0613dadfee
All calls to "find" use the same generic implementation (bug #42408, 42421)
David Spies <dnspies@gmail.com>
parents:
diff
changeset
|
64 // |
2e0613dadfee
All calls to "find" use the same generic implementation (bug #42408, 42421)
David Spies <dnspies@gmail.com>
parents:
diff
changeset
|
65 // Note that array_iter for indexing over full matrices also includes |
2e0613dadfee
All calls to "find" use the same generic implementation (bug #42408, 42421)
David Spies <dnspies@gmail.com>
parents:
diff
changeset
|
66 // a iter.flat_index () method which returns an octave_idx_type. |
2e0613dadfee
All calls to "find" use the same generic implementation (bug #42408, 42421)
David Spies <dnspies@gmail.com>
parents:
diff
changeset
|
67 // |
2e0613dadfee
All calls to "find" use the same generic implementation (bug #42408, 42421)
David Spies <dnspies@gmail.com>
parents:
diff
changeset
|
68 // The other iterators to not have a flat_index() method because they |
2e0613dadfee
All calls to "find" use the same generic implementation (bug #42408, 42421)
David Spies <dnspies@gmail.com>
parents:
diff
changeset
|
69 // risk overflowing octave_idx_type. It is recommended you take care |
2e0613dadfee
All calls to "find" use the same generic implementation (bug #42408, 42421)
David Spies <dnspies@gmail.com>
parents:
diff
changeset
|
70 // to implement your function in a way that accounts for this problem. |
2e0613dadfee
All calls to "find" use the same generic implementation (bug #42408, 42421)
David Spies <dnspies@gmail.com>
parents:
diff
changeset
|
71 // |
2e0613dadfee
All calls to "find" use the same generic implementation (bug #42408, 42421)
David Spies <dnspies@gmail.com>
parents:
diff
changeset
|
72 // FIXME: I'd like to add in these |
2e0613dadfee
All calls to "find" use the same generic implementation (bug #42408, 42421)
David Spies <dnspies@gmail.com>
parents:
diff
changeset
|
73 // default no-parameter versions of |
2e0613dadfee
All calls to "find" use the same generic implementation (bug #42408, 42421)
David Spies <dnspies@gmail.com>
parents:
diff
changeset
|
74 // begin() and step() to each of the |
2e0613dadfee
All calls to "find" use the same generic implementation (bug #42408, 42421)
David Spies <dnspies@gmail.com>
parents:
diff
changeset
|
75 // classes. But the C++ compiler complains |
2e0613dadfee
All calls to "find" use the same generic implementation (bug #42408, 42421)
David Spies <dnspies@gmail.com>
parents:
diff
changeset
|
76 // because apparently I'm not allowed to overload |
2e0613dadfee
All calls to "find" use the same generic implementation (bug #42408, 42421)
David Spies <dnspies@gmail.com>
parents:
diff
changeset
|
77 // templated methods with non-templated ones. Any |
2e0613dadfee
All calls to "find" use the same generic implementation (bug #42408, 42421)
David Spies <dnspies@gmail.com>
parents:
diff
changeset
|
78 // ideas for work-arounds? |
2e0613dadfee
All calls to "find" use the same generic implementation (bug #42408, 42421)
David Spies <dnspies@gmail.com>
parents:
diff
changeset
|
79 // |
2e0613dadfee
All calls to "find" use the same generic implementation (bug #42408, 42421)
David Spies <dnspies@gmail.com>
parents:
diff
changeset
|
80 //#define INCLUDE_DEFAULT_STEPS \ |
2e0613dadfee
All calls to "find" use the same generic implementation (bug #42408, 42421)
David Spies <dnspies@gmail.com>
parents:
diff
changeset
|
81 // void begin (void) \ |
2e0613dadfee
All calls to "find" use the same generic implementation (bug #42408, 42421)
David Spies <dnspies@gmail.com>
parents:
diff
changeset
|
82 // { \ |
2e0613dadfee
All calls to "find" use the same generic implementation (bug #42408, 42421)
David Spies <dnspies@gmail.com>
parents:
diff
changeset
|
83 // dir_handler<FORWARD> dirc; \ |
2e0613dadfee
All calls to "find" use the same generic implementation (bug #42408, 42421)
David Spies <dnspies@gmail.com>
parents:
diff
changeset
|
84 // begin (dirc); \ |
2e0613dadfee
All calls to "find" use the same generic implementation (bug #42408, 42421)
David Spies <dnspies@gmail.com>
parents:
diff
changeset
|
85 // } \ |
2e0613dadfee
All calls to "find" use the same generic implementation (bug #42408, 42421)
David Spies <dnspies@gmail.com>
parents:
diff
changeset
|
86 // void step (void) \ |
2e0613dadfee
All calls to "find" use the same generic implementation (bug #42408, 42421)
David Spies <dnspies@gmail.com>
parents:
diff
changeset
|
87 // { \ |
2e0613dadfee
All calls to "find" use the same generic implementation (bug #42408, 42421)
David Spies <dnspies@gmail.com>
parents:
diff
changeset
|
88 // dir_handler<FORWARD> dirc; \ |
2e0613dadfee
All calls to "find" use the same generic implementation (bug #42408, 42421)
David Spies <dnspies@gmail.com>
parents:
diff
changeset
|
89 // step (dirc); \ |
2e0613dadfee
All calls to "find" use the same generic implementation (bug #42408, 42421)
David Spies <dnspies@gmail.com>
parents:
diff
changeset
|
90 // } \ |
2e0613dadfee
All calls to "find" use the same generic implementation (bug #42408, 42421)
David Spies <dnspies@gmail.com>
parents:
diff
changeset
|
91 // bool finished (void) const \ |
2e0613dadfee
All calls to "find" use the same generic implementation (bug #42408, 42421)
David Spies <dnspies@gmail.com>
parents:
diff
changeset
|
92 // { \ |
2e0613dadfee
All calls to "find" use the same generic implementation (bug #42408, 42421)
David Spies <dnspies@gmail.com>
parents:
diff
changeset
|
93 // dir_handler<FORWARD> dirc; \ |
2e0613dadfee
All calls to "find" use the same generic implementation (bug #42408, 42421)
David Spies <dnspies@gmail.com>
parents:
diff
changeset
|
94 // return finished (dirc); \ |
2e0613dadfee
All calls to "find" use the same generic implementation (bug #42408, 42421)
David Spies <dnspies@gmail.com>
parents:
diff
changeset
|
95 // } |
2e0613dadfee
All calls to "find" use the same generic implementation (bug #42408, 42421)
David Spies <dnspies@gmail.com>
parents:
diff
changeset
|
96 |
2e0613dadfee
All calls to "find" use the same generic implementation (bug #42408, 42421)
David Spies <dnspies@gmail.com>
parents:
diff
changeset
|
97 // A generic method for checking if some element of a matrix with |
2e0613dadfee
All calls to "find" use the same generic implementation (bug #42408, 42421)
David Spies <dnspies@gmail.com>
parents:
diff
changeset
|
98 // element type T is zero. |
2e0613dadfee
All calls to "find" use the same generic implementation (bug #42408, 42421)
David Spies <dnspies@gmail.com>
parents:
diff
changeset
|
99 template<typename T> |
2e0613dadfee
All calls to "find" use the same generic implementation (bug #42408, 42421)
David Spies <dnspies@gmail.com>
parents:
diff
changeset
|
100 bool |
2e0613dadfee
All calls to "find" use the same generic implementation (bug #42408, 42421)
David Spies <dnspies@gmail.com>
parents:
diff
changeset
|
101 is_zero (T t) |
2e0613dadfee
All calls to "find" use the same generic implementation (bug #42408, 42421)
David Spies <dnspies@gmail.com>
parents:
diff
changeset
|
102 { |
2e0613dadfee
All calls to "find" use the same generic implementation (bug #42408, 42421)
David Spies <dnspies@gmail.com>
parents:
diff
changeset
|
103 return t == static_cast<T> (0); |
2e0613dadfee
All calls to "find" use the same generic implementation (bug #42408, 42421)
David Spies <dnspies@gmail.com>
parents:
diff
changeset
|
104 } |
2e0613dadfee
All calls to "find" use the same generic implementation (bug #42408, 42421)
David Spies <dnspies@gmail.com>
parents:
diff
changeset
|
105 |
2e0613dadfee
All calls to "find" use the same generic implementation (bug #42408, 42421)
David Spies <dnspies@gmail.com>
parents:
diff
changeset
|
106 // An iterator over full arrays. When the number of dimensions exceeds |
2e0613dadfee
All calls to "find" use the same generic implementation (bug #42408, 42421)
David Spies <dnspies@gmail.com>
parents:
diff
changeset
|
107 // 2, calls to iter.col() may exceed mat.cols() up to mat.dims().numel(1) |
2e0613dadfee
All calls to "find" use the same generic implementation (bug #42408, 42421)
David Spies <dnspies@gmail.com>
parents:
diff
changeset
|
108 // |
2e0613dadfee
All calls to "find" use the same generic implementation (bug #42408, 42421)
David Spies <dnspies@gmail.com>
parents:
diff
changeset
|
109 // This mimics the behavior of the "find" method (both in Octave and Matlab) |
2e0613dadfee
All calls to "find" use the same generic implementation (bug #42408, 42421)
David Spies <dnspies@gmail.com>
parents:
diff
changeset
|
110 // on many-dimensional matrices. |
2e0613dadfee
All calls to "find" use the same generic implementation (bug #42408, 42421)
David Spies <dnspies@gmail.com>
parents:
diff
changeset
|
111 |
2e0613dadfee
All calls to "find" use the same generic implementation (bug #42408, 42421)
David Spies <dnspies@gmail.com>
parents:
diff
changeset
|
112 template<typename T> |
2e0613dadfee
All calls to "find" use the same generic implementation (bug #42408, 42421)
David Spies <dnspies@gmail.com>
parents:
diff
changeset
|
113 class array_iterator |
2e0613dadfee
All calls to "find" use the same generic implementation (bug #42408, 42421)
David Spies <dnspies@gmail.com>
parents:
diff
changeset
|
114 { |
2e0613dadfee
All calls to "find" use the same generic implementation (bug #42408, 42421)
David Spies <dnspies@gmail.com>
parents:
diff
changeset
|
115 private: |
2e0613dadfee
All calls to "find" use the same generic implementation (bug #42408, 42421)
David Spies <dnspies@gmail.com>
parents:
diff
changeset
|
116 const Array<T>& mat; |
2e0613dadfee
All calls to "find" use the same generic implementation (bug #42408, 42421)
David Spies <dnspies@gmail.com>
parents:
diff
changeset
|
117 |
2e0613dadfee
All calls to "find" use the same generic implementation (bug #42408, 42421)
David Spies <dnspies@gmail.com>
parents:
diff
changeset
|
118 //Actual total number of columns = mat.dims().numel(1) |
2e0613dadfee
All calls to "find" use the same generic implementation (bug #42408, 42421)
David Spies <dnspies@gmail.com>
parents:
diff
changeset
|
119 //can be different from length of row dimension |
2e0613dadfee
All calls to "find" use the same generic implementation (bug #42408, 42421)
David Spies <dnspies@gmail.com>
parents:
diff
changeset
|
120 const octave_idx_type totcols; |
2e0613dadfee
All calls to "find" use the same generic implementation (bug #42408, 42421)
David Spies <dnspies@gmail.com>
parents:
diff
changeset
|
121 const octave_idx_type numels; |
2e0613dadfee
All calls to "find" use the same generic implementation (bug #42408, 42421)
David Spies <dnspies@gmail.com>
parents:
diff
changeset
|
122 |
2e0613dadfee
All calls to "find" use the same generic implementation (bug #42408, 42421)
David Spies <dnspies@gmail.com>
parents:
diff
changeset
|
123 octave_idx_type coli; |
2e0613dadfee
All calls to "find" use the same generic implementation (bug #42408, 42421)
David Spies <dnspies@gmail.com>
parents:
diff
changeset
|
124 octave_idx_type rowj; |
2e0613dadfee
All calls to "find" use the same generic implementation (bug #42408, 42421)
David Spies <dnspies@gmail.com>
parents:
diff
changeset
|
125 octave_idx_type my_idx; |
2e0613dadfee
All calls to "find" use the same generic implementation (bug #42408, 42421)
David Spies <dnspies@gmail.com>
parents:
diff
changeset
|
126 |
2e0613dadfee
All calls to "find" use the same generic implementation (bug #42408, 42421)
David Spies <dnspies@gmail.com>
parents:
diff
changeset
|
127 template<direction dir> |
2e0613dadfee
All calls to "find" use the same generic implementation (bug #42408, 42421)
David Spies <dnspies@gmail.com>
parents:
diff
changeset
|
128 void |
2e0613dadfee
All calls to "find" use the same generic implementation (bug #42408, 42421)
David Spies <dnspies@gmail.com>
parents:
diff
changeset
|
129 step_once (dir_handler<dir> dirc) |
2e0613dadfee
All calls to "find" use the same generic implementation (bug #42408, 42421)
David Spies <dnspies@gmail.com>
parents:
diff
changeset
|
130 { |
2e0613dadfee
All calls to "find" use the same generic implementation (bug #42408, 42421)
David Spies <dnspies@gmail.com>
parents:
diff
changeset
|
131 my_idx += dir; |
2e0613dadfee
All calls to "find" use the same generic implementation (bug #42408, 42421)
David Spies <dnspies@gmail.com>
parents:
diff
changeset
|
132 rowj += dir; |
2e0613dadfee
All calls to "find" use the same generic implementation (bug #42408, 42421)
David Spies <dnspies@gmail.com>
parents:
diff
changeset
|
133 if (dirc.is_ended (rowj, mat.rows ())) |
2e0613dadfee
All calls to "find" use the same generic implementation (bug #42408, 42421)
David Spies <dnspies@gmail.com>
parents:
diff
changeset
|
134 { |
2e0613dadfee
All calls to "find" use the same generic implementation (bug #42408, 42421)
David Spies <dnspies@gmail.com>
parents:
diff
changeset
|
135 rowj = dirc.begin (mat.rows ()); |
2e0613dadfee
All calls to "find" use the same generic implementation (bug #42408, 42421)
David Spies <dnspies@gmail.com>
parents:
diff
changeset
|
136 coli += dir; |
2e0613dadfee
All calls to "find" use the same generic implementation (bug #42408, 42421)
David Spies <dnspies@gmail.com>
parents:
diff
changeset
|
137 } |
2e0613dadfee
All calls to "find" use the same generic implementation (bug #42408, 42421)
David Spies <dnspies@gmail.com>
parents:
diff
changeset
|
138 } |
2e0613dadfee
All calls to "find" use the same generic implementation (bug #42408, 42421)
David Spies <dnspies@gmail.com>
parents:
diff
changeset
|
139 |
2e0613dadfee
All calls to "find" use the same generic implementation (bug #42408, 42421)
David Spies <dnspies@gmail.com>
parents:
diff
changeset
|
140 template<direction dir> |
2e0613dadfee
All calls to "find" use the same generic implementation (bug #42408, 42421)
David Spies <dnspies@gmail.com>
parents:
diff
changeset
|
141 void |
2e0613dadfee
All calls to "find" use the same generic implementation (bug #42408, 42421)
David Spies <dnspies@gmail.com>
parents:
diff
changeset
|
142 move_to_nz (dir_handler<dir> dirc) |
2e0613dadfee
All calls to "find" use the same generic implementation (bug #42408, 42421)
David Spies <dnspies@gmail.com>
parents:
diff
changeset
|
143 { |
2e0613dadfee
All calls to "find" use the same generic implementation (bug #42408, 42421)
David Spies <dnspies@gmail.com>
parents:
diff
changeset
|
144 while (!finished (dirc) && is_zero (data ())) |
2e0613dadfee
All calls to "find" use the same generic implementation (bug #42408, 42421)
David Spies <dnspies@gmail.com>
parents:
diff
changeset
|
145 { |
2e0613dadfee
All calls to "find" use the same generic implementation (bug #42408, 42421)
David Spies <dnspies@gmail.com>
parents:
diff
changeset
|
146 step_once (dirc); |
2e0613dadfee
All calls to "find" use the same generic implementation (bug #42408, 42421)
David Spies <dnspies@gmail.com>
parents:
diff
changeset
|
147 } |
2e0613dadfee
All calls to "find" use the same generic implementation (bug #42408, 42421)
David Spies <dnspies@gmail.com>
parents:
diff
changeset
|
148 } |
2e0613dadfee
All calls to "find" use the same generic implementation (bug #42408, 42421)
David Spies <dnspies@gmail.com>
parents:
diff
changeset
|
149 |
2e0613dadfee
All calls to "find" use the same generic implementation (bug #42408, 42421)
David Spies <dnspies@gmail.com>
parents:
diff
changeset
|
150 |
2e0613dadfee
All calls to "find" use the same generic implementation (bug #42408, 42421)
David Spies <dnspies@gmail.com>
parents:
diff
changeset
|
151 public: |
2e0613dadfee
All calls to "find" use the same generic implementation (bug #42408, 42421)
David Spies <dnspies@gmail.com>
parents:
diff
changeset
|
152 array_iterator (const Array<T>& arg_mat) |
2e0613dadfee
All calls to "find" use the same generic implementation (bug #42408, 42421)
David Spies <dnspies@gmail.com>
parents:
diff
changeset
|
153 : mat (arg_mat), totcols (arg_mat.dims ().numel (1)), numels ( |
2e0613dadfee
All calls to "find" use the same generic implementation (bug #42408, 42421)
David Spies <dnspies@gmail.com>
parents:
diff
changeset
|
154 totcols * arg_mat.rows ()) |
2e0613dadfee
All calls to "find" use the same generic implementation (bug #42408, 42421)
David Spies <dnspies@gmail.com>
parents:
diff
changeset
|
155 { |
2e0613dadfee
All calls to "find" use the same generic implementation (bug #42408, 42421)
David Spies <dnspies@gmail.com>
parents:
diff
changeset
|
156 dir_handler<FORWARD> dirc; |
2e0613dadfee
All calls to "find" use the same generic implementation (bug #42408, 42421)
David Spies <dnspies@gmail.com>
parents:
diff
changeset
|
157 begin (dirc); |
2e0613dadfee
All calls to "find" use the same generic implementation (bug #42408, 42421)
David Spies <dnspies@gmail.com>
parents:
diff
changeset
|
158 } |
2e0613dadfee
All calls to "find" use the same generic implementation (bug #42408, 42421)
David Spies <dnspies@gmail.com>
parents:
diff
changeset
|
159 |
2e0613dadfee
All calls to "find" use the same generic implementation (bug #42408, 42421)
David Spies <dnspies@gmail.com>
parents:
diff
changeset
|
160 template<direction dir> |
2e0613dadfee
All calls to "find" use the same generic implementation (bug #42408, 42421)
David Spies <dnspies@gmail.com>
parents:
diff
changeset
|
161 void |
2e0613dadfee
All calls to "find" use the same generic implementation (bug #42408, 42421)
David Spies <dnspies@gmail.com>
parents:
diff
changeset
|
162 begin (dir_handler<dir> dirc) |
2e0613dadfee
All calls to "find" use the same generic implementation (bug #42408, 42421)
David Spies <dnspies@gmail.com>
parents:
diff
changeset
|
163 { |
2e0613dadfee
All calls to "find" use the same generic implementation (bug #42408, 42421)
David Spies <dnspies@gmail.com>
parents:
diff
changeset
|
164 coli = dirc.begin (totcols); |
2e0613dadfee
All calls to "find" use the same generic implementation (bug #42408, 42421)
David Spies <dnspies@gmail.com>
parents:
diff
changeset
|
165 rowj = dirc.begin (mat.rows ()); |
2e0613dadfee
All calls to "find" use the same generic implementation (bug #42408, 42421)
David Spies <dnspies@gmail.com>
parents:
diff
changeset
|
166 my_idx = dirc.begin (mat.numel ()); |
2e0613dadfee
All calls to "find" use the same generic implementation (bug #42408, 42421)
David Spies <dnspies@gmail.com>
parents:
diff
changeset
|
167 move_to_nz (dirc); |
2e0613dadfee
All calls to "find" use the same generic implementation (bug #42408, 42421)
David Spies <dnspies@gmail.com>
parents:
diff
changeset
|
168 } |
2e0613dadfee
All calls to "find" use the same generic implementation (bug #42408, 42421)
David Spies <dnspies@gmail.com>
parents:
diff
changeset
|
169 |
2e0613dadfee
All calls to "find" use the same generic implementation (bug #42408, 42421)
David Spies <dnspies@gmail.com>
parents:
diff
changeset
|
170 octave_idx_type |
2e0613dadfee
All calls to "find" use the same generic implementation (bug #42408, 42421)
David Spies <dnspies@gmail.com>
parents:
diff
changeset
|
171 col (void) const |
2e0613dadfee
All calls to "find" use the same generic implementation (bug #42408, 42421)
David Spies <dnspies@gmail.com>
parents:
diff
changeset
|
172 { |
2e0613dadfee
All calls to "find" use the same generic implementation (bug #42408, 42421)
David Spies <dnspies@gmail.com>
parents:
diff
changeset
|
173 return coli; |
2e0613dadfee
All calls to "find" use the same generic implementation (bug #42408, 42421)
David Spies <dnspies@gmail.com>
parents:
diff
changeset
|
174 } |
2e0613dadfee
All calls to "find" use the same generic implementation (bug #42408, 42421)
David Spies <dnspies@gmail.com>
parents:
diff
changeset
|
175 octave_idx_type |
2e0613dadfee
All calls to "find" use the same generic implementation (bug #42408, 42421)
David Spies <dnspies@gmail.com>
parents:
diff
changeset
|
176 row (void) const |
2e0613dadfee
All calls to "find" use the same generic implementation (bug #42408, 42421)
David Spies <dnspies@gmail.com>
parents:
diff
changeset
|
177 { |
2e0613dadfee
All calls to "find" use the same generic implementation (bug #42408, 42421)
David Spies <dnspies@gmail.com>
parents:
diff
changeset
|
178 return rowj; |
2e0613dadfee
All calls to "find" use the same generic implementation (bug #42408, 42421)
David Spies <dnspies@gmail.com>
parents:
diff
changeset
|
179 } |
2e0613dadfee
All calls to "find" use the same generic implementation (bug #42408, 42421)
David Spies <dnspies@gmail.com>
parents:
diff
changeset
|
180 double |
2e0613dadfee
All calls to "find" use the same generic implementation (bug #42408, 42421)
David Spies <dnspies@gmail.com>
parents:
diff
changeset
|
181 interp_idx (void) const |
2e0613dadfee
All calls to "find" use the same generic implementation (bug #42408, 42421)
David Spies <dnspies@gmail.com>
parents:
diff
changeset
|
182 { |
2e0613dadfee
All calls to "find" use the same generic implementation (bug #42408, 42421)
David Spies <dnspies@gmail.com>
parents:
diff
changeset
|
183 return to_interp_idx (my_idx); |
2e0613dadfee
All calls to "find" use the same generic implementation (bug #42408, 42421)
David Spies <dnspies@gmail.com>
parents:
diff
changeset
|
184 } |
2e0613dadfee
All calls to "find" use the same generic implementation (bug #42408, 42421)
David Spies <dnspies@gmail.com>
parents:
diff
changeset
|
185 octave_idx_type |
2e0613dadfee
All calls to "find" use the same generic implementation (bug #42408, 42421)
David Spies <dnspies@gmail.com>
parents:
diff
changeset
|
186 flat_idx (void) const |
2e0613dadfee
All calls to "find" use the same generic implementation (bug #42408, 42421)
David Spies <dnspies@gmail.com>
parents:
diff
changeset
|
187 { |
2e0613dadfee
All calls to "find" use the same generic implementation (bug #42408, 42421)
David Spies <dnspies@gmail.com>
parents:
diff
changeset
|
188 return my_idx; |
2e0613dadfee
All calls to "find" use the same generic implementation (bug #42408, 42421)
David Spies <dnspies@gmail.com>
parents:
diff
changeset
|
189 } |
2e0613dadfee
All calls to "find" use the same generic implementation (bug #42408, 42421)
David Spies <dnspies@gmail.com>
parents:
diff
changeset
|
190 T |
2e0613dadfee
All calls to "find" use the same generic implementation (bug #42408, 42421)
David Spies <dnspies@gmail.com>
parents:
diff
changeset
|
191 data (void) const |
2e0613dadfee
All calls to "find" use the same generic implementation (bug #42408, 42421)
David Spies <dnspies@gmail.com>
parents:
diff
changeset
|
192 { |
2e0613dadfee
All calls to "find" use the same generic implementation (bug #42408, 42421)
David Spies <dnspies@gmail.com>
parents:
diff
changeset
|
193 return mat.elem (my_idx); |
2e0613dadfee
All calls to "find" use the same generic implementation (bug #42408, 42421)
David Spies <dnspies@gmail.com>
parents:
diff
changeset
|
194 } |
2e0613dadfee
All calls to "find" use the same generic implementation (bug #42408, 42421)
David Spies <dnspies@gmail.com>
parents:
diff
changeset
|
195 |
2e0613dadfee
All calls to "find" use the same generic implementation (bug #42408, 42421)
David Spies <dnspies@gmail.com>
parents:
diff
changeset
|
196 template<direction dir> |
2e0613dadfee
All calls to "find" use the same generic implementation (bug #42408, 42421)
David Spies <dnspies@gmail.com>
parents:
diff
changeset
|
197 void |
2e0613dadfee
All calls to "find" use the same generic implementation (bug #42408, 42421)
David Spies <dnspies@gmail.com>
parents:
diff
changeset
|
198 step (dir_handler<dir> dirc) |
2e0613dadfee
All calls to "find" use the same generic implementation (bug #42408, 42421)
David Spies <dnspies@gmail.com>
parents:
diff
changeset
|
199 { |
2e0613dadfee
All calls to "find" use the same generic implementation (bug #42408, 42421)
David Spies <dnspies@gmail.com>
parents:
diff
changeset
|
200 step_once (dirc); |
2e0613dadfee
All calls to "find" use the same generic implementation (bug #42408, 42421)
David Spies <dnspies@gmail.com>
parents:
diff
changeset
|
201 move_to_nz (dirc); |
2e0613dadfee
All calls to "find" use the same generic implementation (bug #42408, 42421)
David Spies <dnspies@gmail.com>
parents:
diff
changeset
|
202 } |
2e0613dadfee
All calls to "find" use the same generic implementation (bug #42408, 42421)
David Spies <dnspies@gmail.com>
parents:
diff
changeset
|
203 template<direction dir> |
2e0613dadfee
All calls to "find" use the same generic implementation (bug #42408, 42421)
David Spies <dnspies@gmail.com>
parents:
diff
changeset
|
204 bool |
2e0613dadfee
All calls to "find" use the same generic implementation (bug #42408, 42421)
David Spies <dnspies@gmail.com>
parents:
diff
changeset
|
205 finished (dir_handler<dir> dirc) const |
2e0613dadfee
All calls to "find" use the same generic implementation (bug #42408, 42421)
David Spies <dnspies@gmail.com>
parents:
diff
changeset
|
206 { |
2e0613dadfee
All calls to "find" use the same generic implementation (bug #42408, 42421)
David Spies <dnspies@gmail.com>
parents:
diff
changeset
|
207 return dirc.is_ended (my_idx, numels); |
2e0613dadfee
All calls to "find" use the same generic implementation (bug #42408, 42421)
David Spies <dnspies@gmail.com>
parents:
diff
changeset
|
208 } |
2e0613dadfee
All calls to "find" use the same generic implementation (bug #42408, 42421)
David Spies <dnspies@gmail.com>
parents:
diff
changeset
|
209 }; |
2e0613dadfee
All calls to "find" use the same generic implementation (bug #42408, 42421)
David Spies <dnspies@gmail.com>
parents:
diff
changeset
|
210 |
2e0613dadfee
All calls to "find" use the same generic implementation (bug #42408, 42421)
David Spies <dnspies@gmail.com>
parents:
diff
changeset
|
211 template<typename T> |
2e0613dadfee
All calls to "find" use the same generic implementation (bug #42408, 42421)
David Spies <dnspies@gmail.com>
parents:
diff
changeset
|
212 class sparse_iterator |
2e0613dadfee
All calls to "find" use the same generic implementation (bug #42408, 42421)
David Spies <dnspies@gmail.com>
parents:
diff
changeset
|
213 { |
2e0613dadfee
All calls to "find" use the same generic implementation (bug #42408, 42421)
David Spies <dnspies@gmail.com>
parents:
diff
changeset
|
214 private: |
2e0613dadfee
All calls to "find" use the same generic implementation (bug #42408, 42421)
David Spies <dnspies@gmail.com>
parents:
diff
changeset
|
215 const Sparse<T>& mat; |
2e0613dadfee
All calls to "find" use the same generic implementation (bug #42408, 42421)
David Spies <dnspies@gmail.com>
parents:
diff
changeset
|
216 octave_idx_type coli; |
2e0613dadfee
All calls to "find" use the same generic implementation (bug #42408, 42421)
David Spies <dnspies@gmail.com>
parents:
diff
changeset
|
217 octave_idx_type my_idx; |
2e0613dadfee
All calls to "find" use the same generic implementation (bug #42408, 42421)
David Spies <dnspies@gmail.com>
parents:
diff
changeset
|
218 |
2e0613dadfee
All calls to "find" use the same generic implementation (bug #42408, 42421)
David Spies <dnspies@gmail.com>
parents:
diff
changeset
|
219 template<direction dir> |
2e0613dadfee
All calls to "find" use the same generic implementation (bug #42408, 42421)
David Spies <dnspies@gmail.com>
parents:
diff
changeset
|
220 void |
2e0613dadfee
All calls to "find" use the same generic implementation (bug #42408, 42421)
David Spies <dnspies@gmail.com>
parents:
diff
changeset
|
221 adjust_col (dir_handler<dir> dirc) |
2e0613dadfee
All calls to "find" use the same generic implementation (bug #42408, 42421)
David Spies <dnspies@gmail.com>
parents:
diff
changeset
|
222 { |
2e0613dadfee
All calls to "find" use the same generic implementation (bug #42408, 42421)
David Spies <dnspies@gmail.com>
parents:
diff
changeset
|
223 while (!finished (dirc) |
2e0613dadfee
All calls to "find" use the same generic implementation (bug #42408, 42421)
David Spies <dnspies@gmail.com>
parents:
diff
changeset
|
224 && dirc.is_ended (my_idx, mat.cidx (coli), mat.cidx (coli + 1))) |
2e0613dadfee
All calls to "find" use the same generic implementation (bug #42408, 42421)
David Spies <dnspies@gmail.com>
parents:
diff
changeset
|
225 coli += dir; |
2e0613dadfee
All calls to "find" use the same generic implementation (bug #42408, 42421)
David Spies <dnspies@gmail.com>
parents:
diff
changeset
|
226 } |
2e0613dadfee
All calls to "find" use the same generic implementation (bug #42408, 42421)
David Spies <dnspies@gmail.com>
parents:
diff
changeset
|
227 |
2e0613dadfee
All calls to "find" use the same generic implementation (bug #42408, 42421)
David Spies <dnspies@gmail.com>
parents:
diff
changeset
|
228 public: |
2e0613dadfee
All calls to "find" use the same generic implementation (bug #42408, 42421)
David Spies <dnspies@gmail.com>
parents:
diff
changeset
|
229 sparse_iterator (const Sparse<T>& arg_mat) : |
2e0613dadfee
All calls to "find" use the same generic implementation (bug #42408, 42421)
David Spies <dnspies@gmail.com>
parents:
diff
changeset
|
230 mat (arg_mat) |
2e0613dadfee
All calls to "find" use the same generic implementation (bug #42408, 42421)
David Spies <dnspies@gmail.com>
parents:
diff
changeset
|
231 { |
2e0613dadfee
All calls to "find" use the same generic implementation (bug #42408, 42421)
David Spies <dnspies@gmail.com>
parents:
diff
changeset
|
232 dir_handler<FORWARD> dirc; |
2e0613dadfee
All calls to "find" use the same generic implementation (bug #42408, 42421)
David Spies <dnspies@gmail.com>
parents:
diff
changeset
|
233 begin (dirc); |
2e0613dadfee
All calls to "find" use the same generic implementation (bug #42408, 42421)
David Spies <dnspies@gmail.com>
parents:
diff
changeset
|
234 } |
2e0613dadfee
All calls to "find" use the same generic implementation (bug #42408, 42421)
David Spies <dnspies@gmail.com>
parents:
diff
changeset
|
235 |
2e0613dadfee
All calls to "find" use the same generic implementation (bug #42408, 42421)
David Spies <dnspies@gmail.com>
parents:
diff
changeset
|
236 template<direction dir> |
2e0613dadfee
All calls to "find" use the same generic implementation (bug #42408, 42421)
David Spies <dnspies@gmail.com>
parents:
diff
changeset
|
237 void |
2e0613dadfee
All calls to "find" use the same generic implementation (bug #42408, 42421)
David Spies <dnspies@gmail.com>
parents:
diff
changeset
|
238 begin (dir_handler<dir> dirc) |
2e0613dadfee
All calls to "find" use the same generic implementation (bug #42408, 42421)
David Spies <dnspies@gmail.com>
parents:
diff
changeset
|
239 { |
2e0613dadfee
All calls to "find" use the same generic implementation (bug #42408, 42421)
David Spies <dnspies@gmail.com>
parents:
diff
changeset
|
240 coli = dirc.begin (mat.cols ()); |
2e0613dadfee
All calls to "find" use the same generic implementation (bug #42408, 42421)
David Spies <dnspies@gmail.com>
parents:
diff
changeset
|
241 my_idx = dirc.begin (mat.nnz ()); |
2e0613dadfee
All calls to "find" use the same generic implementation (bug #42408, 42421)
David Spies <dnspies@gmail.com>
parents:
diff
changeset
|
242 adjust_col (dirc); |
2e0613dadfee
All calls to "find" use the same generic implementation (bug #42408, 42421)
David Spies <dnspies@gmail.com>
parents:
diff
changeset
|
243 } |
2e0613dadfee
All calls to "find" use the same generic implementation (bug #42408, 42421)
David Spies <dnspies@gmail.com>
parents:
diff
changeset
|
244 |
2e0613dadfee
All calls to "find" use the same generic implementation (bug #42408, 42421)
David Spies <dnspies@gmail.com>
parents:
diff
changeset
|
245 double |
2e0613dadfee
All calls to "find" use the same generic implementation (bug #42408, 42421)
David Spies <dnspies@gmail.com>
parents:
diff
changeset
|
246 interp_idx (void) const |
2e0613dadfee
All calls to "find" use the same generic implementation (bug #42408, 42421)
David Spies <dnspies@gmail.com>
parents:
diff
changeset
|
247 { |
2e0613dadfee
All calls to "find" use the same generic implementation (bug #42408, 42421)
David Spies <dnspies@gmail.com>
parents:
diff
changeset
|
248 return to_interp_idx (row (), col (), mat.rows ()); |
2e0613dadfee
All calls to "find" use the same generic implementation (bug #42408, 42421)
David Spies <dnspies@gmail.com>
parents:
diff
changeset
|
249 } |
2e0613dadfee
All calls to "find" use the same generic implementation (bug #42408, 42421)
David Spies <dnspies@gmail.com>
parents:
diff
changeset
|
250 octave_idx_type |
2e0613dadfee
All calls to "find" use the same generic implementation (bug #42408, 42421)
David Spies <dnspies@gmail.com>
parents:
diff
changeset
|
251 col (void) const |
2e0613dadfee
All calls to "find" use the same generic implementation (bug #42408, 42421)
David Spies <dnspies@gmail.com>
parents:
diff
changeset
|
252 { |
2e0613dadfee
All calls to "find" use the same generic implementation (bug #42408, 42421)
David Spies <dnspies@gmail.com>
parents:
diff
changeset
|
253 return coli; |
2e0613dadfee
All calls to "find" use the same generic implementation (bug #42408, 42421)
David Spies <dnspies@gmail.com>
parents:
diff
changeset
|
254 } |
2e0613dadfee
All calls to "find" use the same generic implementation (bug #42408, 42421)
David Spies <dnspies@gmail.com>
parents:
diff
changeset
|
255 octave_idx_type |
2e0613dadfee
All calls to "find" use the same generic implementation (bug #42408, 42421)
David Spies <dnspies@gmail.com>
parents:
diff
changeset
|
256 row (void) const |
2e0613dadfee
All calls to "find" use the same generic implementation (bug #42408, 42421)
David Spies <dnspies@gmail.com>
parents:
diff
changeset
|
257 { |
2e0613dadfee
All calls to "find" use the same generic implementation (bug #42408, 42421)
David Spies <dnspies@gmail.com>
parents:
diff
changeset
|
258 return mat.ridx (my_idx); |
2e0613dadfee
All calls to "find" use the same generic implementation (bug #42408, 42421)
David Spies <dnspies@gmail.com>
parents:
diff
changeset
|
259 } |
2e0613dadfee
All calls to "find" use the same generic implementation (bug #42408, 42421)
David Spies <dnspies@gmail.com>
parents:
diff
changeset
|
260 T |
2e0613dadfee
All calls to "find" use the same generic implementation (bug #42408, 42421)
David Spies <dnspies@gmail.com>
parents:
diff
changeset
|
261 data (void) const |
2e0613dadfee
All calls to "find" use the same generic implementation (bug #42408, 42421)
David Spies <dnspies@gmail.com>
parents:
diff
changeset
|
262 { |
2e0613dadfee
All calls to "find" use the same generic implementation (bug #42408, 42421)
David Spies <dnspies@gmail.com>
parents:
diff
changeset
|
263 return mat.data (my_idx); |
2e0613dadfee
All calls to "find" use the same generic implementation (bug #42408, 42421)
David Spies <dnspies@gmail.com>
parents:
diff
changeset
|
264 } |
2e0613dadfee
All calls to "find" use the same generic implementation (bug #42408, 42421)
David Spies <dnspies@gmail.com>
parents:
diff
changeset
|
265 template<direction dir> |
2e0613dadfee
All calls to "find" use the same generic implementation (bug #42408, 42421)
David Spies <dnspies@gmail.com>
parents:
diff
changeset
|
266 void |
2e0613dadfee
All calls to "find" use the same generic implementation (bug #42408, 42421)
David Spies <dnspies@gmail.com>
parents:
diff
changeset
|
267 step (dir_handler<dir> dirc) |
2e0613dadfee
All calls to "find" use the same generic implementation (bug #42408, 42421)
David Spies <dnspies@gmail.com>
parents:
diff
changeset
|
268 { |
2e0613dadfee
All calls to "find" use the same generic implementation (bug #42408, 42421)
David Spies <dnspies@gmail.com>
parents:
diff
changeset
|
269 my_idx += dir; |
2e0613dadfee
All calls to "find" use the same generic implementation (bug #42408, 42421)
David Spies <dnspies@gmail.com>
parents:
diff
changeset
|
270 adjust_col (dirc); |
2e0613dadfee
All calls to "find" use the same generic implementation (bug #42408, 42421)
David Spies <dnspies@gmail.com>
parents:
diff
changeset
|
271 } |
2e0613dadfee
All calls to "find" use the same generic implementation (bug #42408, 42421)
David Spies <dnspies@gmail.com>
parents:
diff
changeset
|
272 template<direction dir> |
2e0613dadfee
All calls to "find" use the same generic implementation (bug #42408, 42421)
David Spies <dnspies@gmail.com>
parents:
diff
changeset
|
273 bool |
2e0613dadfee
All calls to "find" use the same generic implementation (bug #42408, 42421)
David Spies <dnspies@gmail.com>
parents:
diff
changeset
|
274 finished (dir_handler<dir> dirc) const |
2e0613dadfee
All calls to "find" use the same generic implementation (bug #42408, 42421)
David Spies <dnspies@gmail.com>
parents:
diff
changeset
|
275 { |
2e0613dadfee
All calls to "find" use the same generic implementation (bug #42408, 42421)
David Spies <dnspies@gmail.com>
parents:
diff
changeset
|
276 return dirc.is_ended (coli, mat.cols ()); |
2e0613dadfee
All calls to "find" use the same generic implementation (bug #42408, 42421)
David Spies <dnspies@gmail.com>
parents:
diff
changeset
|
277 } |
2e0613dadfee
All calls to "find" use the same generic implementation (bug #42408, 42421)
David Spies <dnspies@gmail.com>
parents:
diff
changeset
|
278 }; |
2e0613dadfee
All calls to "find" use the same generic implementation (bug #42408, 42421)
David Spies <dnspies@gmail.com>
parents:
diff
changeset
|
279 |
2e0613dadfee
All calls to "find" use the same generic implementation (bug #42408, 42421)
David Spies <dnspies@gmail.com>
parents:
diff
changeset
|
280 template<typename T> |
2e0613dadfee
All calls to "find" use the same generic implementation (bug #42408, 42421)
David Spies <dnspies@gmail.com>
parents:
diff
changeset
|
281 class diag_iterator |
2e0613dadfee
All calls to "find" use the same generic implementation (bug #42408, 42421)
David Spies <dnspies@gmail.com>
parents:
diff
changeset
|
282 { |
2e0613dadfee
All calls to "find" use the same generic implementation (bug #42408, 42421)
David Spies <dnspies@gmail.com>
parents:
diff
changeset
|
283 private: |
2e0613dadfee
All calls to "find" use the same generic implementation (bug #42408, 42421)
David Spies <dnspies@gmail.com>
parents:
diff
changeset
|
284 const DiagArray2<T>& mat; |
2e0613dadfee
All calls to "find" use the same generic implementation (bug #42408, 42421)
David Spies <dnspies@gmail.com>
parents:
diff
changeset
|
285 octave_idx_type my_idx; |
2e0613dadfee
All calls to "find" use the same generic implementation (bug #42408, 42421)
David Spies <dnspies@gmail.com>
parents:
diff
changeset
|
286 |
2e0613dadfee
All calls to "find" use the same generic implementation (bug #42408, 42421)
David Spies <dnspies@gmail.com>
parents:
diff
changeset
|
287 template <direction dir> |
2e0613dadfee
All calls to "find" use the same generic implementation (bug #42408, 42421)
David Spies <dnspies@gmail.com>
parents:
diff
changeset
|
288 void |
2e0613dadfee
All calls to "find" use the same generic implementation (bug #42408, 42421)
David Spies <dnspies@gmail.com>
parents:
diff
changeset
|
289 move_to_nz (dir_handler<dir> dirc) |
2e0613dadfee
All calls to "find" use the same generic implementation (bug #42408, 42421)
David Spies <dnspies@gmail.com>
parents:
diff
changeset
|
290 { |
2e0613dadfee
All calls to "find" use the same generic implementation (bug #42408, 42421)
David Spies <dnspies@gmail.com>
parents:
diff
changeset
|
291 while (!finished (dirc) && is_zero (data ())) |
2e0613dadfee
All calls to "find" use the same generic implementation (bug #42408, 42421)
David Spies <dnspies@gmail.com>
parents:
diff
changeset
|
292 { |
2e0613dadfee
All calls to "find" use the same generic implementation (bug #42408, 42421)
David Spies <dnspies@gmail.com>
parents:
diff
changeset
|
293 my_idx += dir; |
2e0613dadfee
All calls to "find" use the same generic implementation (bug #42408, 42421)
David Spies <dnspies@gmail.com>
parents:
diff
changeset
|
294 } |
2e0613dadfee
All calls to "find" use the same generic implementation (bug #42408, 42421)
David Spies <dnspies@gmail.com>
parents:
diff
changeset
|
295 } |
2e0613dadfee
All calls to "find" use the same generic implementation (bug #42408, 42421)
David Spies <dnspies@gmail.com>
parents:
diff
changeset
|
296 |
2e0613dadfee
All calls to "find" use the same generic implementation (bug #42408, 42421)
David Spies <dnspies@gmail.com>
parents:
diff
changeset
|
297 public: |
2e0613dadfee
All calls to "find" use the same generic implementation (bug #42408, 42421)
David Spies <dnspies@gmail.com>
parents:
diff
changeset
|
298 diag_iterator (const DiagArray2<T>& arg_mat) : |
2e0613dadfee
All calls to "find" use the same generic implementation (bug #42408, 42421)
David Spies <dnspies@gmail.com>
parents:
diff
changeset
|
299 mat (arg_mat) |
2e0613dadfee
All calls to "find" use the same generic implementation (bug #42408, 42421)
David Spies <dnspies@gmail.com>
parents:
diff
changeset
|
300 { |
2e0613dadfee
All calls to "find" use the same generic implementation (bug #42408, 42421)
David Spies <dnspies@gmail.com>
parents:
diff
changeset
|
301 dir_handler<FORWARD> dirc; |
2e0613dadfee
All calls to "find" use the same generic implementation (bug #42408, 42421)
David Spies <dnspies@gmail.com>
parents:
diff
changeset
|
302 begin (dirc); |
2e0613dadfee
All calls to "find" use the same generic implementation (bug #42408, 42421)
David Spies <dnspies@gmail.com>
parents:
diff
changeset
|
303 } |
2e0613dadfee
All calls to "find" use the same generic implementation (bug #42408, 42421)
David Spies <dnspies@gmail.com>
parents:
diff
changeset
|
304 |
2e0613dadfee
All calls to "find" use the same generic implementation (bug #42408, 42421)
David Spies <dnspies@gmail.com>
parents:
diff
changeset
|
305 template<direction dir> |
2e0613dadfee
All calls to "find" use the same generic implementation (bug #42408, 42421)
David Spies <dnspies@gmail.com>
parents:
diff
changeset
|
306 void |
2e0613dadfee
All calls to "find" use the same generic implementation (bug #42408, 42421)
David Spies <dnspies@gmail.com>
parents:
diff
changeset
|
307 begin (dir_handler<dir> dirc) |
2e0613dadfee
All calls to "find" use the same generic implementation (bug #42408, 42421)
David Spies <dnspies@gmail.com>
parents:
diff
changeset
|
308 { |
2e0613dadfee
All calls to "find" use the same generic implementation (bug #42408, 42421)
David Spies <dnspies@gmail.com>
parents:
diff
changeset
|
309 my_idx = dirc.begin (mat.diag_length ()); |
2e0613dadfee
All calls to "find" use the same generic implementation (bug #42408, 42421)
David Spies <dnspies@gmail.com>
parents:
diff
changeset
|
310 move_to_nz (dirc); |
2e0613dadfee
All calls to "find" use the same generic implementation (bug #42408, 42421)
David Spies <dnspies@gmail.com>
parents:
diff
changeset
|
311 } |
2e0613dadfee
All calls to "find" use the same generic implementation (bug #42408, 42421)
David Spies <dnspies@gmail.com>
parents:
diff
changeset
|
312 |
2e0613dadfee
All calls to "find" use the same generic implementation (bug #42408, 42421)
David Spies <dnspies@gmail.com>
parents:
diff
changeset
|
313 double |
2e0613dadfee
All calls to "find" use the same generic implementation (bug #42408, 42421)
David Spies <dnspies@gmail.com>
parents:
diff
changeset
|
314 interp_idx (void) const |
2e0613dadfee
All calls to "find" use the same generic implementation (bug #42408, 42421)
David Spies <dnspies@gmail.com>
parents:
diff
changeset
|
315 { |
2e0613dadfee
All calls to "find" use the same generic implementation (bug #42408, 42421)
David Spies <dnspies@gmail.com>
parents:
diff
changeset
|
316 return to_interp_idx (row (), col (), mat.rows ()); |
2e0613dadfee
All calls to "find" use the same generic implementation (bug #42408, 42421)
David Spies <dnspies@gmail.com>
parents:
diff
changeset
|
317 } |
2e0613dadfee
All calls to "find" use the same generic implementation (bug #42408, 42421)
David Spies <dnspies@gmail.com>
parents:
diff
changeset
|
318 octave_idx_type |
2e0613dadfee
All calls to "find" use the same generic implementation (bug #42408, 42421)
David Spies <dnspies@gmail.com>
parents:
diff
changeset
|
319 col (void) const |
2e0613dadfee
All calls to "find" use the same generic implementation (bug #42408, 42421)
David Spies <dnspies@gmail.com>
parents:
diff
changeset
|
320 { |
2e0613dadfee
All calls to "find" use the same generic implementation (bug #42408, 42421)
David Spies <dnspies@gmail.com>
parents:
diff
changeset
|
321 return my_idx; |
2e0613dadfee
All calls to "find" use the same generic implementation (bug #42408, 42421)
David Spies <dnspies@gmail.com>
parents:
diff
changeset
|
322 } |
2e0613dadfee
All calls to "find" use the same generic implementation (bug #42408, 42421)
David Spies <dnspies@gmail.com>
parents:
diff
changeset
|
323 octave_idx_type |
2e0613dadfee
All calls to "find" use the same generic implementation (bug #42408, 42421)
David Spies <dnspies@gmail.com>
parents:
diff
changeset
|
324 row (void) const |
2e0613dadfee
All calls to "find" use the same generic implementation (bug #42408, 42421)
David Spies <dnspies@gmail.com>
parents:
diff
changeset
|
325 { |
2e0613dadfee
All calls to "find" use the same generic implementation (bug #42408, 42421)
David Spies <dnspies@gmail.com>
parents:
diff
changeset
|
326 return my_idx; |
2e0613dadfee
All calls to "find" use the same generic implementation (bug #42408, 42421)
David Spies <dnspies@gmail.com>
parents:
diff
changeset
|
327 } |
2e0613dadfee
All calls to "find" use the same generic implementation (bug #42408, 42421)
David Spies <dnspies@gmail.com>
parents:
diff
changeset
|
328 T |
2e0613dadfee
All calls to "find" use the same generic implementation (bug #42408, 42421)
David Spies <dnspies@gmail.com>
parents:
diff
changeset
|
329 data (void) const |
2e0613dadfee
All calls to "find" use the same generic implementation (bug #42408, 42421)
David Spies <dnspies@gmail.com>
parents:
diff
changeset
|
330 { |
2e0613dadfee
All calls to "find" use the same generic implementation (bug #42408, 42421)
David Spies <dnspies@gmail.com>
parents:
diff
changeset
|
331 return mat.dgelem (my_idx); |
2e0613dadfee
All calls to "find" use the same generic implementation (bug #42408, 42421)
David Spies <dnspies@gmail.com>
parents:
diff
changeset
|
332 } |
2e0613dadfee
All calls to "find" use the same generic implementation (bug #42408, 42421)
David Spies <dnspies@gmail.com>
parents:
diff
changeset
|
333 template<direction dir> |
2e0613dadfee
All calls to "find" use the same generic implementation (bug #42408, 42421)
David Spies <dnspies@gmail.com>
parents:
diff
changeset
|
334 void |
2e0613dadfee
All calls to "find" use the same generic implementation (bug #42408, 42421)
David Spies <dnspies@gmail.com>
parents:
diff
changeset
|
335 step (dir_handler<dir> dirc) |
2e0613dadfee
All calls to "find" use the same generic implementation (bug #42408, 42421)
David Spies <dnspies@gmail.com>
parents:
diff
changeset
|
336 { |
2e0613dadfee
All calls to "find" use the same generic implementation (bug #42408, 42421)
David Spies <dnspies@gmail.com>
parents:
diff
changeset
|
337 my_idx += dir; |
2e0613dadfee
All calls to "find" use the same generic implementation (bug #42408, 42421)
David Spies <dnspies@gmail.com>
parents:
diff
changeset
|
338 move_to_nz (dirc); |
2e0613dadfee
All calls to "find" use the same generic implementation (bug #42408, 42421)
David Spies <dnspies@gmail.com>
parents:
diff
changeset
|
339 } |
2e0613dadfee
All calls to "find" use the same generic implementation (bug #42408, 42421)
David Spies <dnspies@gmail.com>
parents:
diff
changeset
|
340 template<direction dir> |
2e0613dadfee
All calls to "find" use the same generic implementation (bug #42408, 42421)
David Spies <dnspies@gmail.com>
parents:
diff
changeset
|
341 bool |
2e0613dadfee
All calls to "find" use the same generic implementation (bug #42408, 42421)
David Spies <dnspies@gmail.com>
parents:
diff
changeset
|
342 finished (dir_handler<dir> dirc) const |
2e0613dadfee
All calls to "find" use the same generic implementation (bug #42408, 42421)
David Spies <dnspies@gmail.com>
parents:
diff
changeset
|
343 { |
2e0613dadfee
All calls to "find" use the same generic implementation (bug #42408, 42421)
David Spies <dnspies@gmail.com>
parents:
diff
changeset
|
344 return dirc.is_ended (my_idx, mat.diag_length ()); |
2e0613dadfee
All calls to "find" use the same generic implementation (bug #42408, 42421)
David Spies <dnspies@gmail.com>
parents:
diff
changeset
|
345 } |
2e0613dadfee
All calls to "find" use the same generic implementation (bug #42408, 42421)
David Spies <dnspies@gmail.com>
parents:
diff
changeset
|
346 }; |
2e0613dadfee
All calls to "find" use the same generic implementation (bug #42408, 42421)
David Spies <dnspies@gmail.com>
parents:
diff
changeset
|
347 |
2e0613dadfee
All calls to "find" use the same generic implementation (bug #42408, 42421)
David Spies <dnspies@gmail.com>
parents:
diff
changeset
|
348 class perm_iterator |
2e0613dadfee
All calls to "find" use the same generic implementation (bug #42408, 42421)
David Spies <dnspies@gmail.com>
parents:
diff
changeset
|
349 { |
2e0613dadfee
All calls to "find" use the same generic implementation (bug #42408, 42421)
David Spies <dnspies@gmail.com>
parents:
diff
changeset
|
350 private: |
2e0613dadfee
All calls to "find" use the same generic implementation (bug #42408, 42421)
David Spies <dnspies@gmail.com>
parents:
diff
changeset
|
351 const PermMatrix& mat; |
2e0613dadfee
All calls to "find" use the same generic implementation (bug #42408, 42421)
David Spies <dnspies@gmail.com>
parents:
diff
changeset
|
352 octave_idx_type my_idx; |
2e0613dadfee
All calls to "find" use the same generic implementation (bug #42408, 42421)
David Spies <dnspies@gmail.com>
parents:
diff
changeset
|
353 |
2e0613dadfee
All calls to "find" use the same generic implementation (bug #42408, 42421)
David Spies <dnspies@gmail.com>
parents:
diff
changeset
|
354 public: |
2e0613dadfee
All calls to "find" use the same generic implementation (bug #42408, 42421)
David Spies <dnspies@gmail.com>
parents:
diff
changeset
|
355 perm_iterator (const PermMatrix& arg_mat) : |
2e0613dadfee
All calls to "find" use the same generic implementation (bug #42408, 42421)
David Spies <dnspies@gmail.com>
parents:
diff
changeset
|
356 mat (arg_mat) |
2e0613dadfee
All calls to "find" use the same generic implementation (bug #42408, 42421)
David Spies <dnspies@gmail.com>
parents:
diff
changeset
|
357 { |
2e0613dadfee
All calls to "find" use the same generic implementation (bug #42408, 42421)
David Spies <dnspies@gmail.com>
parents:
diff
changeset
|
358 dir_handler<FORWARD> dirc; |
2e0613dadfee
All calls to "find" use the same generic implementation (bug #42408, 42421)
David Spies <dnspies@gmail.com>
parents:
diff
changeset
|
359 begin (dirc); |
2e0613dadfee
All calls to "find" use the same generic implementation (bug #42408, 42421)
David Spies <dnspies@gmail.com>
parents:
diff
changeset
|
360 } |
2e0613dadfee
All calls to "find" use the same generic implementation (bug #42408, 42421)
David Spies <dnspies@gmail.com>
parents:
diff
changeset
|
361 |
2e0613dadfee
All calls to "find" use the same generic implementation (bug #42408, 42421)
David Spies <dnspies@gmail.com>
parents:
diff
changeset
|
362 template<direction dir> |
2e0613dadfee
All calls to "find" use the same generic implementation (bug #42408, 42421)
David Spies <dnspies@gmail.com>
parents:
diff
changeset
|
363 void |
2e0613dadfee
All calls to "find" use the same generic implementation (bug #42408, 42421)
David Spies <dnspies@gmail.com>
parents:
diff
changeset
|
364 begin (dir_handler<dir> dirc) |
2e0613dadfee
All calls to "find" use the same generic implementation (bug #42408, 42421)
David Spies <dnspies@gmail.com>
parents:
diff
changeset
|
365 { |
2e0613dadfee
All calls to "find" use the same generic implementation (bug #42408, 42421)
David Spies <dnspies@gmail.com>
parents:
diff
changeset
|
366 my_idx = dirc.begin (mat.cols ()); |
2e0613dadfee
All calls to "find" use the same generic implementation (bug #42408, 42421)
David Spies <dnspies@gmail.com>
parents:
diff
changeset
|
367 } |
2e0613dadfee
All calls to "find" use the same generic implementation (bug #42408, 42421)
David Spies <dnspies@gmail.com>
parents:
diff
changeset
|
368 |
2e0613dadfee
All calls to "find" use the same generic implementation (bug #42408, 42421)
David Spies <dnspies@gmail.com>
parents:
diff
changeset
|
369 octave_idx_type |
2e0613dadfee
All calls to "find" use the same generic implementation (bug #42408, 42421)
David Spies <dnspies@gmail.com>
parents:
diff
changeset
|
370 interp_idx (void) const |
2e0613dadfee
All calls to "find" use the same generic implementation (bug #42408, 42421)
David Spies <dnspies@gmail.com>
parents:
diff
changeset
|
371 { |
2e0613dadfee
All calls to "find" use the same generic implementation (bug #42408, 42421)
David Spies <dnspies@gmail.com>
parents:
diff
changeset
|
372 return to_interp_idx (row (), col (), mat.rows ()); |
2e0613dadfee
All calls to "find" use the same generic implementation (bug #42408, 42421)
David Spies <dnspies@gmail.com>
parents:
diff
changeset
|
373 } |
2e0613dadfee
All calls to "find" use the same generic implementation (bug #42408, 42421)
David Spies <dnspies@gmail.com>
parents:
diff
changeset
|
374 octave_idx_type |
2e0613dadfee
All calls to "find" use the same generic implementation (bug #42408, 42421)
David Spies <dnspies@gmail.com>
parents:
diff
changeset
|
375 col (void) const |
2e0613dadfee
All calls to "find" use the same generic implementation (bug #42408, 42421)
David Spies <dnspies@gmail.com>
parents:
diff
changeset
|
376 { |
2e0613dadfee
All calls to "find" use the same generic implementation (bug #42408, 42421)
David Spies <dnspies@gmail.com>
parents:
diff
changeset
|
377 return my_idx; |
2e0613dadfee
All calls to "find" use the same generic implementation (bug #42408, 42421)
David Spies <dnspies@gmail.com>
parents:
diff
changeset
|
378 } |
2e0613dadfee
All calls to "find" use the same generic implementation (bug #42408, 42421)
David Spies <dnspies@gmail.com>
parents:
diff
changeset
|
379 octave_idx_type |
2e0613dadfee
All calls to "find" use the same generic implementation (bug #42408, 42421)
David Spies <dnspies@gmail.com>
parents:
diff
changeset
|
380 row (void) const |
2e0613dadfee
All calls to "find" use the same generic implementation (bug #42408, 42421)
David Spies <dnspies@gmail.com>
parents:
diff
changeset
|
381 { |
2e0613dadfee
All calls to "find" use the same generic implementation (bug #42408, 42421)
David Spies <dnspies@gmail.com>
parents:
diff
changeset
|
382 return mat.perm_elem (my_idx); |
2e0613dadfee
All calls to "find" use the same generic implementation (bug #42408, 42421)
David Spies <dnspies@gmail.com>
parents:
diff
changeset
|
383 } |
2e0613dadfee
All calls to "find" use the same generic implementation (bug #42408, 42421)
David Spies <dnspies@gmail.com>
parents:
diff
changeset
|
384 bool |
2e0613dadfee
All calls to "find" use the same generic implementation (bug #42408, 42421)
David Spies <dnspies@gmail.com>
parents:
diff
changeset
|
385 data (void) const |
2e0613dadfee
All calls to "find" use the same generic implementation (bug #42408, 42421)
David Spies <dnspies@gmail.com>
parents:
diff
changeset
|
386 { |
2e0613dadfee
All calls to "find" use the same generic implementation (bug #42408, 42421)
David Spies <dnspies@gmail.com>
parents:
diff
changeset
|
387 return true; |
2e0613dadfee
All calls to "find" use the same generic implementation (bug #42408, 42421)
David Spies <dnspies@gmail.com>
parents:
diff
changeset
|
388 } |
2e0613dadfee
All calls to "find" use the same generic implementation (bug #42408, 42421)
David Spies <dnspies@gmail.com>
parents:
diff
changeset
|
389 template<direction dir> |
2e0613dadfee
All calls to "find" use the same generic implementation (bug #42408, 42421)
David Spies <dnspies@gmail.com>
parents:
diff
changeset
|
390 void |
2e0613dadfee
All calls to "find" use the same generic implementation (bug #42408, 42421)
David Spies <dnspies@gmail.com>
parents:
diff
changeset
|
391 step (dir_handler<dir>) |
2e0613dadfee
All calls to "find" use the same generic implementation (bug #42408, 42421)
David Spies <dnspies@gmail.com>
parents:
diff
changeset
|
392 { |
2e0613dadfee
All calls to "find" use the same generic implementation (bug #42408, 42421)
David Spies <dnspies@gmail.com>
parents:
diff
changeset
|
393 my_idx += dir; |
2e0613dadfee
All calls to "find" use the same generic implementation (bug #42408, 42421)
David Spies <dnspies@gmail.com>
parents:
diff
changeset
|
394 } |
2e0613dadfee
All calls to "find" use the same generic implementation (bug #42408, 42421)
David Spies <dnspies@gmail.com>
parents:
diff
changeset
|
395 template<direction dir> |
2e0613dadfee
All calls to "find" use the same generic implementation (bug #42408, 42421)
David Spies <dnspies@gmail.com>
parents:
diff
changeset
|
396 bool |
2e0613dadfee
All calls to "find" use the same generic implementation (bug #42408, 42421)
David Spies <dnspies@gmail.com>
parents:
diff
changeset
|
397 finished (dir_handler<dir> dirc) const |
2e0613dadfee
All calls to "find" use the same generic implementation (bug #42408, 42421)
David Spies <dnspies@gmail.com>
parents:
diff
changeset
|
398 { |
2e0613dadfee
All calls to "find" use the same generic implementation (bug #42408, 42421)
David Spies <dnspies@gmail.com>
parents:
diff
changeset
|
399 return dirc.is_ended (my_idx, mat.rows ()); |
2e0613dadfee
All calls to "find" use the same generic implementation (bug #42408, 42421)
David Spies <dnspies@gmail.com>
parents:
diff
changeset
|
400 } |
2e0613dadfee
All calls to "find" use the same generic implementation (bug #42408, 42421)
David Spies <dnspies@gmail.com>
parents:
diff
changeset
|
401 }; |
2e0613dadfee
All calls to "find" use the same generic implementation (bug #42408, 42421)
David Spies <dnspies@gmail.com>
parents:
diff
changeset
|
402 |
2e0613dadfee
All calls to "find" use the same generic implementation (bug #42408, 42421)
David Spies <dnspies@gmail.com>
parents:
diff
changeset
|
403 #endif |