21#include <arccore/base/ArrayView.h>
22#include <arccore/collections/Array.h>
52 inline Integer
linearScan(
const T& x, ConstArrayView<T> v);
108 template <
typename T>
111 const Integer n = v.size();
112 for (Integer i = 0; i < n; ++i)
118 template <
typename T>
121 const Integer n = v.size();
123 while (index < n and v[index] < x) {
126 if (index == n or v[index] != x)
132 template <
typename T>
135 const Integer n = v.size();
139 static const Integer n_linear = 20;
144 if (x < v[0] or x > v[n - 1])
147 const Integer imid = (iright + ileft) / 2;
148 const T& vmid = v[imid];
152 else if (x >= vmid) {
155 }
while (iright - ileft > n_linear);
160 while (ileft < iright and v[ileft] < x) {
163 if (ileft >= iright or v[ileft] != x)
171 template <
typename T>
174 const Integer n = v.size();
176 while (index < n and v[index] < x) {
182 template <
typename T>
185 const Integer n = v.size();
189 static const Integer n_linear = 20;
199 const Integer imid = (iright + ileft) / 2;
200 const T& vmid = v[imid];
204 else if (x >= vmid) {
207 }
while (iright - ileft > n_linear);
212 while (ileft < iright and v[ileft] < x) {
220 template <
typename T>
227 while (vptr[index + 1] <= x)
232 template <
typename T>
239 static const Integer n_linear = 20;
243 while (iright - ileft > n_linear) {
244 const Integer imid = (iright + ileft) / 2;
245 const T& vmid = vptr[imid];
255 while (vptr[ileft + 1] <= x)
265namespace ArrayConversion
273insert(UniqueArray<Integer>& list, UniqueArray<Real>& value, Integer entry, Real eps = 0.)
279 Integer size = entry;
281 Real z = value[entry];
282 for (Integer k = 0; k < size; k++) {
283 if (z - value[list[k]] >= eps) {
288 Integer last = entry;
289 for (Integer j = i; j < size; j++) {
290 Integer tmp = list[j];
298average(ArrayView<Real> x, ArrayView<Real> coef, Integer n)
301 for (Integer i = 0; i < n; i++)
302 xx += coef[i] * x[i];
Recherche d'un �l�ment dans un tableau.
Integer linearScan(const T &x, ConstArrayView< T > v)
Integer linearPositionScan(const T &x, ConstArrayView< T > v)
Integer exhaustiveScan(const T &x, ConstArrayView< T > v)
Integer linearIntervalScan(const T &x, const Integer n, const T *vptr)
Integer dichotomicScan(const T &x, ConstArrayView< T > v)
Integer dichotomicIntervalScan(const T &x, const Integer n, const T *vptr)
Integer dichotomicPositionScan(const T &x, ConstArrayView< T > v)
-- tab-width: 2; indent-tabs-mode: nil; coding: utf-8-with-signature --