GNU Octave  8.1.0
A high-level interpreted language, primarily intended for numerical computations, mostly compatible with Matlab
dNDArray.cc
Go to the documentation of this file.
1 ////////////////////////////////////////////////////////////////////////
2 //
3 // Copyright (C) 1996-2023 The Octave Project Developers
4 //
5 // See the file COPYRIGHT.md in the top-level directory of this
6 // distribution or <https://octave.org/copyright/>.
7 //
8 // This file is part of Octave.
9 //
10 // Octave is free software: you can redistribute it and/or modify it
11 // under the terms of the GNU General Public License as published by
12 // the Free Software Foundation, either version 3 of the License, or
13 // (at your option) any later version.
14 //
15 // Octave is distributed in the hope that it will be useful, but
16 // WITHOUT ANY WARRANTY; without even the implied warranty of
17 // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
18 // GNU General Public License for more details.
19 //
20 // You should have received a copy of the GNU General Public License
21 // along with Octave; see the file COPYING. If not, see
22 // <https://www.gnu.org/licenses/>.
23 //
24 ////////////////////////////////////////////////////////////////////////
25 
26 #if defined (HAVE_CONFIG_H)
27 # include "config.h"
28 #endif
29 
30 #include <istream>
31 #include <limits>
32 #include <ostream>
33 
34 #include "Array-util.h"
35 #include "dNDArray.h"
36 #include "f77-fcn.h"
37 #include "lo-error.h"
38 #include "lo-ieee.h"
39 #include "lo-mappers.h"
40 #include "mx-base.h"
41 #include "mx-op-defs.h"
42 #include "oct-fftw.h"
43 #include "oct-locbuf.h"
44 
45 #include "bsxfun-defs.cc"
46 
47 NDArray::NDArray (const Array<octave_idx_type>& a, bool zero_based,
48  bool negative_to_nan)
49 {
50  const octave_idx_type *pa = a.data ();
51  resize (a.dims ());
52  double *ptmp = fortran_vec ();
53  if (negative_to_nan)
54  {
55  double nan_val = lo_ieee_nan_value ();
56 
57  if (zero_based)
58  for (octave_idx_type i = 0; i < a.numel (); i++)
59  {
60  double val = static_cast<double>
61  (pa[i] + static_cast<octave_idx_type> (1));
62  if (val <= 0)
63  ptmp[i] = nan_val;
64  else
65  ptmp[i] = val;
66  }
67  else
68  for (octave_idx_type i = 0; i < a.numel (); i++)
69  {
70  double val = static_cast<double> (pa[i]);
71  if (val <= 0)
72  ptmp[i] = nan_val;
73  else
74  ptmp[i] = val;
75  }
76  }
77  else
78  {
79  if (zero_based)
80  for (octave_idx_type i = 0; i < a.numel (); i++)
81  ptmp[i] = static_cast<double>
82  (pa[i] + static_cast<octave_idx_type> (1));
83  else
84  for (octave_idx_type i = 0; i < a.numel (); i++)
85  ptmp[i] = static_cast<double> (pa[i]);
86  }
87 }
88 
90  : MArray<double> (a.dims ())
91 {
92  octave_idx_type n = a.numel ();
93  for (octave_idx_type i = 0; i < n; i++)
94  xelem (i) = static_cast<unsigned char> (a(i));
95 }
96 
97 #if defined (HAVE_FFTW)
98 
100 NDArray::fourier (int dim) const
101 {
102  dim_vector dv = dims ();
103 
104  if (dim > dv.ndims () || dim < 0)
105  return ComplexNDArray ();
106 
107  octave_idx_type stride = 1;
108  octave_idx_type n = dv(dim);
109 
110  for (int i = 0; i < dim; i++)
111  stride *= dv(i);
112 
113  octave_idx_type howmany = numel () / dv(dim);
114  howmany = (stride == 1 ? howmany : (howmany > stride ? stride : howmany));
115  octave_idx_type nloop = (stride == 1 ? 1 : numel () / dv(dim) / stride);
116  octave_idx_type dist = (stride == 1 ? n : 1);
117 
118  const double *in (data ());
119  ComplexNDArray retval (dv);
120  Complex *out (retval.fortran_vec ());
121 
122  // Need to be careful here about the distance between fft's
123  for (octave_idx_type k = 0; k < nloop; k++)
124  octave::fftw::fft (in + k * stride * n, out + k * stride * n,
125  n, howmany, stride, dist);
126 
127  return retval;
128 }
129 
131 NDArray::ifourier (int dim) const
132 {
133  dim_vector dv = dims ();
134 
135  if (dim > dv.ndims () || dim < 0)
136  return ComplexNDArray ();
137 
138  octave_idx_type stride = 1;
139  octave_idx_type n = dv(dim);
140 
141  for (int i = 0; i < dim; i++)
142  stride *= dv(i);
143 
144  octave_idx_type howmany = numel () / dv(dim);
145  howmany = (stride == 1 ? howmany : (howmany > stride ? stride : howmany));
146  octave_idx_type nloop = (stride == 1 ? 1 : numel () / dv(dim) / stride);
147  octave_idx_type dist = (stride == 1 ? n : 1);
148 
149  ComplexNDArray retval (*this);
150  Complex *out (retval.fortran_vec ());
151 
152  // Need to be careful here about the distance between fft's
153  for (octave_idx_type k = 0; k < nloop; k++)
154  octave::fftw::ifft (out + k * stride * n, out + k * stride * n,
155  n, howmany, stride, dist);
156 
157  return retval;
158 }
159 
161 NDArray::fourier2d (void) const
162 {
163  dim_vector dv = dims ();
164  if (dv.ndims () < 2)
165  return ComplexNDArray ();
166 
167  dim_vector dv2 (dv(0), dv(1));
168  const double *in = data ();
169  ComplexNDArray retval (dv);
170  Complex *out = retval.fortran_vec ();
171  octave_idx_type howmany = numel () / dv(0) / dv(1);
172  octave_idx_type dist = dv(0) * dv(1);
173 
174  for (octave_idx_type i=0; i < howmany; i++)
175  octave::fftw::fftNd (in + i*dist, out + i*dist, 2, dv2);
176 
177  return retval;
178 }
179 
182 {
183  dim_vector dv = dims ();
184  if (dv.ndims () < 2)
185  return ComplexNDArray ();
186 
187  dim_vector dv2 (dv(0), dv(1));
188  ComplexNDArray retval (*this);
189  Complex *out = retval.fortran_vec ();
190  octave_idx_type howmany = numel () / dv(0) / dv(1);
191  octave_idx_type dist = dv(0) * dv(1);
192 
193  for (octave_idx_type i=0; i < howmany; i++)
194  octave::fftw::ifftNd (out + i*dist, out + i*dist, 2, dv2);
195 
196  return retval;
197 }
198 
200 NDArray::fourierNd (void) const
201 {
202  dim_vector dv = dims ();
203  int rank = dv.ndims ();
204 
205  const double *in (data ());
206  ComplexNDArray retval (dv);
207  Complex *out (retval.fortran_vec ());
208 
209  octave::fftw::fftNd (in, out, rank, dv);
210 
211  return retval;
212 }
213 
216 {
217  dim_vector dv = dims ();
218  int rank = dv.ndims ();
219 
220  ComplexNDArray tmp (*this);
221  Complex *in (tmp.fortran_vec ());
222  ComplexNDArray retval (dv);
223  Complex *out (retval.fortran_vec ());
224 
225  octave::fftw::ifftNd (in, out, rank, dv);
226 
227  return retval;
228 }
229 
230 #else
231 
233 NDArray::fourier (int dim) const
234 {
235  octave_unused_parameter (dim);
236 
237  (*current_liboctave_error_handler)
238  ("support for FFTW was unavailable or disabled when liboctave was built");
239 
240  return ComplexNDArray ();
241 }
242 
244 NDArray::ifourier (int dim) const
245 {
246  octave_unused_parameter (dim);
247 
248  (*current_liboctave_error_handler)
249  ("support for FFTW was unavailable or disabled when liboctave was built");
250 
251  return ComplexNDArray ();
252 }
253 
255 NDArray::fourier2d (void) const
256 {
257  (*current_liboctave_error_handler)
258  ("support for FFTW was unavailable or disabled when liboctave was built");
259 
260  return ComplexNDArray ();
261 }
262 
264 NDArray::ifourier2d (void) const
265 {
266  (*current_liboctave_error_handler)
267  ("support for FFTW was unavailable or disabled when liboctave was built");
268 
269  return ComplexNDArray ();
270 }
271 
273 NDArray::fourierNd (void) const
274 {
275  (*current_liboctave_error_handler)
276  ("support for FFTW was unavailable or disabled when liboctave was built");
277 
278  return ComplexNDArray ();
279 }
280 
282 NDArray::ifourierNd (void) const
283 {
284  (*current_liboctave_error_handler)
285  ("support for FFTW was unavailable or disabled when liboctave was built");
286 
287  return ComplexNDArray ();
288 }
289 
290 #endif
291 
292 // unary operations
293 
296 {
297  if (any_element_is_nan ())
299 
300  return do_mx_unary_op<bool, double> (*this, mx_inline_not);
301 }
302 
303 bool
304 NDArray::any_element_is_negative (bool neg_zero) const
305 {
306  return (neg_zero ? test_all (octave::math::negative_sign)
307  : do_mx_check<double> (*this, mx_inline_any_negative));
308 }
309 
310 bool
311 NDArray::any_element_is_positive (bool neg_zero) const
312 {
313  return (neg_zero ? test_all (octave::math::positive_sign)
314  : do_mx_check<double> (*this, mx_inline_any_positive));
315 }
316 
317 bool
319 {
320  return do_mx_check<double> (*this, mx_inline_any_nan);
321 }
322 
323 bool
325 {
326  return ! do_mx_check<double> (*this, mx_inline_all_finite);
327 }
328 
329 bool
331 {
332  return ! test_all (octave::is_one_or_zero);
333 }
334 
335 bool
337 {
338  return test_all (octave::is_zero);
339 }
340 
341 bool
343 {
345 }
346 
347 // Return nonzero if any element of M is not an integer. Also extract
348 // the largest and smallest values and return them in MAX_VAL and MIN_VAL.
349 
350 bool
351 NDArray::all_integers (double& max_val, double& min_val) const
352 {
353  octave_idx_type nel = numel ();
354 
355  if (nel > 0)
356  {
357  max_val = elem (0);
358  min_val = elem (0);
359  }
360  else
361  return false;
362 
363  for (octave_idx_type i = 0; i < nel; i++)
364  {
365  double val = elem (i);
366 
367  if (val > max_val)
368  max_val = val;
369 
370  if (val < min_val)
371  min_val = val;
372 
373  if (! octave::math::isinteger (val))
374  return false;
375  }
376 
377  return true;
378 }
379 
380 bool
382 {
384 }
385 
386 bool
388 {
390 }
391 
392 // FIXME: this is not quite the right thing.
393 
395 NDArray::all (int dim) const
396 {
397  return do_mx_red_op<bool, double> (*this, dim, mx_inline_all);
398 }
399 
401 NDArray::any (int dim) const
402 {
403  return do_mx_red_op<bool, double> (*this, dim, mx_inline_any);
404 }
405 
406 NDArray
407 NDArray::cumprod (int dim) const
408 {
409  return do_mx_cum_op<double, double> (*this, dim, mx_inline_cumprod);
410 }
411 
412 NDArray
413 NDArray::cumsum (int dim) const
414 {
415  return do_mx_cum_op<double, double> (*this, dim, mx_inline_cumsum);
416 }
417 
418 NDArray
419 NDArray::prod (int dim) const
420 {
421  return do_mx_red_op<double, double> (*this, dim, mx_inline_prod);
422 }
423 
424 NDArray
425 NDArray::sum (int dim) const
426 {
427  return do_mx_red_op<double, double> (*this, dim, mx_inline_sum);
428 }
429 
430 NDArray
431 NDArray::xsum (int dim) const
432 {
433  return do_mx_red_op<double, double> (*this, dim, mx_inline_xsum);
434 }
435 
436 NDArray
437 NDArray::sumsq (int dim) const
438 {
439  return do_mx_red_op<double, double> (*this, dim, mx_inline_sumsq);
440 }
441 
442 NDArray
443 NDArray::max (int dim) const
444 {
445  return do_mx_minmax_op<double> (*this, dim, mx_inline_max);
446 }
447 
448 NDArray
449 NDArray::max (Array<octave_idx_type>& idx_arg, int dim) const
450 {
451  return do_mx_minmax_op<double> (*this, idx_arg, dim, mx_inline_max);
452 }
453 
454 NDArray
455 NDArray::min (int dim) const
456 {
457  return do_mx_minmax_op<double> (*this, dim, mx_inline_min);
458 }
459 
460 NDArray
461 NDArray::min (Array<octave_idx_type>& idx_arg, int dim) const
462 {
463  return do_mx_minmax_op<double> (*this, idx_arg, dim, mx_inline_min);
464 }
465 
466 NDArray
467 NDArray::cummax (int dim) const
468 {
469  return do_mx_cumminmax_op<double> (*this, dim, mx_inline_cummax);
470 }
471 
472 NDArray
473 NDArray::cummax (Array<octave_idx_type>& idx_arg, int dim) const
474 {
475  return do_mx_cumminmax_op<double> (*this, idx_arg, dim, mx_inline_cummax);
476 }
477 
478 NDArray
479 NDArray::cummin (int dim) const
480 {
481  return do_mx_cumminmax_op<double> (*this, dim, mx_inline_cummin);
482 }
483 
484 NDArray
485 NDArray::cummin (Array<octave_idx_type>& idx_arg, int dim) const
486 {
487  return do_mx_cumminmax_op<double> (*this, idx_arg, dim, mx_inline_cummin);
488 }
489 
490 NDArray
491 NDArray::diff (octave_idx_type order, int dim) const
492 {
493  return do_mx_diff_op<double> (*this, dim, order, mx_inline_diff);
494 }
495 
496 NDArray
498 {
499  if (rb.numel () > 0)
500  insert (rb, ra_idx);
501  return *this;
502 }
503 
506 {
507  ComplexNDArray retval (*this);
508  if (rb.numel () > 0)
509  retval.insert (rb, ra_idx);
510  return retval;
511 }
512 
515 {
516  charNDArray retval (dims ());
517  octave_idx_type nel = numel ();
518 
519  for (octave_idx_type i = 0; i < nel; i++)
520  {
521  double d = elem (i);
522 
523  if (octave::math::isnan (d))
524  (*current_liboctave_error_handler)
525  ("invalid conversion from NaN to character");
526 
528 
529  if (ival < 0 || ival > std::numeric_limits<unsigned char>::max ())
530  // FIXME: is there something better to do? Should we warn the user?
531  ival = 0;
532 
533  retval.elem (i) = static_cast<char> (ival);
534  }
535 
536  if (rb.isempty ())
537  return retval;
538 
539  retval.insert (rb, ra_idx);
540  return retval;
541 }
542 
543 NDArray
545 {
546  return do_mx_unary_op<double, Complex> (a, mx_inline_real);
547 }
548 
549 NDArray
551 {
552  return do_mx_unary_op<double, Complex> (a, mx_inline_imag);
553 }
554 
555 NDArray&
557 {
558  Array<double>::insert (a, r, c);
559  return *this;
560 }
561 
562 NDArray&
564 {
566  return *this;
567 }
568 
569 NDArray
570 NDArray::abs (void) const
571 {
572  return do_mx_unary_map<double, double, std::abs> (*this);
573 }
574 
576 NDArray::isnan (void) const
577 {
578  return do_mx_unary_map<bool, double, octave::math::isnan> (*this);
579 }
580 
582 NDArray::isinf (void) const
583 {
584  return do_mx_unary_map<bool, double, octave::math::isinf> (*this);
585 }
586 
588 NDArray::isfinite (void) const
589 {
590  return do_mx_unary_map<bool, double, octave::math::isfinite> (*this);
591 }
592 
593 void
595  const dim_vector& dimensions,
596  int start_dimension)
597 {
598  ::increment_index (ra_idx, dimensions, start_dimension);
599 }
600 
603  const dim_vector& dimensions)
604 {
605  return ::compute_index (ra_idx, dimensions);
606 }
607 
608 NDArray
610 {
611  return MArray<double>::diag (k);
612 }
613 
614 NDArray
616 {
617  return MArray<double>::diag (m, n);
618 }
619 
620 // This contains no information on the array structure !!!
621 std::ostream&
622 operator << (std::ostream& os, const NDArray& a)
623 {
624  octave_idx_type nel = a.numel ();
625 
626  for (octave_idx_type i = 0; i < nel; i++)
627  {
628  os << ' ';
629  octave::write_value<double> (os, a.elem (i));
630  os << "\n";
631  }
632  return os;
633 }
634 
635 std::istream&
636 operator >> (std::istream& is, NDArray& a)
637 {
638  octave_idx_type nel = a.numel ();
639 
640  if (nel > 0)
641  {
642  double tmp;
643  for (octave_idx_type i = 0; i < nel; i++)
644  {
645  tmp = octave::read_value<double> (is);
646  if (is)
647  a.elem (i) = tmp;
648  else
649  return is;
650  }
651  }
652 
653  return is;
654 }
655 
657 
660 
663 
666 
669 
octave_idx_type compute_index(octave_idx_type n, const dim_vector &dims)
Definition: Array-util.cc:177
#define BSXFUN_STDREL_DEFS_MXLOOP(ARRAY)
Definition: bsxfun-defs.cc:244
#define BSXFUN_STDOP_DEFS_MXLOOP(ARRAY)
Definition: bsxfun-defs.cc:236
#define BSXFUN_OP2_DEF_MXLOOP(OP, ARRAY, ARRAY1, ARRAY2, LOOP)
Definition: bsxfun-defs.cc:226
#define BSXFUN_OP_DEF_MXLOOP(OP, ARRAY, LOOP)
Definition: bsxfun-defs.cc:221
OCTARRAY_OVERRIDABLE_FUNC_API const T * data(void) const
Size of the specified dimension.
Definition: Array.h:663
OCTARRAY_OVERRIDABLE_FUNC_API bool isempty(void) const
Size of the specified dimension.
Definition: Array.h:651
bool test_all(F fcn) const
Definition: Array.h:928
OCTARRAY_OVERRIDABLE_FUNC_API octave_idx_type numel(void) const
Number of elements in the array.
Definition: Array.h:414
OCTARRAY_OVERRIDABLE_FUNC_API const dim_vector & dims(void) const
Return a const-reference so that dims ()(i) works efficiently.
Definition: Array.h:503
bool test_any(F fcn) const
Simpler calls.
Definition: Array.h:924
OCTARRAY_API void resize(const dim_vector &dv, const double &rfv)
Definition: Array-base.cc:1032
OCTARRAY_API Array< T, Alloc > & insert(const Array< T, Alloc > &a, const Array< octave_idx_type > &idx)
Insert an array into another at a specified position.
Definition: Array-base.cc:1610
OCTARRAY_API double * fortran_vec(void)
Definition: Array-base.cc:1766
OCTARRAY_OVERRIDABLE_FUNC_API double & elem(octave_idx_type n)
Definition: Array.h:562
OCTARRAY_API Array< T, Alloc > diag(octave_idx_type k=0) const
Get the kth super or subdiagonal.
Definition: Array-base.cc:2543
OCTARRAY_OVERRIDABLE_FUNC_API double & xelem(octave_idx_type n)
Definition: Array.h:524
OCTAVE_API ComplexNDArray & insert(const NDArray &a, octave_idx_type r, octave_idx_type c)
Definition: CNDArray.cc:508
Template for N-dimensional array classes with like-type math operators.
Definition: MArray.h:63
OCTAVE_API ComplexNDArray ifourier(int dim=1) const
Definition: dNDArray.cc:131
OCTAVE_API NDArray diag(octave_idx_type k=0) const
Definition: dNDArray.cc:609
static OCTAVE_API octave_idx_type compute_index(Array< octave_idx_type > &ra_idx, const dim_vector &dimensions)
Definition: dNDArray.cc:602
OCTAVE_API NDArray min(int dim=-1) const
Definition: dNDArray.cc:455
OCTAVE_API bool all_elements_are_int_or_inf_or_nan(void) const
Definition: dNDArray.cc:342
OCTAVE_API NDArray diff(octave_idx_type order=1, int dim=-1) const
Definition: dNDArray.cc:491
OCTAVE_API bool all_elements_are_zero(void) const
Definition: dNDArray.cc:336
OCTAVE_API NDArray abs(void) const
Definition: dNDArray.cc:570
OCTAVE_API ComplexNDArray fourier2d(void) const
Definition: dNDArray.cc:161
OCTAVE_API ComplexNDArray fourierNd(void) const
Definition: dNDArray.cc:200
OCTAVE_API NDArray cumsum(int dim=-1) const
Definition: dNDArray.cc:413
OCTAVE_API bool any_element_is_nan(void) const
Definition: dNDArray.cc:318
OCTAVE_API bool any_element_not_one_or_zero(void) const
Definition: dNDArray.cc:330
OCTAVE_API NDArray cummax(int dim=-1) const
Definition: dNDArray.cc:467
OCTAVE_API ComplexNDArray ifourierNd(void) const
Definition: dNDArray.cc:215
OCTAVE_API boolNDArray operator!(void) const
Definition: dNDArray.cc:295
OCTAVE_API NDArray sumsq(int dim=-1) const
Definition: dNDArray.cc:437
OCTAVE_API boolNDArray isnan(void) const
Definition: dNDArray.cc:576
OCTAVE_API ComplexNDArray ifourier2d(void) const
Definition: dNDArray.cc:181
OCTAVE_API NDArray max(int dim=-1) const
Definition: dNDArray.cc:443
OCTAVE_API bool any_element_is_inf_or_nan(void) const
Definition: dNDArray.cc:324
OCTAVE_API ComplexNDArray fourier(int dim=1) const
Definition: dNDArray.cc:100
OCTAVE_API bool any_element_is_positive(bool=false) const
Definition: dNDArray.cc:311
OCTAVE_API NDArray prod(int dim=-1) const
Definition: dNDArray.cc:419
OCTAVE_API boolNDArray isfinite(void) const
Definition: dNDArray.cc:588
NDArray(void)
Definition: dNDArray.h:43
OCTAVE_API bool too_large_for_float(void) const
Definition: dNDArray.cc:387
static OCTAVE_API void increment_index(Array< octave_idx_type > &ra_idx, const dim_vector &dimensions, int start_dimension=0)
Definition: dNDArray.cc:594
OCTAVE_API NDArray cummin(int dim=-1) const
Definition: dNDArray.cc:479
OCTAVE_API NDArray cumprod(int dim=-1) const
Definition: dNDArray.cc:407
OCTAVE_API boolNDArray all(int dim=-1) const
Definition: dNDArray.cc:395
OCTAVE_API bool all_integers(void) const
Definition: dNDArray.cc:381
OCTAVE_API boolNDArray isinf(void) const
Definition: dNDArray.cc:582
OCTAVE_API NDArray xsum(int dim=-1) const
Definition: dNDArray.cc:431
OCTAVE_API NDArray & insert(const NDArray &a, octave_idx_type r, octave_idx_type c)
Definition: dNDArray.cc:556
OCTAVE_API boolNDArray any(int dim=-1) const
Definition: dNDArray.cc:401
OCTAVE_API bool any_element_is_negative(bool=false) const
Definition: dNDArray.cc:304
OCTAVE_API NDArray concat(const NDArray &rb, const Array< octave_idx_type > &ra_idx)
Definition: dNDArray.cc:497
friend class ComplexNDArray
Definition: dNDArray.h:141
OCTAVE_API NDArray sum(int dim=-1) const
Definition: dNDArray.cc:425
OCTAVE_API charNDArray & insert(const charNDArray &a, octave_idx_type r, octave_idx_type c)
Definition: chNDArray.cc:166
Vector representing the dimensions (size) of an Array.
Definition: dim-vector.h:94
octave_idx_type ndims(void) const
Number of dimensions.
Definition: dim-vector.h:257
std::istream & operator>>(std::istream &is, NDArray &a)
Definition: dNDArray.cc:636
NDArray real(const ComplexNDArray &a)
Definition: dNDArray.cc:544
NDArray imag(const ComplexNDArray &a)
Definition: dNDArray.cc:550
std::ostream & operator<<(std::ostream &os, const NDArray &a)
Definition: dNDArray.cc:622
NDArray max(double d, const NDArray &m)
Definition: dNDArray.cc:656
void err_nan_to_logical_conversion(void)
double lo_ieee_nan_value(void)
Definition: lo-ieee.cc:84
octave_idx_type nint_big(double x)
Definition: lo-mappers.cc:184
bool negative_sign(double x)
Definition: lo-mappers.cc:178
bool isinteger(double x)
Definition: lo-mappers.h:225
bool positive_sign(double x)
Definition: lo-mappers.h:62
bool isnan(bool)
Definition: lo-mappers.h:178
F77_RET_T const F77_DBLE const F77_DBLE F77_DBLE * d
bool is_int_or_inf_or_nan(double x)
Definition: lo-utils.cc:50
bool too_large_for_float(double x)
Definition: lo-utils.cc:55
bool is_one_or_zero(const T &x)
Definition: lo-utils.h:72
bool is_zero(const T &x)
Definition: lo-utils.h:78
T mx_inline_xsum(const T *v, octave_idx_type n)
Definition: mx-inlines.cc:1698
void mx_inline_any(const T *v, bool *r, octave_idx_type l, octave_idx_type n, octave_idx_type u)
Definition: mx-inlines.cc:851
void mx_inline_cummin(const T *v, T *r, octave_idx_type n)
Definition: mx-inlines.cc:1193
void mx_inline_cumprod(const T *v, T *r, octave_idx_type n)
Definition: mx-inlines.cc:868
void mx_inline_cumsum(const T *v, T *r, octave_idx_type n)
Definition: mx-inlines.cc:867
bool mx_inline_any_nan(std::size_t n, const T *x)
Definition: mx-inlines.cc:257
void mx_inline_max(const T *v, T *r, octave_idx_type n)
Definition: mx-inlines.cc:972
void mx_inline_not(std::size_t n, bool *r, const X *x)
Definition: mx-inlines.cc:181
void mx_inline_all(const T *v, bool *r, octave_idx_type m, octave_idx_type n)
Definition: mx-inlines.cc:817
void mx_inline_prod(const T *v, T *r, octave_idx_type l, octave_idx_type n, octave_idx_type u)
Definition: mx-inlines.cc:847
void mx_inline_cummax(const T *v, T *r, octave_idx_type n)
Definition: mx-inlines.cc:1194
void mx_inline_real(std::size_t n, T *r, const std::complex< T > *x)
Definition: mx-inlines.cc:321
T mx_inline_sumsq(const T *v, octave_idx_type n)
Definition: mx-inlines.cc:755
bool mx_inline_any_positive(std::size_t n, const T *x)
Definition: mx-inlines.cc:296
void mx_inline_imag(std::size_t n, T *r, const std::complex< T > *x)
Definition: mx-inlines.cc:328
T mx_inline_sum(const T *v, octave_idx_type n)
Definition: mx-inlines.cc:752
void mx_inline_min(const T *v, T *r, octave_idx_type n)
Definition: mx-inlines.cc:971
T octave_idx_type m
Definition: mx-inlines.cc:773
void mx_inline_diff(const T *v, T *r, octave_idx_type n, octave_idx_type order)
Definition: mx-inlines.cc:1390
bool mx_inline_all_finite(std::size_t n, const T *x)
Definition: mx-inlines.cc:270
bool mx_inline_any_negative(std::size_t n, const T *x)
Definition: mx-inlines.cc:283
octave_idx_type n
Definition: mx-inlines.cc:753
T * r
Definition: mx-inlines.cc:773
void mx_inline_pow(std::size_t n, R *r, const X *x, const Y *y)
Definition: mx-inlines.cc:414
#define NDND_BOOL_OPS(ND1, ND2)
Definition: mx-op-defs.h:350
#define NDS_BOOL_OPS(ND, S)
Definition: mx-op-defs.h:256
#define NDND_CMP_OPS(ND1, ND2)
Definition: mx-op-defs.h:333
#define SND_BOOL_OPS(S, ND)
Definition: mx-op-defs.h:303
#define NDS_CMP_OPS(ND, S)
Definition: mx-op-defs.h:239
#define SND_CMP_OPS(S, ND)
Definition: mx-op-defs.h:286
#define MINMAX_FCNS(T, S)
Definition: mx-op-defs.h:589
std::complex< double > Complex
Definition: oct-cmplx.h:33
octave_int< T > pow(const octave_int< T > &a, const octave_int< T > &b)
const octave_base_value const Array< octave_idx_type > & ra_idx