#include <cstddef>
#include <cmath>
#include "quit.h"
#include "oct-cmplx.h"
#include "oct-locbuf.h"
#include "oct-inttypes.h"
#include "Array-util.h"
Defines | |
#define | octave_mx_inlines_h 1 |
#define | DEFMXUNOP(F, OP) |
#define | DEFMXUNOPEQ(F, OP) |
#define | DEFMXUNBOOLOP(F, OP) |
#define | DEFMXBINOP(F, OP) |
#define | DEFMXBINOPEQ(F, OP) |
#define | DEFMXCMPOP(F, OP) |
#define | DEFLOGCHKNAN(ARG, ZERO) |
#define | DEFMXBOOLOP(F, NOT1, OP, NOT2) |
#define | DEFMXBOOLOPEQ(F, OP) |
#define | DEFMXANYNAN(T) |
#define | OP_DUP_FCN(OP, F, R, T) |
#define | OP_RED_SUM(ac, el) ac += el |
#define | OP_RED_PROD(ac, el) ac *= el |
#define | OP_RED_SUMSQ(ac, el) ac += el*el |
#define | OP_RED_SUMSQC(ac, el) ac += cabsq (el) |
#define | OP_RED_ANYC(ac, el) if (xis_true (el)) { ac = true; break; } else continue |
#define | OP_RED_ALLC(ac, el) if (xis_false (el)) { ac = false; break; } else continue |
#define | OP_RED_FCN(F, TSRC, TRES, OP, ZERO) |
#define | PROMOTE_DOUBLE(T) typename subst_template_param<std::complex, T, double>::type |
#define | OP_RED_FCN2(F, TSRC, TRES, OP, ZERO) |
#define | OP_ROW_SHORT_CIRCUIT(F, PRED, ZERO) |
#define | OP_RED_FCNN(F, TSRC, TRES) |
#define | OP_CUM_FCN(F, TSRC, TRES, OP) |
#define | OP_CUM_FCN2(F, TSRC, TRES, OP) |
#define | OP_CUM_FCNN(F, TSRC, TRES) |
#define | OP_MINMAX_FCN(F, OP) |
#define | OP_MINMAX_FCN2(F, OP) |
#define | OP_MINMAX_FCNN(F) |
#define | OP_CUMMINMAX_FCN(F, OP) |
#define | OP_CUMMINMAX_FCN2(F, OP) |
#define | OP_CUMMINMAX_FCNN(F) |
Functions | |
template<class R , class S > | |
void | mx_inline_fill (size_t n, R *r, S s) |
template<class T > | |
bool | logical_value (T x) |
template<class T > | |
bool | logical_value (const octave_int< T > &x) |
template<class X > | |
void | mx_inline_not (size_t n, bool *r, const X *x) |
void | mx_inline_not2 (size_t n, bool *r) |
template<class T > | |
bool | mx_inline_any_nan (size_t, const T *) |
template<class R , class X , R F> | |
void | mx_inline_fun (size_t n, R *r, const X *x) |
template<class R , class X , class Y , R F> | |
void | mx_inline_fun (size_t n, R *r, const X *x, const Y *y) |
template<class R , class X , class Y , R F> | |
void | mx_inline_fun (size_t n, R *r, X x, const Y *y) |
template<class R , class X , class Y , R F> | |
void | mx_inline_fun (size_t n, R *r, const X *x, Y y) |
template<class RNDA , class XNDA > | |
RNDA | do_mx_unary_op (const XNDA &x, void(*op)(size_t, typename RNDA::element_type *, const typename XNDA::element_type *)) |
template<class RNDA > | |
RNDA & | do_mx_inplace_op (RNDA &r, void(*op)(size_t, typename RNDA::element_type *)) |
template<class RNDA , class XNDA , class YNDA > | |
RNDA | do_mm_binary_op (const XNDA &x, const YNDA &y, void(*op)(size_t, typename RNDA::element_type *, const typename XNDA::element_type *, const typename YNDA::element_type *), const char *opname) |
template<class RNDA , class XNDA , class YS > | |
RNDA | do_ms_binary_op (const XNDA &x, const YS &y, void(*op)(size_t, typename RNDA::element_type *, const typename XNDA::element_type *, YS)) |
template<class RNDA , class XS , class YNDA > | |
RNDA | do_sm_binary_op (const XS &x, const YNDA &y, void(*op)(size_t, typename RNDA::element_type *, XS, const typename YNDA::element_type *)) |
template<class RNDA , class XNDA > | |
RNDA & | do_mm_inplace_op (RNDA &r, const XNDA &x, void(*op)(size_t, typename RNDA::element_type *, const typename XNDA::element_type *), const char *opname) |
template<class RNDA , class XS > | |
RNDA & | do_ms_inplace_op (RNDA &r, const XS &x, void(*op)(size_t, typename RNDA::element_type *, XS)) |
template<class T1 , class T2 > | |
bool | mx_inline_equal (size_t n, const T1 *x, const T2 *y) |
OP_DUP_FCN (static_cast< float >(0.0)==, mx_inline_not, float, FloatComplex) template< class T > inline T cabsq(const std | |
template<class T > | |
bool | xis_true (T x) |
template<class T > | |
bool | xis_false (T x) |
template<class T > | |
bool | xis_true (const octave_int< T > &x) |
template<class T > | |
bool | xis_false (const octave_int< T > &x) |
bool | xis_true (double x) |
bool | xis_false (double x) |
bool | xis_true (float x) |
bool | xis_false (float x) |
bool | xis_true (const Complex &x) |
bool | xis_false (const Complex &x) |
bool | xis_true (const FloatComplex &x) |
bool | xis_false (const FloatComplex &x) |
void | op_dble_sum (double &ac, float el) |
void | op_dble_sum (Complex &ac, const FloatComplex &el) |
template<class T > | |
void | op_dble_sum (double &ac, const octave_int< T > &el) |
OP_RED_FCN (mx_inline_dsum, T, PROMOTE_DOUBLE(T), op_dble_sum, 0.0) OP_RED_FCN2(mx_inline_dsum | |
OP_RED_FCNN (mx_inline_dsum, T, PROMOTE_DOUBLE(T)) template< class T > void mx_inline_diff(const T *v | |
T octave_idx_type octave_idx_type order | switch (order) |
template<class T > | |
void | mx_inline_diff (const T *v, T *r, octave_idx_type m, octave_idx_type n, octave_idx_type order) |
template<class T > | |
void | mx_inline_diff (const T *v, T *r, octave_idx_type l, octave_idx_type n, octave_idx_type u, octave_idx_type order) |
void | get_extent_triplet (const dim_vector &dims, int &dim, octave_idx_type &l, octave_idx_type &n, octave_idx_type &u) |
template<class ArrayType , class T > | |
ArrayType | do_mx_red_op (const Array< T > &src, int dim, void(*mx_red_op)(const T *, typename ArrayType::element_type *, octave_idx_type, octave_idx_type, octave_idx_type)) |
template<class ArrayType , class T > | |
ArrayType | do_mx_cum_op (const Array< T > &src, int dim, void(*mx_cum_op)(const T *, typename ArrayType::element_type *, octave_idx_type, octave_idx_type, octave_idx_type)) |
template<class ArrayType > | |
ArrayType | do_mx_minmax_op (const ArrayType &src, int dim, void(*mx_minmax_op)(const typename ArrayType::element_type *, typename ArrayType::element_type *, octave_idx_type, octave_idx_type, octave_idx_type)) |
template<class ArrayType > | |
ArrayType | do_mx_minmax_op (const ArrayType &src, Array< octave_idx_type > &idx, int dim, void(*mx_minmax_op)(const typename ArrayType::element_type *, typename ArrayType::element_type *, octave_idx_type *, octave_idx_type, octave_idx_type, octave_idx_type)) |
template<class ArrayType > | |
ArrayType | do_mx_cumminmax_op (const ArrayType &src, int dim, void(*mx_cumminmax_op)(const typename ArrayType::element_type *, typename ArrayType::element_type *, octave_idx_type, octave_idx_type, octave_idx_type)) |
template<class ArrayType > | |
ArrayType | do_mx_cumminmax_op (const ArrayType &src, Array< octave_idx_type > &idx, int dim, void(*mx_cumminmax_op)(const typename ArrayType::element_type *, typename ArrayType::element_type *, octave_idx_type *, octave_idx_type, octave_idx_type, octave_idx_type)) |
template<class ArrayType > | |
ArrayType | do_mx_diff_op (const ArrayType &src, int dim, octave_idx_type order, void(*mx_diff_op)(const typename ArrayType::element_type *, typename ArrayType::element_type *, octave_idx_type, octave_idx_type, octave_idx_type, octave_idx_type)) |
template<class T > | |
void | twosum_accum (T &s, T &e, const T &x) |
template<class T > | |
T | mx_inline_xsum (const T *v, octave_idx_type n) |
template<class T > | |
void | mx_inline_xsum (const T *v, T *r, octave_idx_type m, octave_idx_type n) |
Variables | |
T | |
op_dble_sum | |
T * | r |
T octave_idx_type | n |
#define DEFLOGCHKNAN | ( | ARG, | |||
ZERO | ) |
Value:
inline bool logical_value (ARG x) \ { if (xisnan (x)) gripe_nan_to_logical_conversion (); return x != ZERO; }
#define DEFMXANYNAN | ( | T | ) |
#define DEFMXBINOP | ( | F, | |||
OP | ) |
Value:
template <class R, class X, class Y> \ inline void F (size_t n, R *r, const X *x, const Y *y) \ { for (size_t i = 0; i < n; i++) r[i] = x[i] OP y[i]; } \ template <class R, class X, class Y> \ inline void F (size_t n, R *r, const X *x, Y y) \ { for (size_t i = 0; i < n; i++) r[i] = x[i] OP y; } \ template <class R, class X, class Y> \ inline void F (size_t n, R *r, X x, const Y *y) \ { for (size_t i = 0; i < n; i++) r[i] = x OP y[i]; }
#define DEFMXBINOPEQ | ( | F, | |||
OP | ) |
#define DEFMXBOOLOP | ( | F, | |||
NOT1, | |||||
OP, | |||||
NOT2 | ) |
Value:
template <class X, class Y> \ inline void F (size_t n, bool *r, const X *x, const Y *y) \ { \ for (size_t i = 0; i < n; i++) \ r[i] = (NOT1 logical_value (x[i])) OP (NOT2 logical_value (y[i])); \ } \ template <class X, class Y> \ inline void F (size_t n, bool *r, const X *x, Y y) \ { \ const bool yy = (NOT2 logical_value (y)); \ for (size_t i = 0; i < n; i++) \ r[i] = (NOT1 logical_value (x[i])) OP yy; \ } \ template <class X, class Y> \ inline void F (size_t n, bool *r, X x, const Y *y) \ { \ const bool xx = (NOT1 logical_value (x)); \ for (size_t i = 0; i < n; i++) \ r[i] = xx OP (NOT2 logical_value (y[i])); \ }
#define DEFMXBOOLOPEQ | ( | F, | |||
OP | ) |
#define DEFMXCMPOP | ( | F, | |||
OP | ) |
Value:
template <class X, class Y> \ inline void F (size_t n, bool *r, const X *x, const Y *y) \ { for (size_t i = 0; i < n; i++) r[i] = x[i] OP y[i]; } \ template <class X, class Y> \ inline void F (size_t n, bool *r, const X *x, Y y) \ { for (size_t i = 0; i < n; i++) r[i] = x[i] OP y; } \ template <class X, class Y> \ inline void F (size_t n, bool *r, X x, const Y *y) \ { for (size_t i = 0; i < n; i++) r[i] = x OP y[i]; }
#define DEFMXUNBOOLOP | ( | F, | |||
OP | ) |
#define DEFMXUNOP | ( | F, | |||
OP | ) |
#define DEFMXUNOPEQ | ( | F, | |||
OP | ) |
#define octave_mx_inlines_h 1 |
#define OP_CUM_FCN | ( | F, | |||
TSRC, | |||||
TRES, | |||||
OP | ) |
#define OP_CUM_FCN2 | ( | F, | |||
TSRC, | |||||
TRES, | |||||
OP | ) |
Value:
template <class T> \ inline void \ F (const TSRC *v, TRES *r, octave_idx_type m, octave_idx_type n) \ { \ if (n) \ { \ for (octave_idx_type i = 0; i < m; i++) \ r[i] = v[i]; \ const T *r0 = r; \ for (octave_idx_type j = 1; j < n; j++) \ { \ r += m; v += m; \ for (octave_idx_type i = 0; i < m; i++) \ r[i] = r0[i] OP v[i]; \ r0 += m; \ } \ } \ }
#define OP_CUM_FCNN | ( | F, | |||
TSRC, | |||||
TRES | ) |
Value:
template <class T> \ inline void \ F (const TSRC *v, TRES *r, octave_idx_type l, \ octave_idx_type n, octave_idx_type u) \ { \ if (l == 1) \ { \ for (octave_idx_type i = 0; i < u; i++) \ { \ F (v, r, n); \ v += n; r += n; \ } \ } \ else \ { \ for (octave_idx_type i = 0; i < u; i++) \ { \ F (v, r, l, n); \ v += l*n; \ r += l*n; \ } \ } \ }
#define OP_CUMMINMAX_FCN | ( | F, | |||
OP | ) |
#define OP_CUMMINMAX_FCN2 | ( | F, | |||
OP | ) |
#define OP_CUMMINMAX_FCNN | ( | F | ) |
#define OP_MINMAX_FCN | ( | F, | |||
OP | ) |
#define OP_MINMAX_FCN2 | ( | F, | |||
OP | ) |
#define OP_MINMAX_FCNN | ( | F | ) |
#define OP_RED_FCN | ( | F, | |||
TSRC, | |||||
TRES, | |||||
OP, | |||||
ZERO | ) |
#define OP_RED_FCN2 | ( | F, | |||
TSRC, | |||||
TRES, | |||||
OP, | |||||
ZERO | ) |
#define OP_RED_FCNN | ( | F, | |||
TSRC, | |||||
TRES | ) |
Value:
template <class T> \ inline void \ F (const TSRC *v, TRES *r, octave_idx_type l, \ octave_idx_type n, octave_idx_type u) \ { \ if (l == 1) \ { \ for (octave_idx_type i = 0; i < u; i++) \ { \ r[i] = F<T> (v, n); \ v += n; \ } \ } \ else \ { \ for (octave_idx_type i = 0; i < u; i++) \ { \ F (v, r, l, n); \ v += l*n; \ r += l; \ } \ } \ }
#define OP_ROW_SHORT_CIRCUIT | ( | F, | |||
PRED, | |||||
ZERO | ) |
Value:
template <class T> \ inline void \ F (const T* v, bool *r, octave_idx_type m, octave_idx_type n) \ { \ /* FIXME: it may be sub-optimal to allocate the buffer here. */ \ OCTAVE_LOCAL_BUFFER (octave_idx_type, iact, m); \ for (octave_idx_type i = 0; i < m; i++) iact[i] = i; \ octave_idx_type nact = m; \ for (octave_idx_type j = 0; j < n; j++) \ { \ octave_idx_type k = 0; \ for (octave_idx_type i = 0; i < nact; i++) \ { \ octave_idx_type ia = iact[i]; \ if (! PRED (v[ia])) \ iact[k++] = ia; \ } \ nact = k; \ v += m; \ } \ for (octave_idx_type i = 0; i < m; i++) r[i] = ! ZERO; \ for (octave_idx_type i = 0; i < nact; i++) r[iact[i]] = ZERO; \ }
PROMOTE_DOUBLE | ( | T | ) | typename subst_template_param<std::complex, T, double>::type |
RNDA do_mm_binary_op | ( | const XNDA & | x, | |
const YNDA & | y, | |||
void(*)(size_t, typename RNDA::element_type *, const typename XNDA::element_type *, const typename YNDA::element_type *) | op, | |||
const char * | opname | |||
) | [inline] |
RNDA& do_mm_inplace_op | ( | RNDA & | r, | |
const XNDA & | x, | |||
void(*)(size_t, typename RNDA::element_type *, const typename XNDA::element_type *) | op, | |||
const char * | opname | |||
) | [inline] |
RNDA do_ms_binary_op | ( | const XNDA & | x, | |
const YS & | y, | |||
void(*)(size_t, typename RNDA::element_type *, const typename XNDA::element_type *, YS) | op | |||
) | [inline] |
RNDA& do_ms_inplace_op | ( | RNDA & | r, | |
const XS & | x, | |||
void(*)(size_t, typename RNDA::element_type *, XS) | op | |||
) | [inline] |
ArrayType do_mx_cum_op | ( | const Array< T > & | src, | |
int | dim, | |||
void(*)(const T *, typename ArrayType::element_type *, octave_idx_type, octave_idx_type, octave_idx_type) | mx_cum_op | |||
) | [inline] |
ArrayType do_mx_cumminmax_op | ( | const ArrayType & | src, | |
Array< octave_idx_type > & | idx, | |||
int | dim, | |||
void(*)(const typename ArrayType::element_type *, typename ArrayType::element_type *, octave_idx_type *, octave_idx_type, octave_idx_type, octave_idx_type) | mx_cumminmax_op | |||
) | [inline] |
ArrayType do_mx_cumminmax_op | ( | const ArrayType & | src, | |
int | dim, | |||
void(*)(const typename ArrayType::element_type *, typename ArrayType::element_type *, octave_idx_type, octave_idx_type, octave_idx_type) | mx_cumminmax_op | |||
) | [inline] |
ArrayType do_mx_diff_op | ( | const ArrayType & | src, | |
int | dim, | |||
octave_idx_type | order, | |||
void(*)(const typename ArrayType::element_type *, typename ArrayType::element_type *, octave_idx_type, octave_idx_type, octave_idx_type, octave_idx_type) | mx_diff_op | |||
) | [inline] |
RNDA& do_mx_inplace_op | ( | RNDA & | r, | |
void(*)(size_t, typename RNDA::element_type *) | op | |||
) | [inline] |
ArrayType do_mx_minmax_op | ( | const ArrayType & | src, | |
Array< octave_idx_type > & | idx, | |||
int | dim, | |||
void(*)(const typename ArrayType::element_type *, typename ArrayType::element_type *, octave_idx_type *, octave_idx_type, octave_idx_type, octave_idx_type) | mx_minmax_op | |||
) | [inline] |
ArrayType do_mx_minmax_op | ( | const ArrayType & | src, | |
int | dim, | |||
void(*)(const typename ArrayType::element_type *, typename ArrayType::element_type *, octave_idx_type, octave_idx_type, octave_idx_type) | mx_minmax_op | |||
) | [inline] |
ArrayType do_mx_red_op | ( | const Array< T > & | src, | |
int | dim, | |||
void(*)(const T *, typename ArrayType::element_type *, octave_idx_type, octave_idx_type, octave_idx_type) | mx_red_op | |||
) | [inline] |
RNDA do_mx_unary_op | ( | const XNDA & | x, | |
void(*)(size_t, typename RNDA::element_type *, const typename XNDA::element_type *) | op | |||
) | [inline] |
RNDA do_sm_binary_op | ( | const XS & | x, | |
const YNDA & | y, | |||
void(*)(size_t, typename RNDA::element_type *, XS, const typename YNDA::element_type *) | op | |||
) | [inline] |
void get_extent_triplet | ( | const dim_vector & | dims, | |
int & | dim, | |||
octave_idx_type & | l, | |||
octave_idx_type & | n, | |||
octave_idx_type & | u | |||
) | [inline] |
bool logical_value | ( | const octave_int< T > & | x | ) | [inline] |
void mx_inline_diff | ( | const T * | v, | |
T * | r, | |||
octave_idx_type | l, | |||
octave_idx_type | n, | |||
octave_idx_type | u, | |||
octave_idx_type | order | |||
) | [inline] |
void mx_inline_diff | ( | const T * | v, | |
T * | r, | |||
octave_idx_type | m, | |||
octave_idx_type | n, | |||
octave_idx_type | order | |||
) | [inline] |
bool mx_inline_equal | ( | size_t | n, | |
const T1 * | x, | |||
const T2 * | y | |||
) | [inline] |
void mx_inline_fill | ( | size_t | n, | |
R * | r, | |||
S | s | |||
) | [inline] |
void mx_inline_fun | ( | size_t | n, | |
R * | r, | |||
const X * | x, | |||
Y | y | |||
) | [inline] |
void mx_inline_fun | ( | size_t | n, | |
R * | r, | |||
X | x, | |||
const Y * | y | |||
) | [inline] |
void mx_inline_fun | ( | size_t | n, | |
R * | r, | |||
const X * | x, | |||
const Y * | y | |||
) | [inline] |
void mx_inline_not2 | ( | size_t | n, | |
bool * | r | |||
) | [inline] |
void mx_inline_xsum | ( | const T * | v, | |
T * | r, | |||
octave_idx_type | m, | |||
octave_idx_type | n | |||
) | [inline] |
T mx_inline_xsum | ( | const T * | v, | |
octave_idx_type | n | |||
) | [inline] |
void op_dble_sum | ( | double & | ac, | |
const octave_int< T > & | el | |||
) | [inline] |
void op_dble_sum | ( | Complex & | ac, | |
const FloatComplex & | el | |||
) | [inline] |
OP_DUP_FCN | ( | static_cast< float > | 0.0 = = , |
|
mx_inline_not | , | |||
float | , | |||
FloatComplex | ||||
) | const |
T octave_idx_type octave_idx_type order switch | ( | order | ) |
bool xis_false | ( | const FloatComplex & | x | ) | [inline] |
bool xis_false | ( | const octave_int< T > & | x | ) | [inline] |
bool xis_true | ( | const FloatComplex & | x | ) | [inline] |
bool xis_true | ( | const octave_int< T > & | x | ) | [inline] |
op_dble_sum |
T* r |