annotate liboctave/mx-inlines.cc @ 8743:1bd918cfb6e2

reimplement any & all using the new reduction code
author Jaroslav Hajek <highegg@gmail.com>
date Sat, 14 Feb 2009 19:50:43 +0100
parents 53b4fdeacc2e
children 9f7ce4bf7650
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
rev   line source
3
9a4c07481e61 [project @ 1993-08-08 01:20:23 by jwe]
jwe
parents:
diff changeset
1 /*
9a4c07481e61 [project @ 1993-08-08 01:20:23 by jwe]
jwe
parents:
diff changeset
2
7017
a1dbe9d80eee [project @ 2007-10-12 21:27:11 by jwe]
jwe
parents: 7016
diff changeset
3 Copyright (C) 1993, 1994, 1995, 1996, 1997, 1999, 2000, 2001, 2002,
a1dbe9d80eee [project @ 2007-10-12 21:27:11 by jwe]
jwe
parents: 7016
diff changeset
4 2003, 2004, 2005, 2006, 2007 John W. Eaton
3
9a4c07481e61 [project @ 1993-08-08 01:20:23 by jwe]
jwe
parents:
diff changeset
5
9a4c07481e61 [project @ 1993-08-08 01:20:23 by jwe]
jwe
parents:
diff changeset
6 This file is part of Octave.
9a4c07481e61 [project @ 1993-08-08 01:20:23 by jwe]
jwe
parents:
diff changeset
7
9a4c07481e61 [project @ 1993-08-08 01:20:23 by jwe]
jwe
parents:
diff changeset
8 Octave is free software; you can redistribute it and/or modify it
9a4c07481e61 [project @ 1993-08-08 01:20:23 by jwe]
jwe
parents:
diff changeset
9 under the terms of the GNU General Public License as published by the
7016
93c65f2a5668 [project @ 2007-10-12 06:40:56 by jwe]
jwe
parents: 5972
diff changeset
10 Free Software Foundation; either version 3 of the License, or (at your
93c65f2a5668 [project @ 2007-10-12 06:40:56 by jwe]
jwe
parents: 5972
diff changeset
11 option) any later version.
3
9a4c07481e61 [project @ 1993-08-08 01:20:23 by jwe]
jwe
parents:
diff changeset
12
9a4c07481e61 [project @ 1993-08-08 01:20:23 by jwe]
jwe
parents:
diff changeset
13 Octave is distributed in the hope that it will be useful, but WITHOUT
9a4c07481e61 [project @ 1993-08-08 01:20:23 by jwe]
jwe
parents:
diff changeset
14 ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
9a4c07481e61 [project @ 1993-08-08 01:20:23 by jwe]
jwe
parents:
diff changeset
15 FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
9a4c07481e61 [project @ 1993-08-08 01:20:23 by jwe]
jwe
parents:
diff changeset
16 for more details.
9a4c07481e61 [project @ 1993-08-08 01:20:23 by jwe]
jwe
parents:
diff changeset
17
9a4c07481e61 [project @ 1993-08-08 01:20:23 by jwe]
jwe
parents:
diff changeset
18 You should have received a copy of the GNU General Public License
7016
93c65f2a5668 [project @ 2007-10-12 06:40:56 by jwe]
jwe
parents: 5972
diff changeset
19 along with Octave; see the file COPYING. If not, see
93c65f2a5668 [project @ 2007-10-12 06:40:56 by jwe]
jwe
parents: 5972
diff changeset
20 <http://www.gnu.org/licenses/>.
3
9a4c07481e61 [project @ 1993-08-08 01:20:23 by jwe]
jwe
parents:
diff changeset
21
9a4c07481e61 [project @ 1993-08-08 01:20:23 by jwe]
jwe
parents:
diff changeset
22 */
9a4c07481e61 [project @ 1993-08-08 01:20:23 by jwe]
jwe
parents:
diff changeset
23
2828
92826d6e8bd9 [project @ 1997-03-25 23:41:41 by jwe]
jwe
parents: 2811
diff changeset
24 #if !defined (octave_mx_inlines_h)
92826d6e8bd9 [project @ 1997-03-25 23:41:41 by jwe]
jwe
parents: 2811
diff changeset
25 #define octave_mx_inlines_h 1
2804
eedc2f3f61f7 [project @ 1997-03-11 04:34:50 by jwe]
jwe
parents: 2386
diff changeset
26
eedc2f3f61f7 [project @ 1997-03-11 04:34:50 by jwe]
jwe
parents: 2386
diff changeset
27 #include <cstddef>
8650
a1ae2aae903e abs,real,imag,conj: use code from mx-inlines rather than the generic map
Jaroslav Hajek <highegg@gmail.com>
parents: 8380
diff changeset
28 #include <cmath>
2804
eedc2f3f61f7 [project @ 1997-03-11 04:34:50 by jwe]
jwe
parents: 2386
diff changeset
29
5525
558c69736dc0 [project @ 2005-11-01 00:49:50 by jwe]
jwe
parents: 5524
diff changeset
30 #include "quit.h"
558c69736dc0 [project @ 2005-11-01 00:49:50 by jwe]
jwe
parents: 5524
diff changeset
31
1650
23aa282707e8 [project @ 1995-12-20 06:53:12 by jwe]
jwe
parents: 1574
diff changeset
32 #include "oct-cmplx.h"
461
00f8b2242a18 [project @ 1994-06-06 00:45:57 by jwe]
jwe
parents: 238
diff changeset
33
8380
dbe67764e628 fix & improve speed of diagonal matrix multiplication
Jaroslav Hajek <highegg@gmail.com>
parents: 7789
diff changeset
34 template <class R, class S>
dbe67764e628 fix & improve speed of diagonal matrix multiplication
Jaroslav Hajek <highegg@gmail.com>
parents: 7789
diff changeset
35 inline void
dbe67764e628 fix & improve speed of diagonal matrix multiplication
Jaroslav Hajek <highegg@gmail.com>
parents: 7789
diff changeset
36 mx_inline_fill_vs (R *r, size_t n, S s)
dbe67764e628 fix & improve speed of diagonal matrix multiplication
Jaroslav Hajek <highegg@gmail.com>
parents: 7789
diff changeset
37 {
dbe67764e628 fix & improve speed of diagonal matrix multiplication
Jaroslav Hajek <highegg@gmail.com>
parents: 7789
diff changeset
38 for (size_t i = 0; i < n; i++)
dbe67764e628 fix & improve speed of diagonal matrix multiplication
Jaroslav Hajek <highegg@gmail.com>
parents: 7789
diff changeset
39 r[i] = s;
dbe67764e628 fix & improve speed of diagonal matrix multiplication
Jaroslav Hajek <highegg@gmail.com>
parents: 7789
diff changeset
40 }
dbe67764e628 fix & improve speed of diagonal matrix multiplication
Jaroslav Hajek <highegg@gmail.com>
parents: 7789
diff changeset
41
2811
1dd37f97364a [project @ 1997-03-12 23:06:13 by jwe]
jwe
parents: 2804
diff changeset
42 #define VS_OP_FCN(F, OP) \
1dd37f97364a [project @ 1997-03-12 23:06:13 by jwe]
jwe
parents: 2804
diff changeset
43 template <class R, class V, class S> \
3262
eaa639880b51 [project @ 1999-08-20 19:06:48 by jwe]
jwe
parents: 3107
diff changeset
44 inline void \
2811
1dd37f97364a [project @ 1997-03-12 23:06:13 by jwe]
jwe
parents: 2804
diff changeset
45 F ## _vs (R *r, const V *v, size_t n, S s) \
1dd37f97364a [project @ 1997-03-12 23:06:13 by jwe]
jwe
parents: 2804
diff changeset
46 { \
1dd37f97364a [project @ 1997-03-12 23:06:13 by jwe]
jwe
parents: 2804
diff changeset
47 for (size_t i = 0; i < n; i++) \
1dd37f97364a [project @ 1997-03-12 23:06:13 by jwe]
jwe
parents: 2804
diff changeset
48 r[i] = v[i] OP s; \
1dd37f97364a [project @ 1997-03-12 23:06:13 by jwe]
jwe
parents: 2804
diff changeset
49 }
1dd37f97364a [project @ 1997-03-12 23:06:13 by jwe]
jwe
parents: 2804
diff changeset
50
3769
7c8e3c42ed04 [project @ 2001-01-31 22:15:51 by jwe]
jwe
parents: 3504
diff changeset
51 VS_OP_FCN (mx_inline_add, +)
7c8e3c42ed04 [project @ 2001-01-31 22:15:51 by jwe]
jwe
parents: 3504
diff changeset
52 VS_OP_FCN (mx_inline_subtract, -)
7c8e3c42ed04 [project @ 2001-01-31 22:15:51 by jwe]
jwe
parents: 3504
diff changeset
53 VS_OP_FCN (mx_inline_multiply, *)
7c8e3c42ed04 [project @ 2001-01-31 22:15:51 by jwe]
jwe
parents: 3504
diff changeset
54 VS_OP_FCN (mx_inline_divide, /)
3
9a4c07481e61 [project @ 1993-08-08 01:20:23 by jwe]
jwe
parents:
diff changeset
55
2804
eedc2f3f61f7 [project @ 1997-03-11 04:34:50 by jwe]
jwe
parents: 2386
diff changeset
56 #define VS_OP(F, OP, R, V, S) \
eedc2f3f61f7 [project @ 1997-03-11 04:34:50 by jwe]
jwe
parents: 2386
diff changeset
57 static inline R * \
eedc2f3f61f7 [project @ 1997-03-11 04:34:50 by jwe]
jwe
parents: 2386
diff changeset
58 F (const V *v, size_t n, S s) \
eedc2f3f61f7 [project @ 1997-03-11 04:34:50 by jwe]
jwe
parents: 2386
diff changeset
59 { \
eedc2f3f61f7 [project @ 1997-03-11 04:34:50 by jwe]
jwe
parents: 2386
diff changeset
60 R *r = 0; \
eedc2f3f61f7 [project @ 1997-03-11 04:34:50 by jwe]
jwe
parents: 2386
diff changeset
61 if (n > 0) \
eedc2f3f61f7 [project @ 1997-03-11 04:34:50 by jwe]
jwe
parents: 2386
diff changeset
62 { \
eedc2f3f61f7 [project @ 1997-03-11 04:34:50 by jwe]
jwe
parents: 2386
diff changeset
63 r = new R [n]; \
2811
1dd37f97364a [project @ 1997-03-12 23:06:13 by jwe]
jwe
parents: 2804
diff changeset
64 F ## _vs (r, v, n, s); \
2804
eedc2f3f61f7 [project @ 1997-03-11 04:34:50 by jwe]
jwe
parents: 2386
diff changeset
65 } \
eedc2f3f61f7 [project @ 1997-03-11 04:34:50 by jwe]
jwe
parents: 2386
diff changeset
66 return r; \
eedc2f3f61f7 [project @ 1997-03-11 04:34:50 by jwe]
jwe
parents: 2386
diff changeset
67 }
3
9a4c07481e61 [project @ 1993-08-08 01:20:23 by jwe]
jwe
parents:
diff changeset
68
2804
eedc2f3f61f7 [project @ 1997-03-11 04:34:50 by jwe]
jwe
parents: 2386
diff changeset
69 #define VS_OPS(R, V, S) \
3769
7c8e3c42ed04 [project @ 2001-01-31 22:15:51 by jwe]
jwe
parents: 3504
diff changeset
70 VS_OP (mx_inline_add, +, R, V, S) \
7c8e3c42ed04 [project @ 2001-01-31 22:15:51 by jwe]
jwe
parents: 3504
diff changeset
71 VS_OP (mx_inline_subtract, -, R, V, S) \
7c8e3c42ed04 [project @ 2001-01-31 22:15:51 by jwe]
jwe
parents: 3504
diff changeset
72 VS_OP (mx_inline_multiply, *, R, V, S) \
7c8e3c42ed04 [project @ 2001-01-31 22:15:51 by jwe]
jwe
parents: 3504
diff changeset
73 VS_OP (mx_inline_divide, /, R, V, S)
3
9a4c07481e61 [project @ 1993-08-08 01:20:23 by jwe]
jwe
parents:
diff changeset
74
2804
eedc2f3f61f7 [project @ 1997-03-11 04:34:50 by jwe]
jwe
parents: 2386
diff changeset
75 VS_OPS (double, double, double)
eedc2f3f61f7 [project @ 1997-03-11 04:34:50 by jwe]
jwe
parents: 2386
diff changeset
76 VS_OPS (Complex, double, Complex)
eedc2f3f61f7 [project @ 1997-03-11 04:34:50 by jwe]
jwe
parents: 2386
diff changeset
77 VS_OPS (Complex, Complex, double)
eedc2f3f61f7 [project @ 1997-03-11 04:34:50 by jwe]
jwe
parents: 2386
diff changeset
78 VS_OPS (Complex, Complex, Complex)
3
9a4c07481e61 [project @ 1993-08-08 01:20:23 by jwe]
jwe
parents:
diff changeset
79
7789
82be108cc558 First attempt at single precision tyeps
David Bateman <dbateman@free.fr>
parents: 7017
diff changeset
80 VS_OPS (float, float, float)
82be108cc558 First attempt at single precision tyeps
David Bateman <dbateman@free.fr>
parents: 7017
diff changeset
81 VS_OPS (FloatComplex, float, FloatComplex)
82be108cc558 First attempt at single precision tyeps
David Bateman <dbateman@free.fr>
parents: 7017
diff changeset
82 VS_OPS (FloatComplex, FloatComplex, float)
82be108cc558 First attempt at single precision tyeps
David Bateman <dbateman@free.fr>
parents: 7017
diff changeset
83 VS_OPS (FloatComplex, FloatComplex, FloatComplex)
82be108cc558 First attempt at single precision tyeps
David Bateman <dbateman@free.fr>
parents: 7017
diff changeset
84
2811
1dd37f97364a [project @ 1997-03-12 23:06:13 by jwe]
jwe
parents: 2804
diff changeset
85 #define SV_OP_FCN(F, OP) \
1dd37f97364a [project @ 1997-03-12 23:06:13 by jwe]
jwe
parents: 2804
diff changeset
86 template <class R, class S, class V> \
3262
eaa639880b51 [project @ 1999-08-20 19:06:48 by jwe]
jwe
parents: 3107
diff changeset
87 inline void \
2811
1dd37f97364a [project @ 1997-03-12 23:06:13 by jwe]
jwe
parents: 2804
diff changeset
88 F ## _sv (R *r, S s, const V *v, size_t n) \
1dd37f97364a [project @ 1997-03-12 23:06:13 by jwe]
jwe
parents: 2804
diff changeset
89 { \
1dd37f97364a [project @ 1997-03-12 23:06:13 by jwe]
jwe
parents: 2804
diff changeset
90 for (size_t i = 0; i < n; i++) \
1dd37f97364a [project @ 1997-03-12 23:06:13 by jwe]
jwe
parents: 2804
diff changeset
91 r[i] = s OP v[i]; \
1dd37f97364a [project @ 1997-03-12 23:06:13 by jwe]
jwe
parents: 2804
diff changeset
92 } \
1dd37f97364a [project @ 1997-03-12 23:06:13 by jwe]
jwe
parents: 2804
diff changeset
93
3769
7c8e3c42ed04 [project @ 2001-01-31 22:15:51 by jwe]
jwe
parents: 3504
diff changeset
94 SV_OP_FCN (mx_inline_add, +)
7c8e3c42ed04 [project @ 2001-01-31 22:15:51 by jwe]
jwe
parents: 3504
diff changeset
95 SV_OP_FCN (mx_inline_subtract, -)
7c8e3c42ed04 [project @ 2001-01-31 22:15:51 by jwe]
jwe
parents: 3504
diff changeset
96 SV_OP_FCN (mx_inline_multiply, *)
7c8e3c42ed04 [project @ 2001-01-31 22:15:51 by jwe]
jwe
parents: 3504
diff changeset
97 SV_OP_FCN (mx_inline_divide, /)
2811
1dd37f97364a [project @ 1997-03-12 23:06:13 by jwe]
jwe
parents: 2804
diff changeset
98
2804
eedc2f3f61f7 [project @ 1997-03-11 04:34:50 by jwe]
jwe
parents: 2386
diff changeset
99 #define SV_OP(F, OP, R, S, V) \
eedc2f3f61f7 [project @ 1997-03-11 04:34:50 by jwe]
jwe
parents: 2386
diff changeset
100 static inline R * \
eedc2f3f61f7 [project @ 1997-03-11 04:34:50 by jwe]
jwe
parents: 2386
diff changeset
101 F (S s, const V *v, size_t n) \
eedc2f3f61f7 [project @ 1997-03-11 04:34:50 by jwe]
jwe
parents: 2386
diff changeset
102 { \
eedc2f3f61f7 [project @ 1997-03-11 04:34:50 by jwe]
jwe
parents: 2386
diff changeset
103 R *r = 0; \
eedc2f3f61f7 [project @ 1997-03-11 04:34:50 by jwe]
jwe
parents: 2386
diff changeset
104 if (n > 0) \
eedc2f3f61f7 [project @ 1997-03-11 04:34:50 by jwe]
jwe
parents: 2386
diff changeset
105 { \
eedc2f3f61f7 [project @ 1997-03-11 04:34:50 by jwe]
jwe
parents: 2386
diff changeset
106 r = new R [n]; \
2811
1dd37f97364a [project @ 1997-03-12 23:06:13 by jwe]
jwe
parents: 2804
diff changeset
107 F ## _sv (r, s, v, n); \
2804
eedc2f3f61f7 [project @ 1997-03-11 04:34:50 by jwe]
jwe
parents: 2386
diff changeset
108 } \
eedc2f3f61f7 [project @ 1997-03-11 04:34:50 by jwe]
jwe
parents: 2386
diff changeset
109 return r; \
eedc2f3f61f7 [project @ 1997-03-11 04:34:50 by jwe]
jwe
parents: 2386
diff changeset
110 }
3
9a4c07481e61 [project @ 1993-08-08 01:20:23 by jwe]
jwe
parents:
diff changeset
111
2804
eedc2f3f61f7 [project @ 1997-03-11 04:34:50 by jwe]
jwe
parents: 2386
diff changeset
112 #define SV_OPS(R, S, V) \
3769
7c8e3c42ed04 [project @ 2001-01-31 22:15:51 by jwe]
jwe
parents: 3504
diff changeset
113 SV_OP (mx_inline_add, +, R, S, V) \
7c8e3c42ed04 [project @ 2001-01-31 22:15:51 by jwe]
jwe
parents: 3504
diff changeset
114 SV_OP (mx_inline_subtract, -, R, S, V) \
7c8e3c42ed04 [project @ 2001-01-31 22:15:51 by jwe]
jwe
parents: 3504
diff changeset
115 SV_OP (mx_inline_multiply, *, R, S, V) \
7c8e3c42ed04 [project @ 2001-01-31 22:15:51 by jwe]
jwe
parents: 3504
diff changeset
116 SV_OP (mx_inline_divide, /, R, S, V)
3
9a4c07481e61 [project @ 1993-08-08 01:20:23 by jwe]
jwe
parents:
diff changeset
117
2804
eedc2f3f61f7 [project @ 1997-03-11 04:34:50 by jwe]
jwe
parents: 2386
diff changeset
118 SV_OPS (double, double, double)
eedc2f3f61f7 [project @ 1997-03-11 04:34:50 by jwe]
jwe
parents: 2386
diff changeset
119 SV_OPS (Complex, double, Complex)
eedc2f3f61f7 [project @ 1997-03-11 04:34:50 by jwe]
jwe
parents: 2386
diff changeset
120 SV_OPS (Complex, Complex, double)
eedc2f3f61f7 [project @ 1997-03-11 04:34:50 by jwe]
jwe
parents: 2386
diff changeset
121 SV_OPS (Complex, Complex, Complex)
3
9a4c07481e61 [project @ 1993-08-08 01:20:23 by jwe]
jwe
parents:
diff changeset
122
7789
82be108cc558 First attempt at single precision tyeps
David Bateman <dbateman@free.fr>
parents: 7017
diff changeset
123 SV_OPS (float, float, float)
82be108cc558 First attempt at single precision tyeps
David Bateman <dbateman@free.fr>
parents: 7017
diff changeset
124 SV_OPS (FloatComplex, float, FloatComplex)
82be108cc558 First attempt at single precision tyeps
David Bateman <dbateman@free.fr>
parents: 7017
diff changeset
125 SV_OPS (FloatComplex, FloatComplex, float)
82be108cc558 First attempt at single precision tyeps
David Bateman <dbateman@free.fr>
parents: 7017
diff changeset
126 SV_OPS (FloatComplex, FloatComplex, FloatComplex)
82be108cc558 First attempt at single precision tyeps
David Bateman <dbateman@free.fr>
parents: 7017
diff changeset
127
2811
1dd37f97364a [project @ 1997-03-12 23:06:13 by jwe]
jwe
parents: 2804
diff changeset
128 #define VV_OP_FCN(F, OP) \
1dd37f97364a [project @ 1997-03-12 23:06:13 by jwe]
jwe
parents: 2804
diff changeset
129 template <class R, class T1, class T2> \
3262
eaa639880b51 [project @ 1999-08-20 19:06:48 by jwe]
jwe
parents: 3107
diff changeset
130 inline void \
2811
1dd37f97364a [project @ 1997-03-12 23:06:13 by jwe]
jwe
parents: 2804
diff changeset
131 F ## _vv (R *r, const T1 *v1, const T2 *v2, size_t n) \
1dd37f97364a [project @ 1997-03-12 23:06:13 by jwe]
jwe
parents: 2804
diff changeset
132 { \
1dd37f97364a [project @ 1997-03-12 23:06:13 by jwe]
jwe
parents: 2804
diff changeset
133 for (size_t i = 0; i < n; i++) \
1dd37f97364a [project @ 1997-03-12 23:06:13 by jwe]
jwe
parents: 2804
diff changeset
134 r[i] = v1[i] OP v2[i]; \
1dd37f97364a [project @ 1997-03-12 23:06:13 by jwe]
jwe
parents: 2804
diff changeset
135 } \
1dd37f97364a [project @ 1997-03-12 23:06:13 by jwe]
jwe
parents: 2804
diff changeset
136
3769
7c8e3c42ed04 [project @ 2001-01-31 22:15:51 by jwe]
jwe
parents: 3504
diff changeset
137 VV_OP_FCN (mx_inline_add, +)
7c8e3c42ed04 [project @ 2001-01-31 22:15:51 by jwe]
jwe
parents: 3504
diff changeset
138 VV_OP_FCN (mx_inline_subtract, -)
7c8e3c42ed04 [project @ 2001-01-31 22:15:51 by jwe]
jwe
parents: 3504
diff changeset
139 VV_OP_FCN (mx_inline_multiply, *)
7c8e3c42ed04 [project @ 2001-01-31 22:15:51 by jwe]
jwe
parents: 3504
diff changeset
140 VV_OP_FCN (mx_inline_divide, /)
2811
1dd37f97364a [project @ 1997-03-12 23:06:13 by jwe]
jwe
parents: 2804
diff changeset
141
2804
eedc2f3f61f7 [project @ 1997-03-11 04:34:50 by jwe]
jwe
parents: 2386
diff changeset
142 #define VV_OP(F, OP, R, T1, T2) \
eedc2f3f61f7 [project @ 1997-03-11 04:34:50 by jwe]
jwe
parents: 2386
diff changeset
143 static inline R * \
eedc2f3f61f7 [project @ 1997-03-11 04:34:50 by jwe]
jwe
parents: 2386
diff changeset
144 F (const T1 *v1, const T2 *v2, size_t n) \
eedc2f3f61f7 [project @ 1997-03-11 04:34:50 by jwe]
jwe
parents: 2386
diff changeset
145 { \
eedc2f3f61f7 [project @ 1997-03-11 04:34:50 by jwe]
jwe
parents: 2386
diff changeset
146 R *r = 0; \
eedc2f3f61f7 [project @ 1997-03-11 04:34:50 by jwe]
jwe
parents: 2386
diff changeset
147 if (n > 0) \
eedc2f3f61f7 [project @ 1997-03-11 04:34:50 by jwe]
jwe
parents: 2386
diff changeset
148 { \
eedc2f3f61f7 [project @ 1997-03-11 04:34:50 by jwe]
jwe
parents: 2386
diff changeset
149 r = new R [n]; \
2811
1dd37f97364a [project @ 1997-03-12 23:06:13 by jwe]
jwe
parents: 2804
diff changeset
150 F ## _vv (r, v1, v2, n); \
2804
eedc2f3f61f7 [project @ 1997-03-11 04:34:50 by jwe]
jwe
parents: 2386
diff changeset
151 } \
eedc2f3f61f7 [project @ 1997-03-11 04:34:50 by jwe]
jwe
parents: 2386
diff changeset
152 return r; \
eedc2f3f61f7 [project @ 1997-03-11 04:34:50 by jwe]
jwe
parents: 2386
diff changeset
153 }
3
9a4c07481e61 [project @ 1993-08-08 01:20:23 by jwe]
jwe
parents:
diff changeset
154
2804
eedc2f3f61f7 [project @ 1997-03-11 04:34:50 by jwe]
jwe
parents: 2386
diff changeset
155 #define VV_OPS(R, T1, T2) \
3769
7c8e3c42ed04 [project @ 2001-01-31 22:15:51 by jwe]
jwe
parents: 3504
diff changeset
156 VV_OP (mx_inline_add, +, R, T1, T2) \
7c8e3c42ed04 [project @ 2001-01-31 22:15:51 by jwe]
jwe
parents: 3504
diff changeset
157 VV_OP (mx_inline_subtract, -, R, T1, T2) \
7c8e3c42ed04 [project @ 2001-01-31 22:15:51 by jwe]
jwe
parents: 3504
diff changeset
158 VV_OP (mx_inline_multiply, *, R, T1, T2) \
7c8e3c42ed04 [project @ 2001-01-31 22:15:51 by jwe]
jwe
parents: 3504
diff changeset
159 VV_OP (mx_inline_divide, /, R, T1, T2)
3
9a4c07481e61 [project @ 1993-08-08 01:20:23 by jwe]
jwe
parents:
diff changeset
160
2804
eedc2f3f61f7 [project @ 1997-03-11 04:34:50 by jwe]
jwe
parents: 2386
diff changeset
161 VV_OPS (double, double, double)
eedc2f3f61f7 [project @ 1997-03-11 04:34:50 by jwe]
jwe
parents: 2386
diff changeset
162 VV_OPS (Complex, double, Complex)
eedc2f3f61f7 [project @ 1997-03-11 04:34:50 by jwe]
jwe
parents: 2386
diff changeset
163 VV_OPS (Complex, Complex, double)
eedc2f3f61f7 [project @ 1997-03-11 04:34:50 by jwe]
jwe
parents: 2386
diff changeset
164 VV_OPS (Complex, Complex, Complex)
3
9a4c07481e61 [project @ 1993-08-08 01:20:23 by jwe]
jwe
parents:
diff changeset
165
7789
82be108cc558 First attempt at single precision tyeps
David Bateman <dbateman@free.fr>
parents: 7017
diff changeset
166 VV_OPS (float, float, float)
82be108cc558 First attempt at single precision tyeps
David Bateman <dbateman@free.fr>
parents: 7017
diff changeset
167 VV_OPS (FloatComplex, float, FloatComplex)
82be108cc558 First attempt at single precision tyeps
David Bateman <dbateman@free.fr>
parents: 7017
diff changeset
168 VV_OPS (FloatComplex, FloatComplex, float)
82be108cc558 First attempt at single precision tyeps
David Bateman <dbateman@free.fr>
parents: 7017
diff changeset
169 VV_OPS (FloatComplex, FloatComplex, FloatComplex)
82be108cc558 First attempt at single precision tyeps
David Bateman <dbateman@free.fr>
parents: 7017
diff changeset
170
2804
eedc2f3f61f7 [project @ 1997-03-11 04:34:50 by jwe]
jwe
parents: 2386
diff changeset
171 #define VS_OP2(F, OP, V, S) \
eedc2f3f61f7 [project @ 1997-03-11 04:34:50 by jwe]
jwe
parents: 2386
diff changeset
172 static inline V * \
eedc2f3f61f7 [project @ 1997-03-11 04:34:50 by jwe]
jwe
parents: 2386
diff changeset
173 F (V *v, size_t n, S s) \
eedc2f3f61f7 [project @ 1997-03-11 04:34:50 by jwe]
jwe
parents: 2386
diff changeset
174 { \
eedc2f3f61f7 [project @ 1997-03-11 04:34:50 by jwe]
jwe
parents: 2386
diff changeset
175 for (size_t i = 0; i < n; i++) \
eedc2f3f61f7 [project @ 1997-03-11 04:34:50 by jwe]
jwe
parents: 2386
diff changeset
176 v[i] OP s; \
eedc2f3f61f7 [project @ 1997-03-11 04:34:50 by jwe]
jwe
parents: 2386
diff changeset
177 return v; \
eedc2f3f61f7 [project @ 1997-03-11 04:34:50 by jwe]
jwe
parents: 2386
diff changeset
178 }
3
9a4c07481e61 [project @ 1993-08-08 01:20:23 by jwe]
jwe
parents:
diff changeset
179
2804
eedc2f3f61f7 [project @ 1997-03-11 04:34:50 by jwe]
jwe
parents: 2386
diff changeset
180 #define VS_OP2S(V, S) \
3769
7c8e3c42ed04 [project @ 2001-01-31 22:15:51 by jwe]
jwe
parents: 3504
diff changeset
181 VS_OP2 (mx_inline_add2, +=, V, S) \
7c8e3c42ed04 [project @ 2001-01-31 22:15:51 by jwe]
jwe
parents: 3504
diff changeset
182 VS_OP2 (mx_inline_subtract2, -=, V, S) \
7c8e3c42ed04 [project @ 2001-01-31 22:15:51 by jwe]
jwe
parents: 3504
diff changeset
183 VS_OP2 (mx_inline_multiply2, *=, V, S) \
7c8e3c42ed04 [project @ 2001-01-31 22:15:51 by jwe]
jwe
parents: 3504
diff changeset
184 VS_OP2 (mx_inline_divide2, /=, V, S) \
7c8e3c42ed04 [project @ 2001-01-31 22:15:51 by jwe]
jwe
parents: 3504
diff changeset
185 VS_OP2 (mx_inline_copy, =, V, S)
3
9a4c07481e61 [project @ 1993-08-08 01:20:23 by jwe]
jwe
parents:
diff changeset
186
2804
eedc2f3f61f7 [project @ 1997-03-11 04:34:50 by jwe]
jwe
parents: 2386
diff changeset
187 VS_OP2S (double, double)
eedc2f3f61f7 [project @ 1997-03-11 04:34:50 by jwe]
jwe
parents: 2386
diff changeset
188 VS_OP2S (Complex, double)
eedc2f3f61f7 [project @ 1997-03-11 04:34:50 by jwe]
jwe
parents: 2386
diff changeset
189 VS_OP2S (Complex, Complex)
3
9a4c07481e61 [project @ 1993-08-08 01:20:23 by jwe]
jwe
parents:
diff changeset
190
7789
82be108cc558 First attempt at single precision tyeps
David Bateman <dbateman@free.fr>
parents: 7017
diff changeset
191 VS_OP2S (float, float)
82be108cc558 First attempt at single precision tyeps
David Bateman <dbateman@free.fr>
parents: 7017
diff changeset
192 VS_OP2S (FloatComplex, float)
82be108cc558 First attempt at single precision tyeps
David Bateman <dbateman@free.fr>
parents: 7017
diff changeset
193 VS_OP2S (FloatComplex, FloatComplex)
82be108cc558 First attempt at single precision tyeps
David Bateman <dbateman@free.fr>
parents: 7017
diff changeset
194
2804
eedc2f3f61f7 [project @ 1997-03-11 04:34:50 by jwe]
jwe
parents: 2386
diff changeset
195 #define VV_OP2(F, OP, T1, T2) \
eedc2f3f61f7 [project @ 1997-03-11 04:34:50 by jwe]
jwe
parents: 2386
diff changeset
196 static inline T1 * \
eedc2f3f61f7 [project @ 1997-03-11 04:34:50 by jwe]
jwe
parents: 2386
diff changeset
197 F (T1 *v1, const T2 *v2, size_t n) \
eedc2f3f61f7 [project @ 1997-03-11 04:34:50 by jwe]
jwe
parents: 2386
diff changeset
198 { \
eedc2f3f61f7 [project @ 1997-03-11 04:34:50 by jwe]
jwe
parents: 2386
diff changeset
199 for (size_t i = 0; i < n; i++) \
eedc2f3f61f7 [project @ 1997-03-11 04:34:50 by jwe]
jwe
parents: 2386
diff changeset
200 v1[i] OP v2[i]; \
eedc2f3f61f7 [project @ 1997-03-11 04:34:50 by jwe]
jwe
parents: 2386
diff changeset
201 return v1; \
eedc2f3f61f7 [project @ 1997-03-11 04:34:50 by jwe]
jwe
parents: 2386
diff changeset
202 }
3
9a4c07481e61 [project @ 1993-08-08 01:20:23 by jwe]
jwe
parents:
diff changeset
203
2804
eedc2f3f61f7 [project @ 1997-03-11 04:34:50 by jwe]
jwe
parents: 2386
diff changeset
204 #define VV_OP2S(T1, T2) \
3769
7c8e3c42ed04 [project @ 2001-01-31 22:15:51 by jwe]
jwe
parents: 3504
diff changeset
205 VV_OP2 (mx_inline_add2, +=, T1, T2) \
7c8e3c42ed04 [project @ 2001-01-31 22:15:51 by jwe]
jwe
parents: 3504
diff changeset
206 VV_OP2 (mx_inline_subtract2, -=, T1, T2) \
7c8e3c42ed04 [project @ 2001-01-31 22:15:51 by jwe]
jwe
parents: 3504
diff changeset
207 VV_OP2 (mx_inline_multiply2, *=, T1, T2) \
7c8e3c42ed04 [project @ 2001-01-31 22:15:51 by jwe]
jwe
parents: 3504
diff changeset
208 VV_OP2 (mx_inline_divide2, /=, T1, T2) \
7c8e3c42ed04 [project @ 2001-01-31 22:15:51 by jwe]
jwe
parents: 3504
diff changeset
209 VV_OP2 (mx_inline_copy, =, T1, T2)
3
9a4c07481e61 [project @ 1993-08-08 01:20:23 by jwe]
jwe
parents:
diff changeset
210
2804
eedc2f3f61f7 [project @ 1997-03-11 04:34:50 by jwe]
jwe
parents: 2386
diff changeset
211 VV_OP2S (double, double)
eedc2f3f61f7 [project @ 1997-03-11 04:34:50 by jwe]
jwe
parents: 2386
diff changeset
212 VV_OP2S (Complex, double)
eedc2f3f61f7 [project @ 1997-03-11 04:34:50 by jwe]
jwe
parents: 2386
diff changeset
213 VV_OP2S (Complex, Complex)
3
9a4c07481e61 [project @ 1993-08-08 01:20:23 by jwe]
jwe
parents:
diff changeset
214
7789
82be108cc558 First attempt at single precision tyeps
David Bateman <dbateman@free.fr>
parents: 7017
diff changeset
215 VV_OP2S (float, float)
82be108cc558 First attempt at single precision tyeps
David Bateman <dbateman@free.fr>
parents: 7017
diff changeset
216 VV_OP2S (FloatComplex, float)
82be108cc558 First attempt at single precision tyeps
David Bateman <dbateman@free.fr>
parents: 7017
diff changeset
217 VV_OP2S (FloatComplex, FloatComplex)
82be108cc558 First attempt at single precision tyeps
David Bateman <dbateman@free.fr>
parents: 7017
diff changeset
218
2804
eedc2f3f61f7 [project @ 1997-03-11 04:34:50 by jwe]
jwe
parents: 2386
diff changeset
219 #define OP_EQ_FCN(T1, T2) \
eedc2f3f61f7 [project @ 1997-03-11 04:34:50 by jwe]
jwe
parents: 2386
diff changeset
220 static inline bool \
3769
7c8e3c42ed04 [project @ 2001-01-31 22:15:51 by jwe]
jwe
parents: 3504
diff changeset
221 mx_inline_equal (const T1 *x, const T2 *y, size_t n) \
2804
eedc2f3f61f7 [project @ 1997-03-11 04:34:50 by jwe]
jwe
parents: 2386
diff changeset
222 { \
eedc2f3f61f7 [project @ 1997-03-11 04:34:50 by jwe]
jwe
parents: 2386
diff changeset
223 for (size_t i = 0; i < n; i++) \
eedc2f3f61f7 [project @ 1997-03-11 04:34:50 by jwe]
jwe
parents: 2386
diff changeset
224 if (x[i] != y[i]) \
eedc2f3f61f7 [project @ 1997-03-11 04:34:50 by jwe]
jwe
parents: 2386
diff changeset
225 return false; \
eedc2f3f61f7 [project @ 1997-03-11 04:34:50 by jwe]
jwe
parents: 2386
diff changeset
226 return true; \
eedc2f3f61f7 [project @ 1997-03-11 04:34:50 by jwe]
jwe
parents: 2386
diff changeset
227 }
3
9a4c07481e61 [project @ 1993-08-08 01:20:23 by jwe]
jwe
parents:
diff changeset
228
2828
92826d6e8bd9 [project @ 1997-03-25 23:41:41 by jwe]
jwe
parents: 2811
diff changeset
229 OP_EQ_FCN (bool, bool)
2804
eedc2f3f61f7 [project @ 1997-03-11 04:34:50 by jwe]
jwe
parents: 2386
diff changeset
230 OP_EQ_FCN (char, char)
eedc2f3f61f7 [project @ 1997-03-11 04:34:50 by jwe]
jwe
parents: 2386
diff changeset
231 OP_EQ_FCN (double, double)
eedc2f3f61f7 [project @ 1997-03-11 04:34:50 by jwe]
jwe
parents: 2386
diff changeset
232 OP_EQ_FCN (Complex, Complex)
7789
82be108cc558 First attempt at single precision tyeps
David Bateman <dbateman@free.fr>
parents: 7017
diff changeset
233 OP_EQ_FCN (float, float)
82be108cc558 First attempt at single precision tyeps
David Bateman <dbateman@free.fr>
parents: 7017
diff changeset
234 OP_EQ_FCN (FloatComplex, FloatComplex)
3
9a4c07481e61 [project @ 1993-08-08 01:20:23 by jwe]
jwe
parents:
diff changeset
235
2804
eedc2f3f61f7 [project @ 1997-03-11 04:34:50 by jwe]
jwe
parents: 2386
diff changeset
236 #define OP_DUP_FCN(OP, F, R, T) \
eedc2f3f61f7 [project @ 1997-03-11 04:34:50 by jwe]
jwe
parents: 2386
diff changeset
237 static inline R * \
eedc2f3f61f7 [project @ 1997-03-11 04:34:50 by jwe]
jwe
parents: 2386
diff changeset
238 F (const T *x, size_t n) \
eedc2f3f61f7 [project @ 1997-03-11 04:34:50 by jwe]
jwe
parents: 2386
diff changeset
239 { \
eedc2f3f61f7 [project @ 1997-03-11 04:34:50 by jwe]
jwe
parents: 2386
diff changeset
240 R *r = 0; \
eedc2f3f61f7 [project @ 1997-03-11 04:34:50 by jwe]
jwe
parents: 2386
diff changeset
241 if (n > 0) \
eedc2f3f61f7 [project @ 1997-03-11 04:34:50 by jwe]
jwe
parents: 2386
diff changeset
242 { \
eedc2f3f61f7 [project @ 1997-03-11 04:34:50 by jwe]
jwe
parents: 2386
diff changeset
243 r = new R [n]; \
eedc2f3f61f7 [project @ 1997-03-11 04:34:50 by jwe]
jwe
parents: 2386
diff changeset
244 for (size_t i = 0; i < n; i++) \
eedc2f3f61f7 [project @ 1997-03-11 04:34:50 by jwe]
jwe
parents: 2386
diff changeset
245 r[i] = OP (x[i]); \
eedc2f3f61f7 [project @ 1997-03-11 04:34:50 by jwe]
jwe
parents: 2386
diff changeset
246 } \
eedc2f3f61f7 [project @ 1997-03-11 04:34:50 by jwe]
jwe
parents: 2386
diff changeset
247 return r; \
eedc2f3f61f7 [project @ 1997-03-11 04:34:50 by jwe]
jwe
parents: 2386
diff changeset
248 }
3
9a4c07481e61 [project @ 1993-08-08 01:20:23 by jwe]
jwe
parents:
diff changeset
249
3769
7c8e3c42ed04 [project @ 2001-01-31 22:15:51 by jwe]
jwe
parents: 3504
diff changeset
250 OP_DUP_FCN (, mx_inline_dup, double, double)
7c8e3c42ed04 [project @ 2001-01-31 22:15:51 by jwe]
jwe
parents: 3504
diff changeset
251 OP_DUP_FCN (, mx_inline_dup, Complex, Complex)
7789
82be108cc558 First attempt at single precision tyeps
David Bateman <dbateman@free.fr>
parents: 7017
diff changeset
252 OP_DUP_FCN (, mx_inline_dup, float, float)
82be108cc558 First attempt at single precision tyeps
David Bateman <dbateman@free.fr>
parents: 7017
diff changeset
253 OP_DUP_FCN (, mx_inline_dup, FloatComplex, FloatComplex)
3
9a4c07481e61 [project @ 1993-08-08 01:20:23 by jwe]
jwe
parents:
diff changeset
254
2804
eedc2f3f61f7 [project @ 1997-03-11 04:34:50 by jwe]
jwe
parents: 2386
diff changeset
255 // These should really return a bool *. Also, they should probably be
eedc2f3f61f7 [project @ 1997-03-11 04:34:50 by jwe]
jwe
parents: 2386
diff changeset
256 // in with a collection of other element-by-element boolean ops.
3769
7c8e3c42ed04 [project @ 2001-01-31 22:15:51 by jwe]
jwe
parents: 3504
diff changeset
257 OP_DUP_FCN (0.0 ==, mx_inline_not, double, double)
7c8e3c42ed04 [project @ 2001-01-31 22:15:51 by jwe]
jwe
parents: 3504
diff changeset
258 OP_DUP_FCN (0.0 ==, mx_inline_not, double, Complex)
3
9a4c07481e61 [project @ 1993-08-08 01:20:23 by jwe]
jwe
parents:
diff changeset
259
3769
7c8e3c42ed04 [project @ 2001-01-31 22:15:51 by jwe]
jwe
parents: 3504
diff changeset
260 OP_DUP_FCN (, mx_inline_make_complex, Complex, double)
2804
eedc2f3f61f7 [project @ 1997-03-11 04:34:50 by jwe]
jwe
parents: 2386
diff changeset
261
3769
7c8e3c42ed04 [project @ 2001-01-31 22:15:51 by jwe]
jwe
parents: 3504
diff changeset
262 OP_DUP_FCN (-, mx_inline_change_sign, double, double)
7c8e3c42ed04 [project @ 2001-01-31 22:15:51 by jwe]
jwe
parents: 3504
diff changeset
263 OP_DUP_FCN (-, mx_inline_change_sign, Complex, Complex)
3
9a4c07481e61 [project @ 1993-08-08 01:20:23 by jwe]
jwe
parents:
diff changeset
264
8650
a1ae2aae903e abs,real,imag,conj: use code from mx-inlines rather than the generic map
Jaroslav Hajek <highegg@gmail.com>
parents: 8380
diff changeset
265 OP_DUP_FCN (std::abs, mx_inline_fabs_dup, double, double)
a1ae2aae903e abs,real,imag,conj: use code from mx-inlines rather than the generic map
Jaroslav Hajek <highegg@gmail.com>
parents: 8380
diff changeset
266 OP_DUP_FCN (std::abs, mx_inline_cabs_dup, double, Complex)
3769
7c8e3c42ed04 [project @ 2001-01-31 22:15:51 by jwe]
jwe
parents: 3504
diff changeset
267 OP_DUP_FCN (real, mx_inline_real_dup, double, Complex)
7c8e3c42ed04 [project @ 2001-01-31 22:15:51 by jwe]
jwe
parents: 3504
diff changeset
268 OP_DUP_FCN (imag, mx_inline_imag_dup, double, Complex)
7c8e3c42ed04 [project @ 2001-01-31 22:15:51 by jwe]
jwe
parents: 3504
diff changeset
269 OP_DUP_FCN (conj, mx_inline_conj_dup, Complex, Complex)
3
9a4c07481e61 [project @ 1993-08-08 01:20:23 by jwe]
jwe
parents:
diff changeset
270
7789
82be108cc558 First attempt at single precision tyeps
David Bateman <dbateman@free.fr>
parents: 7017
diff changeset
271 OP_DUP_FCN (0.0 ==, mx_inline_not, float, float)
82be108cc558 First attempt at single precision tyeps
David Bateman <dbateman@free.fr>
parents: 7017
diff changeset
272 OP_DUP_FCN (static_cast<float>(0.0) ==, mx_inline_not, float, FloatComplex)
82be108cc558 First attempt at single precision tyeps
David Bateman <dbateman@free.fr>
parents: 7017
diff changeset
273
82be108cc558 First attempt at single precision tyeps
David Bateman <dbateman@free.fr>
parents: 7017
diff changeset
274 OP_DUP_FCN (, mx_inline_make_complex, FloatComplex, float)
82be108cc558 First attempt at single precision tyeps
David Bateman <dbateman@free.fr>
parents: 7017
diff changeset
275
82be108cc558 First attempt at single precision tyeps
David Bateman <dbateman@free.fr>
parents: 7017
diff changeset
276 OP_DUP_FCN (-, mx_inline_change_sign, float, float)
82be108cc558 First attempt at single precision tyeps
David Bateman <dbateman@free.fr>
parents: 7017
diff changeset
277 OP_DUP_FCN (-, mx_inline_change_sign, FloatComplex, FloatComplex)
82be108cc558 First attempt at single precision tyeps
David Bateman <dbateman@free.fr>
parents: 7017
diff changeset
278
8650
a1ae2aae903e abs,real,imag,conj: use code from mx-inlines rather than the generic map
Jaroslav Hajek <highegg@gmail.com>
parents: 8380
diff changeset
279 OP_DUP_FCN (std::abs, mx_inline_fabs_dup, float, float)
a1ae2aae903e abs,real,imag,conj: use code from mx-inlines rather than the generic map
Jaroslav Hajek <highegg@gmail.com>
parents: 8380
diff changeset
280 OP_DUP_FCN (std::abs, mx_inline_cabs_dup, float, FloatComplex)
7789
82be108cc558 First attempt at single precision tyeps
David Bateman <dbateman@free.fr>
parents: 7017
diff changeset
281 OP_DUP_FCN (real, mx_inline_real_dup, float, FloatComplex)
82be108cc558 First attempt at single precision tyeps
David Bateman <dbateman@free.fr>
parents: 7017
diff changeset
282 OP_DUP_FCN (imag, mx_inline_imag_dup, float, FloatComplex)
82be108cc558 First attempt at single precision tyeps
David Bateman <dbateman@free.fr>
parents: 7017
diff changeset
283 OP_DUP_FCN (conj, mx_inline_conj_dup, FloatComplex, FloatComplex)
82be108cc558 First attempt at single precision tyeps
David Bateman <dbateman@free.fr>
parents: 7017
diff changeset
284
8736
53b4fdeacc2e improve reduction functions
Jaroslav Hajek <highegg@gmail.com>
parents: 8650
diff changeset
285 // NOTE: std::norm is NOT equivalent
53b4fdeacc2e improve reduction functions
Jaroslav Hajek <highegg@gmail.com>
parents: 8650
diff changeset
286 template <class T>
8743
1bd918cfb6e2 reimplement any & all using the new reduction code
Jaroslav Hajek <highegg@gmail.com>
parents: 8736
diff changeset
287 inline T cabsq (const std::complex<T>& c)
8736
53b4fdeacc2e improve reduction functions
Jaroslav Hajek <highegg@gmail.com>
parents: 8650
diff changeset
288 { return c.real () * c.real () + c.imag () * c.imag (); }
53b4fdeacc2e improve reduction functions
Jaroslav Hajek <highegg@gmail.com>
parents: 8650
diff changeset
289
53b4fdeacc2e improve reduction functions
Jaroslav Hajek <highegg@gmail.com>
parents: 8650
diff changeset
290 #define OP_RED_SUM(ac, el) ac += el
53b4fdeacc2e improve reduction functions
Jaroslav Hajek <highegg@gmail.com>
parents: 8650
diff changeset
291 #define OP_RED_PROD(ac, el) ac *= el
53b4fdeacc2e improve reduction functions
Jaroslav Hajek <highegg@gmail.com>
parents: 8650
diff changeset
292 #define OP_RED_SUMSQ(ac, el) ac += el*el
53b4fdeacc2e improve reduction functions
Jaroslav Hajek <highegg@gmail.com>
parents: 8650
diff changeset
293 #define OP_RED_SUMSQC(ac, el) ac += cabsq (el)
53b4fdeacc2e improve reduction functions
Jaroslav Hajek <highegg@gmail.com>
parents: 8650
diff changeset
294
8743
1bd918cfb6e2 reimplement any & all using the new reduction code
Jaroslav Hajek <highegg@gmail.com>
parents: 8736
diff changeset
295 // default. works for integers and bool.
1bd918cfb6e2 reimplement any & all using the new reduction code
Jaroslav Hajek <highegg@gmail.com>
parents: 8736
diff changeset
296 template <class T>
1bd918cfb6e2 reimplement any & all using the new reduction code
Jaroslav Hajek <highegg@gmail.com>
parents: 8736
diff changeset
297 inline bool xis_true (T x) { return x; }
1bd918cfb6e2 reimplement any & all using the new reduction code
Jaroslav Hajek <highegg@gmail.com>
parents: 8736
diff changeset
298 template <class T>
1bd918cfb6e2 reimplement any & all using the new reduction code
Jaroslav Hajek <highegg@gmail.com>
parents: 8736
diff changeset
299 inline bool xis_false (T x) { return ! x; }
1bd918cfb6e2 reimplement any & all using the new reduction code
Jaroslav Hajek <highegg@gmail.com>
parents: 8736
diff changeset
300 // for octave_ints
1bd918cfb6e2 reimplement any & all using the new reduction code
Jaroslav Hajek <highegg@gmail.com>
parents: 8736
diff changeset
301 template <class T>
1bd918cfb6e2 reimplement any & all using the new reduction code
Jaroslav Hajek <highegg@gmail.com>
parents: 8736
diff changeset
302 inline bool xis_true (const octave_int<T>& x) { return x.value (); }
1bd918cfb6e2 reimplement any & all using the new reduction code
Jaroslav Hajek <highegg@gmail.com>
parents: 8736
diff changeset
303 template <class T>
1bd918cfb6e2 reimplement any & all using the new reduction code
Jaroslav Hajek <highegg@gmail.com>
parents: 8736
diff changeset
304 inline bool xis_false (const octave_int<T>& x) { return ! x.value (); }
1bd918cfb6e2 reimplement any & all using the new reduction code
Jaroslav Hajek <highegg@gmail.com>
parents: 8736
diff changeset
305 // for reals, we want to ignore NaNs.
1bd918cfb6e2 reimplement any & all using the new reduction code
Jaroslav Hajek <highegg@gmail.com>
parents: 8736
diff changeset
306 inline bool xis_true (double x) { return ! xisnan (x) && x != 0.0; }
1bd918cfb6e2 reimplement any & all using the new reduction code
Jaroslav Hajek <highegg@gmail.com>
parents: 8736
diff changeset
307 inline bool xis_false (double x) { return x == 0.0; }
1bd918cfb6e2 reimplement any & all using the new reduction code
Jaroslav Hajek <highegg@gmail.com>
parents: 8736
diff changeset
308 inline bool xis_true (float x) { return ! xisnan (x) && x != 0.0f; }
1bd918cfb6e2 reimplement any & all using the new reduction code
Jaroslav Hajek <highegg@gmail.com>
parents: 8736
diff changeset
309 inline bool xis_false (float x) { return x == 0.0f; }
1bd918cfb6e2 reimplement any & all using the new reduction code
Jaroslav Hajek <highegg@gmail.com>
parents: 8736
diff changeset
310 // Ditto for complex.
1bd918cfb6e2 reimplement any & all using the new reduction code
Jaroslav Hajek <highegg@gmail.com>
parents: 8736
diff changeset
311 inline bool xis_true (const Complex& x) { return ! xisnan (x) && x != 0.0; }
1bd918cfb6e2 reimplement any & all using the new reduction code
Jaroslav Hajek <highegg@gmail.com>
parents: 8736
diff changeset
312 inline bool xis_false (const Complex& x) { return x == 0.0; }
1bd918cfb6e2 reimplement any & all using the new reduction code
Jaroslav Hajek <highegg@gmail.com>
parents: 8736
diff changeset
313 inline bool xis_true (const FloatComplex& x) { return ! xisnan (x) && x != 0.0f; }
1bd918cfb6e2 reimplement any & all using the new reduction code
Jaroslav Hajek <highegg@gmail.com>
parents: 8736
diff changeset
314 inline bool xis_false (const FloatComplex& x) { return x == 0.0f; }
1bd918cfb6e2 reimplement any & all using the new reduction code
Jaroslav Hajek <highegg@gmail.com>
parents: 8736
diff changeset
315
1bd918cfb6e2 reimplement any & all using the new reduction code
Jaroslav Hajek <highegg@gmail.com>
parents: 8736
diff changeset
316 // The following two implement a simple short-circuiting.
1bd918cfb6e2 reimplement any & all using the new reduction code
Jaroslav Hajek <highegg@gmail.com>
parents: 8736
diff changeset
317 #define OP_RED_ANYC(ac, el) if (xis_true (el)) { ac = true; break; } else continue
1bd918cfb6e2 reimplement any & all using the new reduction code
Jaroslav Hajek <highegg@gmail.com>
parents: 8736
diff changeset
318 #define OP_RED_ALLC(ac, el) if (xis_false (el)) { ac = false; break; } else continue
1bd918cfb6e2 reimplement any & all using the new reduction code
Jaroslav Hajek <highegg@gmail.com>
parents: 8736
diff changeset
319
1bd918cfb6e2 reimplement any & all using the new reduction code
Jaroslav Hajek <highegg@gmail.com>
parents: 8736
diff changeset
320 // Row any/all reductions are a tradeoff - we traverse the array by
1bd918cfb6e2 reimplement any & all using the new reduction code
Jaroslav Hajek <highegg@gmail.com>
parents: 8736
diff changeset
321 // columns to gain cache coherence, but sacrifice short-circuiting for that.
1bd918cfb6e2 reimplement any & all using the new reduction code
Jaroslav Hajek <highegg@gmail.com>
parents: 8736
diff changeset
322 // For certain logical arrays, this could mean a significant loss.
1bd918cfb6e2 reimplement any & all using the new reduction code
Jaroslav Hajek <highegg@gmail.com>
parents: 8736
diff changeset
323 // A more sophisticated implementation could introduce a buffer of active
1bd918cfb6e2 reimplement any & all using the new reduction code
Jaroslav Hajek <highegg@gmail.com>
parents: 8736
diff changeset
324 // row indices to achieve both. Right now, I don't see the operation as
1bd918cfb6e2 reimplement any & all using the new reduction code
Jaroslav Hajek <highegg@gmail.com>
parents: 8736
diff changeset
325 // important enough.
1bd918cfb6e2 reimplement any & all using the new reduction code
Jaroslav Hajek <highegg@gmail.com>
parents: 8736
diff changeset
326
1bd918cfb6e2 reimplement any & all using the new reduction code
Jaroslav Hajek <highegg@gmail.com>
parents: 8736
diff changeset
327 #define OP_RED_ANYR(ac, el) if (xis_true (el)) ac = true
1bd918cfb6e2 reimplement any & all using the new reduction code
Jaroslav Hajek <highegg@gmail.com>
parents: 8736
diff changeset
328 #define OP_RED_ALLR(ac, el) if (xis_false (el)) ac = false
1bd918cfb6e2 reimplement any & all using the new reduction code
Jaroslav Hajek <highegg@gmail.com>
parents: 8736
diff changeset
329
1bd918cfb6e2 reimplement any & all using the new reduction code
Jaroslav Hajek <highegg@gmail.com>
parents: 8736
diff changeset
330 #define OP_RED_FCN(F, TSRC, TRES, OP, ZERO) \
8736
53b4fdeacc2e improve reduction functions
Jaroslav Hajek <highegg@gmail.com>
parents: 8650
diff changeset
331 template <class T> \
8743
1bd918cfb6e2 reimplement any & all using the new reduction code
Jaroslav Hajek <highegg@gmail.com>
parents: 8736
diff changeset
332 inline TRES \
8736
53b4fdeacc2e improve reduction functions
Jaroslav Hajek <highegg@gmail.com>
parents: 8650
diff changeset
333 F (const TSRC* v, octave_idx_type n) \
53b4fdeacc2e improve reduction functions
Jaroslav Hajek <highegg@gmail.com>
parents: 8650
diff changeset
334 { \
8743
1bd918cfb6e2 reimplement any & all using the new reduction code
Jaroslav Hajek <highegg@gmail.com>
parents: 8736
diff changeset
335 TRES ac = ZERO; \
8736
53b4fdeacc2e improve reduction functions
Jaroslav Hajek <highegg@gmail.com>
parents: 8650
diff changeset
336 for (octave_idx_type i = 0; i < n; i++) \
53b4fdeacc2e improve reduction functions
Jaroslav Hajek <highegg@gmail.com>
parents: 8650
diff changeset
337 OP(ac, v[i]); \
53b4fdeacc2e improve reduction functions
Jaroslav Hajek <highegg@gmail.com>
parents: 8650
diff changeset
338 return ac; \
53b4fdeacc2e improve reduction functions
Jaroslav Hajek <highegg@gmail.com>
parents: 8650
diff changeset
339 }
53b4fdeacc2e improve reduction functions
Jaroslav Hajek <highegg@gmail.com>
parents: 8650
diff changeset
340
8743
1bd918cfb6e2 reimplement any & all using the new reduction code
Jaroslav Hajek <highegg@gmail.com>
parents: 8736
diff changeset
341 OP_RED_FCN (mx_inline_sum, T, T, OP_RED_SUM, 0)
1bd918cfb6e2 reimplement any & all using the new reduction code
Jaroslav Hajek <highegg@gmail.com>
parents: 8736
diff changeset
342 OP_RED_FCN (mx_inline_prod, T, T, OP_RED_PROD, 1)
1bd918cfb6e2 reimplement any & all using the new reduction code
Jaroslav Hajek <highegg@gmail.com>
parents: 8736
diff changeset
343 OP_RED_FCN (mx_inline_sumsq, T, T, OP_RED_SUMSQ, 0)
1bd918cfb6e2 reimplement any & all using the new reduction code
Jaroslav Hajek <highegg@gmail.com>
parents: 8736
diff changeset
344 OP_RED_FCN (mx_inline_sumsq, std::complex<T>, T, OP_RED_SUMSQC, 0)
1bd918cfb6e2 reimplement any & all using the new reduction code
Jaroslav Hajek <highegg@gmail.com>
parents: 8736
diff changeset
345 OP_RED_FCN (mx_inline_any, T, bool, OP_RED_ANYC, false)
1bd918cfb6e2 reimplement any & all using the new reduction code
Jaroslav Hajek <highegg@gmail.com>
parents: 8736
diff changeset
346 OP_RED_FCN (mx_inline_all, T, bool, OP_RED_ALLC, true)
8736
53b4fdeacc2e improve reduction functions
Jaroslav Hajek <highegg@gmail.com>
parents: 8650
diff changeset
347
8743
1bd918cfb6e2 reimplement any & all using the new reduction code
Jaroslav Hajek <highegg@gmail.com>
parents: 8736
diff changeset
348
1bd918cfb6e2 reimplement any & all using the new reduction code
Jaroslav Hajek <highegg@gmail.com>
parents: 8736
diff changeset
349 #define OP_RED_FCN2(F, TSRC, TRES, OP, ZERO) \
8736
53b4fdeacc2e improve reduction functions
Jaroslav Hajek <highegg@gmail.com>
parents: 8650
diff changeset
350 template <class T> \
53b4fdeacc2e improve reduction functions
Jaroslav Hajek <highegg@gmail.com>
parents: 8650
diff changeset
351 inline void \
8743
1bd918cfb6e2 reimplement any & all using the new reduction code
Jaroslav Hajek <highegg@gmail.com>
parents: 8736
diff changeset
352 F (const TSRC* v, TRES *r, octave_idx_type m, octave_idx_type n) \
8736
53b4fdeacc2e improve reduction functions
Jaroslav Hajek <highegg@gmail.com>
parents: 8650
diff changeset
353 { \
53b4fdeacc2e improve reduction functions
Jaroslav Hajek <highegg@gmail.com>
parents: 8650
diff changeset
354 for (octave_idx_type i = 0; i < m; i++) \
53b4fdeacc2e improve reduction functions
Jaroslav Hajek <highegg@gmail.com>
parents: 8650
diff changeset
355 r[i] = ZERO; \
53b4fdeacc2e improve reduction functions
Jaroslav Hajek <highegg@gmail.com>
parents: 8650
diff changeset
356 for (octave_idx_type j = 0; j < n; j++) \
53b4fdeacc2e improve reduction functions
Jaroslav Hajek <highegg@gmail.com>
parents: 8650
diff changeset
357 { \
53b4fdeacc2e improve reduction functions
Jaroslav Hajek <highegg@gmail.com>
parents: 8650
diff changeset
358 for (octave_idx_type i = 0; i < m; i++) \
53b4fdeacc2e improve reduction functions
Jaroslav Hajek <highegg@gmail.com>
parents: 8650
diff changeset
359 OP(r[i], v[i]); \
53b4fdeacc2e improve reduction functions
Jaroslav Hajek <highegg@gmail.com>
parents: 8650
diff changeset
360 v += m; \
53b4fdeacc2e improve reduction functions
Jaroslav Hajek <highegg@gmail.com>
parents: 8650
diff changeset
361 } \
53b4fdeacc2e improve reduction functions
Jaroslav Hajek <highegg@gmail.com>
parents: 8650
diff changeset
362 }
53b4fdeacc2e improve reduction functions
Jaroslav Hajek <highegg@gmail.com>
parents: 8650
diff changeset
363
8743
1bd918cfb6e2 reimplement any & all using the new reduction code
Jaroslav Hajek <highegg@gmail.com>
parents: 8736
diff changeset
364 OP_RED_FCN2 (mx_inline_sum, T, T, OP_RED_SUM, 0)
1bd918cfb6e2 reimplement any & all using the new reduction code
Jaroslav Hajek <highegg@gmail.com>
parents: 8736
diff changeset
365 OP_RED_FCN2 (mx_inline_prod, T, T, OP_RED_PROD, 1)
1bd918cfb6e2 reimplement any & all using the new reduction code
Jaroslav Hajek <highegg@gmail.com>
parents: 8736
diff changeset
366 OP_RED_FCN2 (mx_inline_sumsq, T, T, OP_RED_SUMSQ, 0)
1bd918cfb6e2 reimplement any & all using the new reduction code
Jaroslav Hajek <highegg@gmail.com>
parents: 8736
diff changeset
367 OP_RED_FCN2 (mx_inline_sumsq, std::complex<T>, T, OP_RED_SUMSQC, 0)
1bd918cfb6e2 reimplement any & all using the new reduction code
Jaroslav Hajek <highegg@gmail.com>
parents: 8736
diff changeset
368 OP_RED_FCN2 (mx_inline_any, T, bool, OP_RED_ANYR, false)
1bd918cfb6e2 reimplement any & all using the new reduction code
Jaroslav Hajek <highegg@gmail.com>
parents: 8736
diff changeset
369 OP_RED_FCN2 (mx_inline_all, T, bool, OP_RED_ALLR, true)
8736
53b4fdeacc2e improve reduction functions
Jaroslav Hajek <highegg@gmail.com>
parents: 8650
diff changeset
370
8743
1bd918cfb6e2 reimplement any & all using the new reduction code
Jaroslav Hajek <highegg@gmail.com>
parents: 8736
diff changeset
371 #define OP_RED_FCNN(F, TSRC, TRES) \
8736
53b4fdeacc2e improve reduction functions
Jaroslav Hajek <highegg@gmail.com>
parents: 8650
diff changeset
372 template <class T> \
53b4fdeacc2e improve reduction functions
Jaroslav Hajek <highegg@gmail.com>
parents: 8650
diff changeset
373 inline void \
8743
1bd918cfb6e2 reimplement any & all using the new reduction code
Jaroslav Hajek <highegg@gmail.com>
parents: 8736
diff changeset
374 F (const TSRC *v, TRES *r, octave_idx_type l, \
8736
53b4fdeacc2e improve reduction functions
Jaroslav Hajek <highegg@gmail.com>
parents: 8650
diff changeset
375 octave_idx_type n, octave_idx_type u) \
53b4fdeacc2e improve reduction functions
Jaroslav Hajek <highegg@gmail.com>
parents: 8650
diff changeset
376 { \
53b4fdeacc2e improve reduction functions
Jaroslav Hajek <highegg@gmail.com>
parents: 8650
diff changeset
377 if (l == 1) \
53b4fdeacc2e improve reduction functions
Jaroslav Hajek <highegg@gmail.com>
parents: 8650
diff changeset
378 { \
53b4fdeacc2e improve reduction functions
Jaroslav Hajek <highegg@gmail.com>
parents: 8650
diff changeset
379 for (octave_idx_type i = 0; i < u; i++) \
53b4fdeacc2e improve reduction functions
Jaroslav Hajek <highegg@gmail.com>
parents: 8650
diff changeset
380 { \
53b4fdeacc2e improve reduction functions
Jaroslav Hajek <highegg@gmail.com>
parents: 8650
diff changeset
381 r[i] = F (v, n); \
53b4fdeacc2e improve reduction functions
Jaroslav Hajek <highegg@gmail.com>
parents: 8650
diff changeset
382 v += n; \
53b4fdeacc2e improve reduction functions
Jaroslav Hajek <highegg@gmail.com>
parents: 8650
diff changeset
383 } \
53b4fdeacc2e improve reduction functions
Jaroslav Hajek <highegg@gmail.com>
parents: 8650
diff changeset
384 } \
53b4fdeacc2e improve reduction functions
Jaroslav Hajek <highegg@gmail.com>
parents: 8650
diff changeset
385 else \
53b4fdeacc2e improve reduction functions
Jaroslav Hajek <highegg@gmail.com>
parents: 8650
diff changeset
386 { \
53b4fdeacc2e improve reduction functions
Jaroslav Hajek <highegg@gmail.com>
parents: 8650
diff changeset
387 for (octave_idx_type i = 0; i < u; i++) \
53b4fdeacc2e improve reduction functions
Jaroslav Hajek <highegg@gmail.com>
parents: 8650
diff changeset
388 { \
53b4fdeacc2e improve reduction functions
Jaroslav Hajek <highegg@gmail.com>
parents: 8650
diff changeset
389 F (v, r, l, n); \
53b4fdeacc2e improve reduction functions
Jaroslav Hajek <highegg@gmail.com>
parents: 8650
diff changeset
390 v += l*n; \
53b4fdeacc2e improve reduction functions
Jaroslav Hajek <highegg@gmail.com>
parents: 8650
diff changeset
391 r += l; \
53b4fdeacc2e improve reduction functions
Jaroslav Hajek <highegg@gmail.com>
parents: 8650
diff changeset
392 } \
53b4fdeacc2e improve reduction functions
Jaroslav Hajek <highegg@gmail.com>
parents: 8650
diff changeset
393 } \
53b4fdeacc2e improve reduction functions
Jaroslav Hajek <highegg@gmail.com>
parents: 8650
diff changeset
394 }
53b4fdeacc2e improve reduction functions
Jaroslav Hajek <highegg@gmail.com>
parents: 8650
diff changeset
395
8743
1bd918cfb6e2 reimplement any & all using the new reduction code
Jaroslav Hajek <highegg@gmail.com>
parents: 8736
diff changeset
396 OP_RED_FCNN (mx_inline_sum, T, T)
1bd918cfb6e2 reimplement any & all using the new reduction code
Jaroslav Hajek <highegg@gmail.com>
parents: 8736
diff changeset
397 OP_RED_FCNN (mx_inline_prod, T, T)
1bd918cfb6e2 reimplement any & all using the new reduction code
Jaroslav Hajek <highegg@gmail.com>
parents: 8736
diff changeset
398 OP_RED_FCNN (mx_inline_sumsq, T, T)
1bd918cfb6e2 reimplement any & all using the new reduction code
Jaroslav Hajek <highegg@gmail.com>
parents: 8736
diff changeset
399 OP_RED_FCNN (mx_inline_sumsq, std::complex<T>, T)
1bd918cfb6e2 reimplement any & all using the new reduction code
Jaroslav Hajek <highegg@gmail.com>
parents: 8736
diff changeset
400 OP_RED_FCNN (mx_inline_any, T, bool)
1bd918cfb6e2 reimplement any & all using the new reduction code
Jaroslav Hajek <highegg@gmail.com>
parents: 8736
diff changeset
401 OP_RED_FCNN (mx_inline_all, T, bool)
8736
53b4fdeacc2e improve reduction functions
Jaroslav Hajek <highegg@gmail.com>
parents: 8650
diff changeset
402
53b4fdeacc2e improve reduction functions
Jaroslav Hajek <highegg@gmail.com>
parents: 8650
diff changeset
403 #define OP_CUM_FCN(F, OP) \
53b4fdeacc2e improve reduction functions
Jaroslav Hajek <highegg@gmail.com>
parents: 8650
diff changeset
404 template <class T> \
53b4fdeacc2e improve reduction functions
Jaroslav Hajek <highegg@gmail.com>
parents: 8650
diff changeset
405 inline void \
53b4fdeacc2e improve reduction functions
Jaroslav Hajek <highegg@gmail.com>
parents: 8650
diff changeset
406 F (const T *v, T *r, octave_idx_type n) \
53b4fdeacc2e improve reduction functions
Jaroslav Hajek <highegg@gmail.com>
parents: 8650
diff changeset
407 { \
53b4fdeacc2e improve reduction functions
Jaroslav Hajek <highegg@gmail.com>
parents: 8650
diff changeset
408 if (n) \
53b4fdeacc2e improve reduction functions
Jaroslav Hajek <highegg@gmail.com>
parents: 8650
diff changeset
409 { \
53b4fdeacc2e improve reduction functions
Jaroslav Hajek <highegg@gmail.com>
parents: 8650
diff changeset
410 T t = r[0] = v[0]; \
53b4fdeacc2e improve reduction functions
Jaroslav Hajek <highegg@gmail.com>
parents: 8650
diff changeset
411 for (octave_idx_type i = 1; i < n; i++) \
53b4fdeacc2e improve reduction functions
Jaroslav Hajek <highegg@gmail.com>
parents: 8650
diff changeset
412 r[i] = t = t OP v[i]; \
53b4fdeacc2e improve reduction functions
Jaroslav Hajek <highegg@gmail.com>
parents: 8650
diff changeset
413 } \
53b4fdeacc2e improve reduction functions
Jaroslav Hajek <highegg@gmail.com>
parents: 8650
diff changeset
414 }
53b4fdeacc2e improve reduction functions
Jaroslav Hajek <highegg@gmail.com>
parents: 8650
diff changeset
415
53b4fdeacc2e improve reduction functions
Jaroslav Hajek <highegg@gmail.com>
parents: 8650
diff changeset
416 OP_CUM_FCN (mx_inline_cumsum, +)
53b4fdeacc2e improve reduction functions
Jaroslav Hajek <highegg@gmail.com>
parents: 8650
diff changeset
417 OP_CUM_FCN (mx_inline_cumprod, *)
53b4fdeacc2e improve reduction functions
Jaroslav Hajek <highegg@gmail.com>
parents: 8650
diff changeset
418
53b4fdeacc2e improve reduction functions
Jaroslav Hajek <highegg@gmail.com>
parents: 8650
diff changeset
419 #define OP_CUM_FCN2(F, OP) \
53b4fdeacc2e improve reduction functions
Jaroslav Hajek <highegg@gmail.com>
parents: 8650
diff changeset
420 template <class T> \
53b4fdeacc2e improve reduction functions
Jaroslav Hajek <highegg@gmail.com>
parents: 8650
diff changeset
421 inline void \
53b4fdeacc2e improve reduction functions
Jaroslav Hajek <highegg@gmail.com>
parents: 8650
diff changeset
422 F (const T *v, T *r, octave_idx_type m, octave_idx_type n) \
53b4fdeacc2e improve reduction functions
Jaroslav Hajek <highegg@gmail.com>
parents: 8650
diff changeset
423 { \
53b4fdeacc2e improve reduction functions
Jaroslav Hajek <highegg@gmail.com>
parents: 8650
diff changeset
424 if (n) \
53b4fdeacc2e improve reduction functions
Jaroslav Hajek <highegg@gmail.com>
parents: 8650
diff changeset
425 { \
53b4fdeacc2e improve reduction functions
Jaroslav Hajek <highegg@gmail.com>
parents: 8650
diff changeset
426 for (octave_idx_type i = 0; i < m; i++) \
53b4fdeacc2e improve reduction functions
Jaroslav Hajek <highegg@gmail.com>
parents: 8650
diff changeset
427 r[i] = v[i]; \
53b4fdeacc2e improve reduction functions
Jaroslav Hajek <highegg@gmail.com>
parents: 8650
diff changeset
428 const T *r0 = r; \
53b4fdeacc2e improve reduction functions
Jaroslav Hajek <highegg@gmail.com>
parents: 8650
diff changeset
429 for (octave_idx_type j = 1; j < n; j++) \
53b4fdeacc2e improve reduction functions
Jaroslav Hajek <highegg@gmail.com>
parents: 8650
diff changeset
430 { \
53b4fdeacc2e improve reduction functions
Jaroslav Hajek <highegg@gmail.com>
parents: 8650
diff changeset
431 r += m; v += m; \
53b4fdeacc2e improve reduction functions
Jaroslav Hajek <highegg@gmail.com>
parents: 8650
diff changeset
432 for (octave_idx_type i = 0; i < m; i++) \
53b4fdeacc2e improve reduction functions
Jaroslav Hajek <highegg@gmail.com>
parents: 8650
diff changeset
433 r[i] = v[i] OP r0[i]; \
53b4fdeacc2e improve reduction functions
Jaroslav Hajek <highegg@gmail.com>
parents: 8650
diff changeset
434 r0 += m; \
53b4fdeacc2e improve reduction functions
Jaroslav Hajek <highegg@gmail.com>
parents: 8650
diff changeset
435 } \
53b4fdeacc2e improve reduction functions
Jaroslav Hajek <highegg@gmail.com>
parents: 8650
diff changeset
436 } \
53b4fdeacc2e improve reduction functions
Jaroslav Hajek <highegg@gmail.com>
parents: 8650
diff changeset
437 }
53b4fdeacc2e improve reduction functions
Jaroslav Hajek <highegg@gmail.com>
parents: 8650
diff changeset
438
53b4fdeacc2e improve reduction functions
Jaroslav Hajek <highegg@gmail.com>
parents: 8650
diff changeset
439 OP_CUM_FCN2 (mx_inline_cumsum, +)
53b4fdeacc2e improve reduction functions
Jaroslav Hajek <highegg@gmail.com>
parents: 8650
diff changeset
440 OP_CUM_FCN2 (mx_inline_cumprod, *)
53b4fdeacc2e improve reduction functions
Jaroslav Hajek <highegg@gmail.com>
parents: 8650
diff changeset
441
53b4fdeacc2e improve reduction functions
Jaroslav Hajek <highegg@gmail.com>
parents: 8650
diff changeset
442 #define OP_CUM_FCNN(F) \
53b4fdeacc2e improve reduction functions
Jaroslav Hajek <highegg@gmail.com>
parents: 8650
diff changeset
443 template <class T> \
53b4fdeacc2e improve reduction functions
Jaroslav Hajek <highegg@gmail.com>
parents: 8650
diff changeset
444 inline void \
53b4fdeacc2e improve reduction functions
Jaroslav Hajek <highegg@gmail.com>
parents: 8650
diff changeset
445 F (const T *v, T *r, octave_idx_type l, \
53b4fdeacc2e improve reduction functions
Jaroslav Hajek <highegg@gmail.com>
parents: 8650
diff changeset
446 octave_idx_type n, octave_idx_type u) \
53b4fdeacc2e improve reduction functions
Jaroslav Hajek <highegg@gmail.com>
parents: 8650
diff changeset
447 { \
53b4fdeacc2e improve reduction functions
Jaroslav Hajek <highegg@gmail.com>
parents: 8650
diff changeset
448 if (l == 1) \
53b4fdeacc2e improve reduction functions
Jaroslav Hajek <highegg@gmail.com>
parents: 8650
diff changeset
449 { \
53b4fdeacc2e improve reduction functions
Jaroslav Hajek <highegg@gmail.com>
parents: 8650
diff changeset
450 for (octave_idx_type i = 0; i < u; i++) \
53b4fdeacc2e improve reduction functions
Jaroslav Hajek <highegg@gmail.com>
parents: 8650
diff changeset
451 { \
53b4fdeacc2e improve reduction functions
Jaroslav Hajek <highegg@gmail.com>
parents: 8650
diff changeset
452 F (v, r, n); \
53b4fdeacc2e improve reduction functions
Jaroslav Hajek <highegg@gmail.com>
parents: 8650
diff changeset
453 v += n; r += n; \
53b4fdeacc2e improve reduction functions
Jaroslav Hajek <highegg@gmail.com>
parents: 8650
diff changeset
454 } \
53b4fdeacc2e improve reduction functions
Jaroslav Hajek <highegg@gmail.com>
parents: 8650
diff changeset
455 } \
53b4fdeacc2e improve reduction functions
Jaroslav Hajek <highegg@gmail.com>
parents: 8650
diff changeset
456 else \
53b4fdeacc2e improve reduction functions
Jaroslav Hajek <highegg@gmail.com>
parents: 8650
diff changeset
457 { \
53b4fdeacc2e improve reduction functions
Jaroslav Hajek <highegg@gmail.com>
parents: 8650
diff changeset
458 for (octave_idx_type i = 0; i < u; i++) \
53b4fdeacc2e improve reduction functions
Jaroslav Hajek <highegg@gmail.com>
parents: 8650
diff changeset
459 { \
53b4fdeacc2e improve reduction functions
Jaroslav Hajek <highegg@gmail.com>
parents: 8650
diff changeset
460 F (v, r, l, n); \
53b4fdeacc2e improve reduction functions
Jaroslav Hajek <highegg@gmail.com>
parents: 8650
diff changeset
461 v += l*n; \
53b4fdeacc2e improve reduction functions
Jaroslav Hajek <highegg@gmail.com>
parents: 8650
diff changeset
462 r += l*n; \
53b4fdeacc2e improve reduction functions
Jaroslav Hajek <highegg@gmail.com>
parents: 8650
diff changeset
463 } \
53b4fdeacc2e improve reduction functions
Jaroslav Hajek <highegg@gmail.com>
parents: 8650
diff changeset
464 } \
53b4fdeacc2e improve reduction functions
Jaroslav Hajek <highegg@gmail.com>
parents: 8650
diff changeset
465 }
53b4fdeacc2e improve reduction functions
Jaroslav Hajek <highegg@gmail.com>
parents: 8650
diff changeset
466
53b4fdeacc2e improve reduction functions
Jaroslav Hajek <highegg@gmail.com>
parents: 8650
diff changeset
467 OP_CUM_FCNN (mx_inline_cumsum)
53b4fdeacc2e improve reduction functions
Jaroslav Hajek <highegg@gmail.com>
parents: 8650
diff changeset
468 OP_CUM_FCNN (mx_inline_cumprod)
53b4fdeacc2e improve reduction functions
Jaroslav Hajek <highegg@gmail.com>
parents: 8650
diff changeset
469
53b4fdeacc2e improve reduction functions
Jaroslav Hajek <highegg@gmail.com>
parents: 8650
diff changeset
470 // Assistant function
53b4fdeacc2e improve reduction functions
Jaroslav Hajek <highegg@gmail.com>
parents: 8650
diff changeset
471
53b4fdeacc2e improve reduction functions
Jaroslav Hajek <highegg@gmail.com>
parents: 8650
diff changeset
472 inline void
53b4fdeacc2e improve reduction functions
Jaroslav Hajek <highegg@gmail.com>
parents: 8650
diff changeset
473 get_extent_triplet (const dim_vector& dims, int& dim,
53b4fdeacc2e improve reduction functions
Jaroslav Hajek <highegg@gmail.com>
parents: 8650
diff changeset
474 octave_idx_type& l, octave_idx_type& n,
53b4fdeacc2e improve reduction functions
Jaroslav Hajek <highegg@gmail.com>
parents: 8650
diff changeset
475 octave_idx_type& u)
53b4fdeacc2e improve reduction functions
Jaroslav Hajek <highegg@gmail.com>
parents: 8650
diff changeset
476 {
53b4fdeacc2e improve reduction functions
Jaroslav Hajek <highegg@gmail.com>
parents: 8650
diff changeset
477 octave_idx_type ndims = dims.length ();
53b4fdeacc2e improve reduction functions
Jaroslav Hajek <highegg@gmail.com>
parents: 8650
diff changeset
478 if (dim >= ndims)
53b4fdeacc2e improve reduction functions
Jaroslav Hajek <highegg@gmail.com>
parents: 8650
diff changeset
479 {
53b4fdeacc2e improve reduction functions
Jaroslav Hajek <highegg@gmail.com>
parents: 8650
diff changeset
480 l = dims.numel ();
53b4fdeacc2e improve reduction functions
Jaroslav Hajek <highegg@gmail.com>
parents: 8650
diff changeset
481 n = 1;
53b4fdeacc2e improve reduction functions
Jaroslav Hajek <highegg@gmail.com>
parents: 8650
diff changeset
482 u = 1;
53b4fdeacc2e improve reduction functions
Jaroslav Hajek <highegg@gmail.com>
parents: 8650
diff changeset
483 }
53b4fdeacc2e improve reduction functions
Jaroslav Hajek <highegg@gmail.com>
parents: 8650
diff changeset
484 else
53b4fdeacc2e improve reduction functions
Jaroslav Hajek <highegg@gmail.com>
parents: 8650
diff changeset
485 {
53b4fdeacc2e improve reduction functions
Jaroslav Hajek <highegg@gmail.com>
parents: 8650
diff changeset
486 if (dim < 0)
53b4fdeacc2e improve reduction functions
Jaroslav Hajek <highegg@gmail.com>
parents: 8650
diff changeset
487 {
53b4fdeacc2e improve reduction functions
Jaroslav Hajek <highegg@gmail.com>
parents: 8650
diff changeset
488 // find first non-singleton dim
53b4fdeacc2e improve reduction functions
Jaroslav Hajek <highegg@gmail.com>
parents: 8650
diff changeset
489 for (dim = 0; dims(dim) == 1 && dim < ndims - 1; dim++) ;
53b4fdeacc2e improve reduction functions
Jaroslav Hajek <highegg@gmail.com>
parents: 8650
diff changeset
490 }
53b4fdeacc2e improve reduction functions
Jaroslav Hajek <highegg@gmail.com>
parents: 8650
diff changeset
491 // calculate extent triplet.
53b4fdeacc2e improve reduction functions
Jaroslav Hajek <highegg@gmail.com>
parents: 8650
diff changeset
492 l = 1, n = dims(dim), u = 1;
53b4fdeacc2e improve reduction functions
Jaroslav Hajek <highegg@gmail.com>
parents: 8650
diff changeset
493 for (octave_idx_type i = 0; i < dim; i++)
53b4fdeacc2e improve reduction functions
Jaroslav Hajek <highegg@gmail.com>
parents: 8650
diff changeset
494 l *= dims (i);
53b4fdeacc2e improve reduction functions
Jaroslav Hajek <highegg@gmail.com>
parents: 8650
diff changeset
495 for (octave_idx_type i = dim + 1; i < ndims; i++)
53b4fdeacc2e improve reduction functions
Jaroslav Hajek <highegg@gmail.com>
parents: 8650
diff changeset
496 u *= dims (i);
53b4fdeacc2e improve reduction functions
Jaroslav Hajek <highegg@gmail.com>
parents: 8650
diff changeset
497 }
53b4fdeacc2e improve reduction functions
Jaroslav Hajek <highegg@gmail.com>
parents: 8650
diff changeset
498 }
53b4fdeacc2e improve reduction functions
Jaroslav Hajek <highegg@gmail.com>
parents: 8650
diff changeset
499
53b4fdeacc2e improve reduction functions
Jaroslav Hajek <highegg@gmail.com>
parents: 8650
diff changeset
500 // Appliers.
53b4fdeacc2e improve reduction functions
Jaroslav Hajek <highegg@gmail.com>
parents: 8650
diff changeset
501 // FIXME: is this the best design? C++ gives a lot of options here...
53b4fdeacc2e improve reduction functions
Jaroslav Hajek <highegg@gmail.com>
parents: 8650
diff changeset
502 // maybe it can be done without an explicit parameter?
53b4fdeacc2e improve reduction functions
Jaroslav Hajek <highegg@gmail.com>
parents: 8650
diff changeset
503
53b4fdeacc2e improve reduction functions
Jaroslav Hajek <highegg@gmail.com>
parents: 8650
diff changeset
504 template <class ArrayType, class T>
53b4fdeacc2e improve reduction functions
Jaroslav Hajek <highegg@gmail.com>
parents: 8650
diff changeset
505 inline ArrayType
53b4fdeacc2e improve reduction functions
Jaroslav Hajek <highegg@gmail.com>
parents: 8650
diff changeset
506 do_mx_red_op (const Array<T>& src, int dim,
53b4fdeacc2e improve reduction functions
Jaroslav Hajek <highegg@gmail.com>
parents: 8650
diff changeset
507 void (*mx_red_op) (const T *, typename ArrayType::element_type *,
53b4fdeacc2e improve reduction functions
Jaroslav Hajek <highegg@gmail.com>
parents: 8650
diff changeset
508 octave_idx_type, octave_idx_type, octave_idx_type))
53b4fdeacc2e improve reduction functions
Jaroslav Hajek <highegg@gmail.com>
parents: 8650
diff changeset
509 {
53b4fdeacc2e improve reduction functions
Jaroslav Hajek <highegg@gmail.com>
parents: 8650
diff changeset
510 octave_idx_type l, n, u;
53b4fdeacc2e improve reduction functions
Jaroslav Hajek <highegg@gmail.com>
parents: 8650
diff changeset
511 dim_vector dims = src.dims ();
8743
1bd918cfb6e2 reimplement any & all using the new reduction code
Jaroslav Hajek <highegg@gmail.com>
parents: 8736
diff changeset
512 // M*b inconsistency: sum([]) = 0 etc.
1bd918cfb6e2 reimplement any & all using the new reduction code
Jaroslav Hajek <highegg@gmail.com>
parents: 8736
diff changeset
513 if (dims.length () == 2 && dims(0) == 0 && dims(1) == 0)
1bd918cfb6e2 reimplement any & all using the new reduction code
Jaroslav Hajek <highegg@gmail.com>
parents: 8736
diff changeset
514 dims (1) = 1;
1bd918cfb6e2 reimplement any & all using the new reduction code
Jaroslav Hajek <highegg@gmail.com>
parents: 8736
diff changeset
515
8736
53b4fdeacc2e improve reduction functions
Jaroslav Hajek <highegg@gmail.com>
parents: 8650
diff changeset
516 get_extent_triplet (dims, dim, l, n, u);
53b4fdeacc2e improve reduction functions
Jaroslav Hajek <highegg@gmail.com>
parents: 8650
diff changeset
517
53b4fdeacc2e improve reduction functions
Jaroslav Hajek <highegg@gmail.com>
parents: 8650
diff changeset
518 // Reduction operation reduces the array size.
53b4fdeacc2e improve reduction functions
Jaroslav Hajek <highegg@gmail.com>
parents: 8650
diff changeset
519 if (dim < dims.length ()) dims(dim) = 1;
53b4fdeacc2e improve reduction functions
Jaroslav Hajek <highegg@gmail.com>
parents: 8650
diff changeset
520 dims.chop_trailing_singletons ();
53b4fdeacc2e improve reduction functions
Jaroslav Hajek <highegg@gmail.com>
parents: 8650
diff changeset
521
53b4fdeacc2e improve reduction functions
Jaroslav Hajek <highegg@gmail.com>
parents: 8650
diff changeset
522 ArrayType ret (dims);
53b4fdeacc2e improve reduction functions
Jaroslav Hajek <highegg@gmail.com>
parents: 8650
diff changeset
523 mx_red_op (src.data (), ret.fortran_vec (), l, n, u);
53b4fdeacc2e improve reduction functions
Jaroslav Hajek <highegg@gmail.com>
parents: 8650
diff changeset
524
53b4fdeacc2e improve reduction functions
Jaroslav Hajek <highegg@gmail.com>
parents: 8650
diff changeset
525 return ret;
53b4fdeacc2e improve reduction functions
Jaroslav Hajek <highegg@gmail.com>
parents: 8650
diff changeset
526 }
53b4fdeacc2e improve reduction functions
Jaroslav Hajek <highegg@gmail.com>
parents: 8650
diff changeset
527
53b4fdeacc2e improve reduction functions
Jaroslav Hajek <highegg@gmail.com>
parents: 8650
diff changeset
528 template <class ArrayType, class T>
53b4fdeacc2e improve reduction functions
Jaroslav Hajek <highegg@gmail.com>
parents: 8650
diff changeset
529 inline ArrayType
53b4fdeacc2e improve reduction functions
Jaroslav Hajek <highegg@gmail.com>
parents: 8650
diff changeset
530 do_mx_cum_op (const Array<T>& src, int dim,
53b4fdeacc2e improve reduction functions
Jaroslav Hajek <highegg@gmail.com>
parents: 8650
diff changeset
531 void (*mx_cum_op) (const T *, typename ArrayType::element_type *,
53b4fdeacc2e improve reduction functions
Jaroslav Hajek <highegg@gmail.com>
parents: 8650
diff changeset
532 octave_idx_type, octave_idx_type, octave_idx_type))
53b4fdeacc2e improve reduction functions
Jaroslav Hajek <highegg@gmail.com>
parents: 8650
diff changeset
533 {
53b4fdeacc2e improve reduction functions
Jaroslav Hajek <highegg@gmail.com>
parents: 8650
diff changeset
534 octave_idx_type l, n, u;
53b4fdeacc2e improve reduction functions
Jaroslav Hajek <highegg@gmail.com>
parents: 8650
diff changeset
535 dim_vector dims = src.dims ();
53b4fdeacc2e improve reduction functions
Jaroslav Hajek <highegg@gmail.com>
parents: 8650
diff changeset
536 get_extent_triplet (dims, dim, l, n, u);
53b4fdeacc2e improve reduction functions
Jaroslav Hajek <highegg@gmail.com>
parents: 8650
diff changeset
537
53b4fdeacc2e improve reduction functions
Jaroslav Hajek <highegg@gmail.com>
parents: 8650
diff changeset
538 // Cumulative operation doesn't reduce the array size.
53b4fdeacc2e improve reduction functions
Jaroslav Hajek <highegg@gmail.com>
parents: 8650
diff changeset
539 ArrayType ret (dims);
53b4fdeacc2e improve reduction functions
Jaroslav Hajek <highegg@gmail.com>
parents: 8650
diff changeset
540 mx_cum_op (src.data (), ret.fortran_vec (), l, n, u);
53b4fdeacc2e improve reduction functions
Jaroslav Hajek <highegg@gmail.com>
parents: 8650
diff changeset
541
53b4fdeacc2e improve reduction functions
Jaroslav Hajek <highegg@gmail.com>
parents: 8650
diff changeset
542 return ret;
53b4fdeacc2e improve reduction functions
Jaroslav Hajek <highegg@gmail.com>
parents: 8650
diff changeset
543 }
53b4fdeacc2e improve reduction functions
Jaroslav Hajek <highegg@gmail.com>
parents: 8650
diff changeset
544
3864
e78705239df5 [project @ 2001-11-16 12:56:20 by jwe]
jwe
parents: 3769
diff changeset
545 // Avoid some code duplication. Maybe we should use templates.
e78705239df5 [project @ 2001-11-16 12:56:20 by jwe]
jwe
parents: 3769
diff changeset
546
4015
6476dd85a65f [project @ 2002-08-02 07:59:19 by jwe]
jwe
parents: 3864
diff changeset
547 #define MX_CUMULATIVE_OP(RET_TYPE, ELT_TYPE, OP) \
3864
e78705239df5 [project @ 2001-11-16 12:56:20 by jwe]
jwe
parents: 3769
diff changeset
548 \
5275
23b37da9fd5b [project @ 2005-04-08 16:07:35 by jwe]
jwe
parents: 5110
diff changeset
549 octave_idx_type nr = rows (); \
23b37da9fd5b [project @ 2005-04-08 16:07:35 by jwe]
jwe
parents: 5110
diff changeset
550 octave_idx_type nc = cols (); \
3864
e78705239df5 [project @ 2001-11-16 12:56:20 by jwe]
jwe
parents: 3769
diff changeset
551 \
e78705239df5 [project @ 2001-11-16 12:56:20 by jwe]
jwe
parents: 3769
diff changeset
552 RET_TYPE retval (nr, nc); \
e78705239df5 [project @ 2001-11-16 12:56:20 by jwe]
jwe
parents: 3769
diff changeset
553 \
e78705239df5 [project @ 2001-11-16 12:56:20 by jwe]
jwe
parents: 3769
diff changeset
554 if (nr > 0 && nc > 0) \
e78705239df5 [project @ 2001-11-16 12:56:20 by jwe]
jwe
parents: 3769
diff changeset
555 { \
e78705239df5 [project @ 2001-11-16 12:56:20 by jwe]
jwe
parents: 3769
diff changeset
556 if ((nr == 1 && dim == -1) || dim == 1) \
e78705239df5 [project @ 2001-11-16 12:56:20 by jwe]
jwe
parents: 3769
diff changeset
557 { \
5275
23b37da9fd5b [project @ 2005-04-08 16:07:35 by jwe]
jwe
parents: 5110
diff changeset
558 for (octave_idx_type i = 0; i < nr; i++) \
3864
e78705239df5 [project @ 2001-11-16 12:56:20 by jwe]
jwe
parents: 3769
diff changeset
559 { \
e78705239df5 [project @ 2001-11-16 12:56:20 by jwe]
jwe
parents: 3769
diff changeset
560 ELT_TYPE t = elem (i, 0); \
5275
23b37da9fd5b [project @ 2005-04-08 16:07:35 by jwe]
jwe
parents: 5110
diff changeset
561 for (octave_idx_type j = 0; j < nc; j++) \
3864
e78705239df5 [project @ 2001-11-16 12:56:20 by jwe]
jwe
parents: 3769
diff changeset
562 { \
e78705239df5 [project @ 2001-11-16 12:56:20 by jwe]
jwe
parents: 3769
diff changeset
563 retval.elem (i, j) = t; \
e78705239df5 [project @ 2001-11-16 12:56:20 by jwe]
jwe
parents: 3769
diff changeset
564 if (j < nc - 1) \
e78705239df5 [project @ 2001-11-16 12:56:20 by jwe]
jwe
parents: 3769
diff changeset
565 t OP elem (i, j+1); \
e78705239df5 [project @ 2001-11-16 12:56:20 by jwe]
jwe
parents: 3769
diff changeset
566 } \
e78705239df5 [project @ 2001-11-16 12:56:20 by jwe]
jwe
parents: 3769
diff changeset
567 } \
e78705239df5 [project @ 2001-11-16 12:56:20 by jwe]
jwe
parents: 3769
diff changeset
568 } \
e78705239df5 [project @ 2001-11-16 12:56:20 by jwe]
jwe
parents: 3769
diff changeset
569 else \
e78705239df5 [project @ 2001-11-16 12:56:20 by jwe]
jwe
parents: 3769
diff changeset
570 { \
5275
23b37da9fd5b [project @ 2005-04-08 16:07:35 by jwe]
jwe
parents: 5110
diff changeset
571 for (octave_idx_type j = 0; j < nc; j++) \
3864
e78705239df5 [project @ 2001-11-16 12:56:20 by jwe]
jwe
parents: 3769
diff changeset
572 { \
e78705239df5 [project @ 2001-11-16 12:56:20 by jwe]
jwe
parents: 3769
diff changeset
573 ELT_TYPE t = elem (0, j); \
5275
23b37da9fd5b [project @ 2005-04-08 16:07:35 by jwe]
jwe
parents: 5110
diff changeset
574 for (octave_idx_type i = 0; i < nr; i++) \
3864
e78705239df5 [project @ 2001-11-16 12:56:20 by jwe]
jwe
parents: 3769
diff changeset
575 { \
e78705239df5 [project @ 2001-11-16 12:56:20 by jwe]
jwe
parents: 3769
diff changeset
576 retval.elem (i, j) = t; \
e78705239df5 [project @ 2001-11-16 12:56:20 by jwe]
jwe
parents: 3769
diff changeset
577 if (i < nr - 1) \
e78705239df5 [project @ 2001-11-16 12:56:20 by jwe]
jwe
parents: 3769
diff changeset
578 t OP elem (i+1, j); \
e78705239df5 [project @ 2001-11-16 12:56:20 by jwe]
jwe
parents: 3769
diff changeset
579 } \
e78705239df5 [project @ 2001-11-16 12:56:20 by jwe]
jwe
parents: 3769
diff changeset
580 } \
e78705239df5 [project @ 2001-11-16 12:56:20 by jwe]
jwe
parents: 3769
diff changeset
581 } \
e78705239df5 [project @ 2001-11-16 12:56:20 by jwe]
jwe
parents: 3769
diff changeset
582 } \
e78705239df5 [project @ 2001-11-16 12:56:20 by jwe]
jwe
parents: 3769
diff changeset
583 \
e78705239df5 [project @ 2001-11-16 12:56:20 by jwe]
jwe
parents: 3769
diff changeset
584 return retval
e78705239df5 [project @ 2001-11-16 12:56:20 by jwe]
jwe
parents: 3769
diff changeset
585
e78705239df5 [project @ 2001-11-16 12:56:20 by jwe]
jwe
parents: 3769
diff changeset
586 #define MX_BASE_REDUCTION_OP(RET_TYPE, ROW_EXPR, COL_EXPR, INIT_VAL, \
e78705239df5 [project @ 2001-11-16 12:56:20 by jwe]
jwe
parents: 3769
diff changeset
587 MT_RESULT) \
e78705239df5 [project @ 2001-11-16 12:56:20 by jwe]
jwe
parents: 3769
diff changeset
588 \
5275
23b37da9fd5b [project @ 2005-04-08 16:07:35 by jwe]
jwe
parents: 5110
diff changeset
589 octave_idx_type nr = rows (); \
23b37da9fd5b [project @ 2005-04-08 16:07:35 by jwe]
jwe
parents: 5110
diff changeset
590 octave_idx_type nc = cols (); \
3864
e78705239df5 [project @ 2001-11-16 12:56:20 by jwe]
jwe
parents: 3769
diff changeset
591 \
e78705239df5 [project @ 2001-11-16 12:56:20 by jwe]
jwe
parents: 3769
diff changeset
592 RET_TYPE retval; \
e78705239df5 [project @ 2001-11-16 12:56:20 by jwe]
jwe
parents: 3769
diff changeset
593 \
e78705239df5 [project @ 2001-11-16 12:56:20 by jwe]
jwe
parents: 3769
diff changeset
594 if (nr > 0 && nc > 0) \
e78705239df5 [project @ 2001-11-16 12:56:20 by jwe]
jwe
parents: 3769
diff changeset
595 { \
e78705239df5 [project @ 2001-11-16 12:56:20 by jwe]
jwe
parents: 3769
diff changeset
596 if ((nr == 1 && dim == -1) || dim == 1) \
e78705239df5 [project @ 2001-11-16 12:56:20 by jwe]
jwe
parents: 3769
diff changeset
597 { \
e78705239df5 [project @ 2001-11-16 12:56:20 by jwe]
jwe
parents: 3769
diff changeset
598 retval.resize (nr, 1); \
5275
23b37da9fd5b [project @ 2005-04-08 16:07:35 by jwe]
jwe
parents: 5110
diff changeset
599 for (octave_idx_type i = 0; i < nr; i++) \
3864
e78705239df5 [project @ 2001-11-16 12:56:20 by jwe]
jwe
parents: 3769
diff changeset
600 { \
e78705239df5 [project @ 2001-11-16 12:56:20 by jwe]
jwe
parents: 3769
diff changeset
601 retval.elem (i, 0) = INIT_VAL; \
5275
23b37da9fd5b [project @ 2005-04-08 16:07:35 by jwe]
jwe
parents: 5110
diff changeset
602 for (octave_idx_type j = 0; j < nc; j++) \
3864
e78705239df5 [project @ 2001-11-16 12:56:20 by jwe]
jwe
parents: 3769
diff changeset
603 { \
e78705239df5 [project @ 2001-11-16 12:56:20 by jwe]
jwe
parents: 3769
diff changeset
604 ROW_EXPR; \
e78705239df5 [project @ 2001-11-16 12:56:20 by jwe]
jwe
parents: 3769
diff changeset
605 } \
e78705239df5 [project @ 2001-11-16 12:56:20 by jwe]
jwe
parents: 3769
diff changeset
606 } \
e78705239df5 [project @ 2001-11-16 12:56:20 by jwe]
jwe
parents: 3769
diff changeset
607 } \
e78705239df5 [project @ 2001-11-16 12:56:20 by jwe]
jwe
parents: 3769
diff changeset
608 else \
e78705239df5 [project @ 2001-11-16 12:56:20 by jwe]
jwe
parents: 3769
diff changeset
609 { \
e78705239df5 [project @ 2001-11-16 12:56:20 by jwe]
jwe
parents: 3769
diff changeset
610 retval.resize (1, nc); \
5275
23b37da9fd5b [project @ 2005-04-08 16:07:35 by jwe]
jwe
parents: 5110
diff changeset
611 for (octave_idx_type j = 0; j < nc; j++) \
3864
e78705239df5 [project @ 2001-11-16 12:56:20 by jwe]
jwe
parents: 3769
diff changeset
612 { \
e78705239df5 [project @ 2001-11-16 12:56:20 by jwe]
jwe
parents: 3769
diff changeset
613 retval.elem (0, j) = INIT_VAL; \
5275
23b37da9fd5b [project @ 2005-04-08 16:07:35 by jwe]
jwe
parents: 5110
diff changeset
614 for (octave_idx_type i = 0; i < nr; i++) \
3864
e78705239df5 [project @ 2001-11-16 12:56:20 by jwe]
jwe
parents: 3769
diff changeset
615 { \
e78705239df5 [project @ 2001-11-16 12:56:20 by jwe]
jwe
parents: 3769
diff changeset
616 COL_EXPR; \
e78705239df5 [project @ 2001-11-16 12:56:20 by jwe]
jwe
parents: 3769
diff changeset
617 } \
e78705239df5 [project @ 2001-11-16 12:56:20 by jwe]
jwe
parents: 3769
diff changeset
618 } \
e78705239df5 [project @ 2001-11-16 12:56:20 by jwe]
jwe
parents: 3769
diff changeset
619 } \
e78705239df5 [project @ 2001-11-16 12:56:20 by jwe]
jwe
parents: 3769
diff changeset
620 } \
4139
02ca908056e9 [project @ 2002-11-01 00:49:13 by jwe]
jwe
parents: 4015
diff changeset
621 else if (nc == 0 && (nr == 0 || (nr == 1 && dim == -1))) \
02ca908056e9 [project @ 2002-11-01 00:49:13 by jwe]
jwe
parents: 4015
diff changeset
622 retval.resize (1, 1, MT_RESULT); \
4015
6476dd85a65f [project @ 2002-08-02 07:59:19 by jwe]
jwe
parents: 3864
diff changeset
623 else if (nr == 0 && (dim == 0 || dim == -1)) \
6476dd85a65f [project @ 2002-08-02 07:59:19 by jwe]
jwe
parents: 3864
diff changeset
624 retval.resize (1, nc, MT_RESULT); \
6476dd85a65f [project @ 2002-08-02 07:59:19 by jwe]
jwe
parents: 3864
diff changeset
625 else if (nc == 0 && dim == 1) \
6476dd85a65f [project @ 2002-08-02 07:59:19 by jwe]
jwe
parents: 3864
diff changeset
626 retval.resize (nr, 1, MT_RESULT); \
6476dd85a65f [project @ 2002-08-02 07:59:19 by jwe]
jwe
parents: 3864
diff changeset
627 else \
4139
02ca908056e9 [project @ 2002-11-01 00:49:13 by jwe]
jwe
parents: 4015
diff changeset
628 retval.resize (nr > 0, nc > 0); \
3864
e78705239df5 [project @ 2001-11-16 12:56:20 by jwe]
jwe
parents: 3769
diff changeset
629 \
e78705239df5 [project @ 2001-11-16 12:56:20 by jwe]
jwe
parents: 3769
diff changeset
630 return retval
e78705239df5 [project @ 2001-11-16 12:56:20 by jwe]
jwe
parents: 3769
diff changeset
631
e78705239df5 [project @ 2001-11-16 12:56:20 by jwe]
jwe
parents: 3769
diff changeset
632 #define MX_REDUCTION_OP_ROW_EXPR(OP) \
e78705239df5 [project @ 2001-11-16 12:56:20 by jwe]
jwe
parents: 3769
diff changeset
633 retval.elem (i, 0) OP elem (i, j)
e78705239df5 [project @ 2001-11-16 12:56:20 by jwe]
jwe
parents: 3769
diff changeset
634
e78705239df5 [project @ 2001-11-16 12:56:20 by jwe]
jwe
parents: 3769
diff changeset
635 #define MX_REDUCTION_OP_COL_EXPR(OP) \
e78705239df5 [project @ 2001-11-16 12:56:20 by jwe]
jwe
parents: 3769
diff changeset
636 retval.elem (0, j) OP elem (i, j)
e78705239df5 [project @ 2001-11-16 12:56:20 by jwe]
jwe
parents: 3769
diff changeset
637
e78705239df5 [project @ 2001-11-16 12:56:20 by jwe]
jwe
parents: 3769
diff changeset
638 #define MX_REDUCTION_OP(RET_TYPE, OP, INIT_VAL, MT_RESULT) \
e78705239df5 [project @ 2001-11-16 12:56:20 by jwe]
jwe
parents: 3769
diff changeset
639 MX_BASE_REDUCTION_OP (RET_TYPE, \
e78705239df5 [project @ 2001-11-16 12:56:20 by jwe]
jwe
parents: 3769
diff changeset
640 MX_REDUCTION_OP_ROW_EXPR (OP), \
e78705239df5 [project @ 2001-11-16 12:56:20 by jwe]
jwe
parents: 3769
diff changeset
641 MX_REDUCTION_OP_COL_EXPR (OP), \
e78705239df5 [project @ 2001-11-16 12:56:20 by jwe]
jwe
parents: 3769
diff changeset
642 INIT_VAL, MT_RESULT)
4015
6476dd85a65f [project @ 2002-08-02 07:59:19 by jwe]
jwe
parents: 3864
diff changeset
643
6476dd85a65f [project @ 2002-08-02 07:59:19 by jwe]
jwe
parents: 3864
diff changeset
644 #define MX_ANY_ALL_OP_ROW_CODE(TEST_OP, TEST_TRUE_VAL) \
6476dd85a65f [project @ 2002-08-02 07:59:19 by jwe]
jwe
parents: 3864
diff changeset
645 if (elem (i, j) TEST_OP 0.0) \
6476dd85a65f [project @ 2002-08-02 07:59:19 by jwe]
jwe
parents: 3864
diff changeset
646 { \
6476dd85a65f [project @ 2002-08-02 07:59:19 by jwe]
jwe
parents: 3864
diff changeset
647 retval.elem (i, 0) = TEST_TRUE_VAL; \
6476dd85a65f [project @ 2002-08-02 07:59:19 by jwe]
jwe
parents: 3864
diff changeset
648 break; \
6476dd85a65f [project @ 2002-08-02 07:59:19 by jwe]
jwe
parents: 3864
diff changeset
649 }
6476dd85a65f [project @ 2002-08-02 07:59:19 by jwe]
jwe
parents: 3864
diff changeset
650
6476dd85a65f [project @ 2002-08-02 07:59:19 by jwe]
jwe
parents: 3864
diff changeset
651 #define MX_ANY_ALL_OP_COL_CODE(TEST_OP, TEST_TRUE_VAL) \
6476dd85a65f [project @ 2002-08-02 07:59:19 by jwe]
jwe
parents: 3864
diff changeset
652 if (elem (i, j) TEST_OP 0.0) \
6476dd85a65f [project @ 2002-08-02 07:59:19 by jwe]
jwe
parents: 3864
diff changeset
653 { \
6476dd85a65f [project @ 2002-08-02 07:59:19 by jwe]
jwe
parents: 3864
diff changeset
654 retval.elem (0, j) = TEST_TRUE_VAL; \
6476dd85a65f [project @ 2002-08-02 07:59:19 by jwe]
jwe
parents: 3864
diff changeset
655 break; \
6476dd85a65f [project @ 2002-08-02 07:59:19 by jwe]
jwe
parents: 3864
diff changeset
656 }
6476dd85a65f [project @ 2002-08-02 07:59:19 by jwe]
jwe
parents: 3864
diff changeset
657
6476dd85a65f [project @ 2002-08-02 07:59:19 by jwe]
jwe
parents: 3864
diff changeset
658 #define MX_ANY_ALL_OP(DIM, INIT_VAL, TEST_OP, TEST_TRUE_VAL) \
6476dd85a65f [project @ 2002-08-02 07:59:19 by jwe]
jwe
parents: 3864
diff changeset
659 MX_BASE_REDUCTION_OP (boolMatrix, \
6476dd85a65f [project @ 2002-08-02 07:59:19 by jwe]
jwe
parents: 3864
diff changeset
660 MX_ANY_ALL_OP_ROW_CODE (TEST_OP, TEST_TRUE_VAL), \
6476dd85a65f [project @ 2002-08-02 07:59:19 by jwe]
jwe
parents: 3864
diff changeset
661 MX_ANY_ALL_OP_COL_CODE (TEST_OP, TEST_TRUE_VAL), \
6476dd85a65f [project @ 2002-08-02 07:59:19 by jwe]
jwe
parents: 3864
diff changeset
662 INIT_VAL, INIT_VAL)
6476dd85a65f [project @ 2002-08-02 07:59:19 by jwe]
jwe
parents: 3864
diff changeset
663
6476dd85a65f [project @ 2002-08-02 07:59:19 by jwe]
jwe
parents: 3864
diff changeset
664 #define MX_ALL_OP(DIM) MX_ANY_ALL_OP (DIM, true, ==, false)
6476dd85a65f [project @ 2002-08-02 07:59:19 by jwe]
jwe
parents: 3864
diff changeset
665
6476dd85a65f [project @ 2002-08-02 07:59:19 by jwe]
jwe
parents: 3864
diff changeset
666 #define MX_ANY_OP(DIM) MX_ANY_ALL_OP (DIM, false, !=, true)
6476dd85a65f [project @ 2002-08-02 07:59:19 by jwe]
jwe
parents: 3864
diff changeset
667
4563
742993a501b9 [project @ 2003-10-29 06:25:12 by jwe]
jwe
parents: 4559
diff changeset
668 #define MX_ND_ALL_EXPR elem (iter_idx) == 0
4556
773a21e4fce8 [project @ 2003-10-28 05:02:10 by jwe]
jwe
parents: 4139
diff changeset
669
4563
742993a501b9 [project @ 2003-10-29 06:25:12 by jwe]
jwe
parents: 4559
diff changeset
670 #define MX_ND_ANY_EXPR elem (iter_idx) != 0
4556
773a21e4fce8 [project @ 2003-10-28 05:02:10 by jwe]
jwe
parents: 4139
diff changeset
671
773a21e4fce8 [project @ 2003-10-28 05:02:10 by jwe]
jwe
parents: 4139
diff changeset
672 #define MX_ND_ALL_EVAL(TEST_EXPR) \
5520
b99404352541 [project @ 2005-10-29 04:44:00 by jwe]
jwe
parents: 5307
diff changeset
673 if (retval(result_idx) && (TEST_EXPR)) \
b99404352541 [project @ 2005-10-29 04:44:00 by jwe]
jwe
parents: 5307
diff changeset
674 retval(result_idx) = 0;
4556
773a21e4fce8 [project @ 2003-10-28 05:02:10 by jwe]
jwe
parents: 4139
diff changeset
675
773a21e4fce8 [project @ 2003-10-28 05:02:10 by jwe]
jwe
parents: 4139
diff changeset
676 #define MX_ND_ANY_EVAL(TEST_EXPR) \
5520
b99404352541 [project @ 2005-10-29 04:44:00 by jwe]
jwe
parents: 5307
diff changeset
677 if (retval(result_idx) || (TEST_EXPR)) \
b99404352541 [project @ 2005-10-29 04:44:00 by jwe]
jwe
parents: 5307
diff changeset
678 retval(result_idx) = 1;
4569
01e4957409a4 [project @ 2003-10-30 05:48:17 by jwe]
jwe
parents: 4563
diff changeset
679
5520
b99404352541 [project @ 2005-10-29 04:44:00 by jwe]
jwe
parents: 5307
diff changeset
680 #define MX_ND_REDUCTION(EVAL_EXPR, INIT_VAL, RET_TYPE) \
4556
773a21e4fce8 [project @ 2003-10-28 05:02:10 by jwe]
jwe
parents: 4139
diff changeset
681 \
4569
01e4957409a4 [project @ 2003-10-30 05:48:17 by jwe]
jwe
parents: 4563
diff changeset
682 RET_TYPE retval; \
4556
773a21e4fce8 [project @ 2003-10-28 05:02:10 by jwe]
jwe
parents: 4139
diff changeset
683 \
4932
43f4ebd2704c [project @ 2004-08-05 13:26:10 by jwe]
jwe
parents: 4899
diff changeset
684 dim_vector dv = this->dims (); \
5520
b99404352541 [project @ 2005-10-29 04:44:00 by jwe]
jwe
parents: 5307
diff changeset
685 int nd = this->ndims (); \
4563
742993a501b9 [project @ 2003-10-29 06:25:12 by jwe]
jwe
parents: 4559
diff changeset
686 \
5955
fc46f9c99028 [project @ 2006-08-22 18:37:43 by jwe]
jwe
parents: 5615
diff changeset
687 int empty = false; \
4563
742993a501b9 [project @ 2003-10-29 06:25:12 by jwe]
jwe
parents: 4559
diff changeset
688 \
5520
b99404352541 [project @ 2005-10-29 04:44:00 by jwe]
jwe
parents: 5307
diff changeset
689 for (int i = 0; i < nd; i++) \
4563
742993a501b9 [project @ 2003-10-29 06:25:12 by jwe]
jwe
parents: 4559
diff changeset
690 { \
5955
fc46f9c99028 [project @ 2006-08-22 18:37:43 by jwe]
jwe
parents: 5615
diff changeset
691 if (dv(i) == 0) \
4563
742993a501b9 [project @ 2003-10-29 06:25:12 by jwe]
jwe
parents: 4559
diff changeset
692 { \
5955
fc46f9c99028 [project @ 2006-08-22 18:37:43 by jwe]
jwe
parents: 5615
diff changeset
693 empty = true; \
4563
742993a501b9 [project @ 2003-10-29 06:25:12 by jwe]
jwe
parents: 4559
diff changeset
694 break; \
742993a501b9 [project @ 2003-10-29 06:25:12 by jwe]
jwe
parents: 4559
diff changeset
695 } \
742993a501b9 [project @ 2003-10-29 06:25:12 by jwe]
jwe
parents: 4559
diff changeset
696 } \
742993a501b9 [project @ 2003-10-29 06:25:12 by jwe]
jwe
parents: 4559
diff changeset
697 \
5972
393babcaa877 [project @ 2006-08-26 03:02:39 by jwe]
jwe
parents: 5955
diff changeset
698 if (nd == 2 && dv(0) == 0 && dv(1) == 0) \
393babcaa877 [project @ 2006-08-26 03:02:39 by jwe]
jwe
parents: 5955
diff changeset
699 { \
393babcaa877 [project @ 2006-08-26 03:02:39 by jwe]
jwe
parents: 5955
diff changeset
700 retval.resize (dim_vector (1, 1), INIT_VAL); \
393babcaa877 [project @ 2006-08-26 03:02:39 by jwe]
jwe
parents: 5955
diff changeset
701 return retval; \
393babcaa877 [project @ 2006-08-26 03:02:39 by jwe]
jwe
parents: 5955
diff changeset
702 } \
393babcaa877 [project @ 2006-08-26 03:02:39 by jwe]
jwe
parents: 5955
diff changeset
703 \
5520
b99404352541 [project @ 2005-10-29 04:44:00 by jwe]
jwe
parents: 5307
diff changeset
704 /* We need to find first non-singleton dim. */ \
b99404352541 [project @ 2005-10-29 04:44:00 by jwe]
jwe
parents: 5307
diff changeset
705 \
b99404352541 [project @ 2005-10-29 04:44:00 by jwe]
jwe
parents: 5307
diff changeset
706 if (dim == -1) \
4556
773a21e4fce8 [project @ 2003-10-28 05:02:10 by jwe]
jwe
parents: 4139
diff changeset
707 { \
5520
b99404352541 [project @ 2005-10-29 04:44:00 by jwe]
jwe
parents: 5307
diff changeset
708 dim = 0; \
b99404352541 [project @ 2005-10-29 04:44:00 by jwe]
jwe
parents: 5307
diff changeset
709 \
b99404352541 [project @ 2005-10-29 04:44:00 by jwe]
jwe
parents: 5307
diff changeset
710 for (int i = 0; i < nd; i++) \
4563
742993a501b9 [project @ 2003-10-29 06:25:12 by jwe]
jwe
parents: 4559
diff changeset
711 { \
5520
b99404352541 [project @ 2005-10-29 04:44:00 by jwe]
jwe
parents: 5307
diff changeset
712 if (dv(i) != 1) \
4563
742993a501b9 [project @ 2003-10-29 06:25:12 by jwe]
jwe
parents: 4559
diff changeset
713 { \
742993a501b9 [project @ 2003-10-29 06:25:12 by jwe]
jwe
parents: 4559
diff changeset
714 dim = i; \
742993a501b9 [project @ 2003-10-29 06:25:12 by jwe]
jwe
parents: 4559
diff changeset
715 break; \
742993a501b9 [project @ 2003-10-29 06:25:12 by jwe]
jwe
parents: 4559
diff changeset
716 } \
742993a501b9 [project @ 2003-10-29 06:25:12 by jwe]
jwe
parents: 4559
diff changeset
717 } \
742993a501b9 [project @ 2003-10-29 06:25:12 by jwe]
jwe
parents: 4559
diff changeset
718 } \
5520
b99404352541 [project @ 2005-10-29 04:44:00 by jwe]
jwe
parents: 5307
diff changeset
719 else if (dim >= nd) \
4563
742993a501b9 [project @ 2003-10-29 06:25:12 by jwe]
jwe
parents: 4559
diff changeset
720 { \
5520
b99404352541 [project @ 2005-10-29 04:44:00 by jwe]
jwe
parents: 5307
diff changeset
721 dim = nd++; \
b99404352541 [project @ 2005-10-29 04:44:00 by jwe]
jwe
parents: 5307
diff changeset
722 dv.resize (nd, 1); \
4563
742993a501b9 [project @ 2003-10-29 06:25:12 by jwe]
jwe
parents: 4559
diff changeset
723 } \
742993a501b9 [project @ 2003-10-29 06:25:12 by jwe]
jwe
parents: 4559
diff changeset
724 \
5523
451ad352b288 [project @ 2005-10-31 03:18:21 by jwe]
jwe
parents: 5520
diff changeset
725 /* R = op (A, DIM) \
4563
742993a501b9 [project @ 2003-10-29 06:25:12 by jwe]
jwe
parents: 4559
diff changeset
726 \
5523
451ad352b288 [project @ 2005-10-31 03:18:21 by jwe]
jwe
parents: 5520
diff changeset
727 The strategy here is to access the elements of A along the \
451ad352b288 [project @ 2005-10-31 03:18:21 by jwe]
jwe
parents: 5520
diff changeset
728 dimension specified by DIM. This means that we loop over each \
5615
d01f07aeaec5 [project @ 2006-02-10 21:30:41 by jwe]
jwe
parents: 5614
diff changeset
729 element of R and adjust the index into A as needed. Store the \
d01f07aeaec5 [project @ 2006-02-10 21:30:41 by jwe]
jwe
parents: 5614
diff changeset
730 cummulative product of all dimensions of A in CP_SZ. The last \
d01f07aeaec5 [project @ 2006-02-10 21:30:41 by jwe]
jwe
parents: 5614
diff changeset
731 element of CP_SZ is the total number of elements of A. */ \
4563
742993a501b9 [project @ 2003-10-29 06:25:12 by jwe]
jwe
parents: 4559
diff changeset
732 \
5615
d01f07aeaec5 [project @ 2006-02-10 21:30:41 by jwe]
jwe
parents: 5614
diff changeset
733 Array<octave_idx_type> cp_sz (nd+1, 1); \
d01f07aeaec5 [project @ 2006-02-10 21:30:41 by jwe]
jwe
parents: 5614
diff changeset
734 for (int i = 1; i <= nd; i++) \
5523
451ad352b288 [project @ 2005-10-31 03:18:21 by jwe]
jwe
parents: 5520
diff changeset
735 cp_sz(i) = cp_sz(i-1)*dv(i-1); \
5520
b99404352541 [project @ 2005-10-29 04:44:00 by jwe]
jwe
parents: 5307
diff changeset
736 \
5523
451ad352b288 [project @ 2005-10-31 03:18:21 by jwe]
jwe
parents: 5520
diff changeset
737 octave_idx_type reset_at = cp_sz(dim); \
451ad352b288 [project @ 2005-10-31 03:18:21 by jwe]
jwe
parents: 5520
diff changeset
738 octave_idx_type base_incr = cp_sz(dim+1); \
451ad352b288 [project @ 2005-10-31 03:18:21 by jwe]
jwe
parents: 5520
diff changeset
739 octave_idx_type incr = cp_sz(dim); \
451ad352b288 [project @ 2005-10-31 03:18:21 by jwe]
jwe
parents: 5520
diff changeset
740 octave_idx_type base = 0; \
451ad352b288 [project @ 2005-10-31 03:18:21 by jwe]
jwe
parents: 5520
diff changeset
741 octave_idx_type next_base = base + base_incr; \
451ad352b288 [project @ 2005-10-31 03:18:21 by jwe]
jwe
parents: 5520
diff changeset
742 octave_idx_type iter_idx = base; \
451ad352b288 [project @ 2005-10-31 03:18:21 by jwe]
jwe
parents: 5520
diff changeset
743 octave_idx_type n_elts = dv(dim); \
4556
773a21e4fce8 [project @ 2003-10-28 05:02:10 by jwe]
jwe
parents: 4139
diff changeset
744 \
5520
b99404352541 [project @ 2005-10-29 04:44:00 by jwe]
jwe
parents: 5307
diff changeset
745 dv(dim) = 1; \
4556
773a21e4fce8 [project @ 2003-10-28 05:02:10 by jwe]
jwe
parents: 4139
diff changeset
746 \
5520
b99404352541 [project @ 2005-10-29 04:44:00 by jwe]
jwe
parents: 5307
diff changeset
747 retval.resize (dv, INIT_VAL); \
4556
773a21e4fce8 [project @ 2003-10-28 05:02:10 by jwe]
jwe
parents: 4139
diff changeset
748 \
5955
fc46f9c99028 [project @ 2006-08-22 18:37:43 by jwe]
jwe
parents: 5615
diff changeset
749 if (! empty) \
4556
773a21e4fce8 [project @ 2003-10-28 05:02:10 by jwe]
jwe
parents: 4139
diff changeset
750 { \
5955
fc46f9c99028 [project @ 2006-08-22 18:37:43 by jwe]
jwe
parents: 5615
diff changeset
751 octave_idx_type nel = dv.numel (); \
5523
451ad352b288 [project @ 2005-10-31 03:18:21 by jwe]
jwe
parents: 5520
diff changeset
752 \
5955
fc46f9c99028 [project @ 2006-08-22 18:37:43 by jwe]
jwe
parents: 5615
diff changeset
753 octave_idx_type k = 1; \
fc46f9c99028 [project @ 2006-08-22 18:37:43 by jwe]
jwe
parents: 5615
diff changeset
754 \
fc46f9c99028 [project @ 2006-08-22 18:37:43 by jwe]
jwe
parents: 5615
diff changeset
755 for (octave_idx_type result_idx = 0; result_idx < nel; result_idx++) \
5523
451ad352b288 [project @ 2005-10-31 03:18:21 by jwe]
jwe
parents: 5520
diff changeset
756 { \
5955
fc46f9c99028 [project @ 2006-08-22 18:37:43 by jwe]
jwe
parents: 5615
diff changeset
757 OCTAVE_QUIT; \
5523
451ad352b288 [project @ 2005-10-31 03:18:21 by jwe]
jwe
parents: 5520
diff changeset
758 \
5955
fc46f9c99028 [project @ 2006-08-22 18:37:43 by jwe]
jwe
parents: 5615
diff changeset
759 for (octave_idx_type j = 0; j < n_elts; j++) \
fc46f9c99028 [project @ 2006-08-22 18:37:43 by jwe]
jwe
parents: 5615
diff changeset
760 { \
fc46f9c99028 [project @ 2006-08-22 18:37:43 by jwe]
jwe
parents: 5615
diff changeset
761 OCTAVE_QUIT; \
fc46f9c99028 [project @ 2006-08-22 18:37:43 by jwe]
jwe
parents: 5615
diff changeset
762 \
fc46f9c99028 [project @ 2006-08-22 18:37:43 by jwe]
jwe
parents: 5615
diff changeset
763 EVAL_EXPR; \
5520
b99404352541 [project @ 2005-10-29 04:44:00 by jwe]
jwe
parents: 5307
diff changeset
764 \
5955
fc46f9c99028 [project @ 2006-08-22 18:37:43 by jwe]
jwe
parents: 5615
diff changeset
765 iter_idx += incr; \
fc46f9c99028 [project @ 2006-08-22 18:37:43 by jwe]
jwe
parents: 5615
diff changeset
766 } \
5523
451ad352b288 [project @ 2005-10-31 03:18:21 by jwe]
jwe
parents: 5520
diff changeset
767 \
5955
fc46f9c99028 [project @ 2006-08-22 18:37:43 by jwe]
jwe
parents: 5615
diff changeset
768 if (k == reset_at) \
fc46f9c99028 [project @ 2006-08-22 18:37:43 by jwe]
jwe
parents: 5615
diff changeset
769 { \
fc46f9c99028 [project @ 2006-08-22 18:37:43 by jwe]
jwe
parents: 5615
diff changeset
770 base = next_base; \
fc46f9c99028 [project @ 2006-08-22 18:37:43 by jwe]
jwe
parents: 5615
diff changeset
771 next_base += base_incr; \
fc46f9c99028 [project @ 2006-08-22 18:37:43 by jwe]
jwe
parents: 5615
diff changeset
772 iter_idx = base; \
fc46f9c99028 [project @ 2006-08-22 18:37:43 by jwe]
jwe
parents: 5615
diff changeset
773 k = 1; \
fc46f9c99028 [project @ 2006-08-22 18:37:43 by jwe]
jwe
parents: 5615
diff changeset
774 } \
fc46f9c99028 [project @ 2006-08-22 18:37:43 by jwe]
jwe
parents: 5615
diff changeset
775 else \
fc46f9c99028 [project @ 2006-08-22 18:37:43 by jwe]
jwe
parents: 5615
diff changeset
776 { \
fc46f9c99028 [project @ 2006-08-22 18:37:43 by jwe]
jwe
parents: 5615
diff changeset
777 base++; \
fc46f9c99028 [project @ 2006-08-22 18:37:43 by jwe]
jwe
parents: 5615
diff changeset
778 iter_idx = base; \
fc46f9c99028 [project @ 2006-08-22 18:37:43 by jwe]
jwe
parents: 5615
diff changeset
779 k++; \
fc46f9c99028 [project @ 2006-08-22 18:37:43 by jwe]
jwe
parents: 5615
diff changeset
780 } \
fc46f9c99028 [project @ 2006-08-22 18:37:43 by jwe]
jwe
parents: 5615
diff changeset
781 } \
4556
773a21e4fce8 [project @ 2003-10-28 05:02:10 by jwe]
jwe
parents: 4139
diff changeset
782 } \
773a21e4fce8 [project @ 2003-10-28 05:02:10 by jwe]
jwe
parents: 4139
diff changeset
783 \
4871
9c89c1408c32 [project @ 2004-04-21 19:05:28 by jwe]
jwe
parents: 4845
diff changeset
784 retval.chop_trailing_singletons (); \
9c89c1408c32 [project @ 2004-04-21 19:05:28 by jwe]
jwe
parents: 4845
diff changeset
785 \
4556
773a21e4fce8 [project @ 2003-10-28 05:02:10 by jwe]
jwe
parents: 4139
diff changeset
786 return retval
4569
01e4957409a4 [project @ 2003-10-30 05:48:17 by jwe]
jwe
parents: 4563
diff changeset
787
01e4957409a4 [project @ 2003-10-30 05:48:17 by jwe]
jwe
parents: 4563
diff changeset
788 #define MX_ND_REAL_OP_REDUCTION(ASN_EXPR, INIT_VAL) \
5520
b99404352541 [project @ 2005-10-29 04:44:00 by jwe]
jwe
parents: 5307
diff changeset
789 MX_ND_REDUCTION (retval(result_idx) ASN_EXPR, INIT_VAL, NDArray)
4569
01e4957409a4 [project @ 2003-10-30 05:48:17 by jwe]
jwe
parents: 4563
diff changeset
790
01e4957409a4 [project @ 2003-10-30 05:48:17 by jwe]
jwe
parents: 4563
diff changeset
791 #define MX_ND_COMPLEX_OP_REDUCTION(ASN_EXPR, INIT_VAL) \
5520
b99404352541 [project @ 2005-10-29 04:44:00 by jwe]
jwe
parents: 5307
diff changeset
792 MX_ND_REDUCTION (retval(result_idx) ASN_EXPR, INIT_VAL, ComplexNDArray)
4569
01e4957409a4 [project @ 2003-10-30 05:48:17 by jwe]
jwe
parents: 4563
diff changeset
793
01e4957409a4 [project @ 2003-10-30 05:48:17 by jwe]
jwe
parents: 4563
diff changeset
794 #define MX_ND_ANY_ALL_REDUCTION(EVAL_EXPR, VAL) \
5520
b99404352541 [project @ 2005-10-29 04:44:00 by jwe]
jwe
parents: 5307
diff changeset
795 MX_ND_REDUCTION (EVAL_EXPR, VAL, boolNDArray)
4556
773a21e4fce8 [project @ 2003-10-28 05:02:10 by jwe]
jwe
parents: 4139
diff changeset
796
5523
451ad352b288 [project @ 2005-10-31 03:18:21 by jwe]
jwe
parents: 5520
diff changeset
797 #define MX_ND_CUMULATIVE_OP(RET_TYPE, ACC_TYPE, INIT_VAL, OP) \
451ad352b288 [project @ 2005-10-31 03:18:21 by jwe]
jwe
parents: 5520
diff changeset
798 \
4584
f7697d703481 [project @ 2003-10-31 19:47:35 by jwe]
jwe
parents: 4569
diff changeset
799 RET_TYPE retval; \
f7697d703481 [project @ 2003-10-31 19:47:35 by jwe]
jwe
parents: 4569
diff changeset
800 \
4932
43f4ebd2704c [project @ 2004-08-05 13:26:10 by jwe]
jwe
parents: 4899
diff changeset
801 dim_vector dv = this->dims (); \
5523
451ad352b288 [project @ 2005-10-31 03:18:21 by jwe]
jwe
parents: 5520
diff changeset
802 int nd = this->ndims (); \
4584
f7697d703481 [project @ 2003-10-31 19:47:35 by jwe]
jwe
parents: 4569
diff changeset
803 \
5955
fc46f9c99028 [project @ 2006-08-22 18:37:43 by jwe]
jwe
parents: 5615
diff changeset
804 bool empty = false; \
4584
f7697d703481 [project @ 2003-10-31 19:47:35 by jwe]
jwe
parents: 4569
diff changeset
805 \
5523
451ad352b288 [project @ 2005-10-31 03:18:21 by jwe]
jwe
parents: 5520
diff changeset
806 for (int i = 0; i < nd; i++) \
4584
f7697d703481 [project @ 2003-10-31 19:47:35 by jwe]
jwe
parents: 4569
diff changeset
807 { \
5955
fc46f9c99028 [project @ 2006-08-22 18:37:43 by jwe]
jwe
parents: 5615
diff changeset
808 if (dv(i) == 0) \
4584
f7697d703481 [project @ 2003-10-31 19:47:35 by jwe]
jwe
parents: 4569
diff changeset
809 { \
5955
fc46f9c99028 [project @ 2006-08-22 18:37:43 by jwe]
jwe
parents: 5615
diff changeset
810 empty = true; \
4584
f7697d703481 [project @ 2003-10-31 19:47:35 by jwe]
jwe
parents: 4569
diff changeset
811 break; \
f7697d703481 [project @ 2003-10-31 19:47:35 by jwe]
jwe
parents: 4569
diff changeset
812 } \
f7697d703481 [project @ 2003-10-31 19:47:35 by jwe]
jwe
parents: 4569
diff changeset
813 } \
f7697d703481 [project @ 2003-10-31 19:47:35 by jwe]
jwe
parents: 4569
diff changeset
814 \
5523
451ad352b288 [project @ 2005-10-31 03:18:21 by jwe]
jwe
parents: 5520
diff changeset
815 /* We need to find first non-singleton dim. */ \
451ad352b288 [project @ 2005-10-31 03:18:21 by jwe]
jwe
parents: 5520
diff changeset
816 \
4584
f7697d703481 [project @ 2003-10-31 19:47:35 by jwe]
jwe
parents: 4569
diff changeset
817 if (dim == -1) \
f7697d703481 [project @ 2003-10-31 19:47:35 by jwe]
jwe
parents: 4569
diff changeset
818 { \
5523
451ad352b288 [project @ 2005-10-31 03:18:21 by jwe]
jwe
parents: 5520
diff changeset
819 dim = 0; \
451ad352b288 [project @ 2005-10-31 03:18:21 by jwe]
jwe
parents: 5520
diff changeset
820 \
451ad352b288 [project @ 2005-10-31 03:18:21 by jwe]
jwe
parents: 5520
diff changeset
821 for (int i = 0; i < nd; i++) \
4584
f7697d703481 [project @ 2003-10-31 19:47:35 by jwe]
jwe
parents: 4569
diff changeset
822 { \
5523
451ad352b288 [project @ 2005-10-31 03:18:21 by jwe]
jwe
parents: 5520
diff changeset
823 if (dv(i) != 1) \
4584
f7697d703481 [project @ 2003-10-31 19:47:35 by jwe]
jwe
parents: 4569
diff changeset
824 { \
f7697d703481 [project @ 2003-10-31 19:47:35 by jwe]
jwe
parents: 4569
diff changeset
825 dim = i; \
f7697d703481 [project @ 2003-10-31 19:47:35 by jwe]
jwe
parents: 4569
diff changeset
826 break; \
f7697d703481 [project @ 2003-10-31 19:47:35 by jwe]
jwe
parents: 4569
diff changeset
827 } \
f7697d703481 [project @ 2003-10-31 19:47:35 by jwe]
jwe
parents: 4569
diff changeset
828 } \
f7697d703481 [project @ 2003-10-31 19:47:35 by jwe]
jwe
parents: 4569
diff changeset
829 } \
5523
451ad352b288 [project @ 2005-10-31 03:18:21 by jwe]
jwe
parents: 5520
diff changeset
830 else if (dim >= nd) \
4584
f7697d703481 [project @ 2003-10-31 19:47:35 by jwe]
jwe
parents: 4569
diff changeset
831 { \
5523
451ad352b288 [project @ 2005-10-31 03:18:21 by jwe]
jwe
parents: 5520
diff changeset
832 dim = nd++; \
451ad352b288 [project @ 2005-10-31 03:18:21 by jwe]
jwe
parents: 5520
diff changeset
833 dv.resize (nd, 1); \
4584
f7697d703481 [project @ 2003-10-31 19:47:35 by jwe]
jwe
parents: 4569
diff changeset
834 } \
f7697d703481 [project @ 2003-10-31 19:47:35 by jwe]
jwe
parents: 4569
diff changeset
835 \
5523
451ad352b288 [project @ 2005-10-31 03:18:21 by jwe]
jwe
parents: 5520
diff changeset
836 /* R = op (A, DIM) \
4584
f7697d703481 [project @ 2003-10-31 19:47:35 by jwe]
jwe
parents: 4569
diff changeset
837 \
5523
451ad352b288 [project @ 2005-10-31 03:18:21 by jwe]
jwe
parents: 5520
diff changeset
838 The strategy here is to access the elements of A along the \
451ad352b288 [project @ 2005-10-31 03:18:21 by jwe]
jwe
parents: 5520
diff changeset
839 dimension specified by DIM. This means that we loop over each \
5611
5be3463fed41 [project @ 2006-02-09 19:12:14 by jwe]
jwe
parents: 5525
diff changeset
840 element of R and adjust the index into A as needed. Store the \
5614
4cc6aeb35f93 [project @ 2006-02-10 15:07:32 by jwe]
jwe
parents: 5611
diff changeset
841 cummulative product of all dimensions of A in CP_SZ. The last \
4cc6aeb35f93 [project @ 2006-02-10 15:07:32 by jwe]
jwe
parents: 5611
diff changeset
842 element of CP_SZ is the total number of elements of A. */ \
4584
f7697d703481 [project @ 2003-10-31 19:47:35 by jwe]
jwe
parents: 4569
diff changeset
843 \
5611
5be3463fed41 [project @ 2006-02-09 19:12:14 by jwe]
jwe
parents: 5525
diff changeset
844 Array<octave_idx_type> cp_sz (nd+1, 1); \
5be3463fed41 [project @ 2006-02-09 19:12:14 by jwe]
jwe
parents: 5525
diff changeset
845 for (int i = 1; i <= nd; i++) \
5523
451ad352b288 [project @ 2005-10-31 03:18:21 by jwe]
jwe
parents: 5520
diff changeset
846 cp_sz(i) = cp_sz(i-1)*dv(i-1); \
4584
f7697d703481 [project @ 2003-10-31 19:47:35 by jwe]
jwe
parents: 4569
diff changeset
847 \
5523
451ad352b288 [project @ 2005-10-31 03:18:21 by jwe]
jwe
parents: 5520
diff changeset
848 octave_idx_type reset_at = cp_sz(dim); \
451ad352b288 [project @ 2005-10-31 03:18:21 by jwe]
jwe
parents: 5520
diff changeset
849 octave_idx_type base_incr = cp_sz(dim+1); \
451ad352b288 [project @ 2005-10-31 03:18:21 by jwe]
jwe
parents: 5520
diff changeset
850 octave_idx_type incr = cp_sz(dim); \
451ad352b288 [project @ 2005-10-31 03:18:21 by jwe]
jwe
parents: 5520
diff changeset
851 octave_idx_type base = 0; \
451ad352b288 [project @ 2005-10-31 03:18:21 by jwe]
jwe
parents: 5520
diff changeset
852 octave_idx_type next_base = base + base_incr; \
451ad352b288 [project @ 2005-10-31 03:18:21 by jwe]
jwe
parents: 5520
diff changeset
853 octave_idx_type iter_idx = base; \
451ad352b288 [project @ 2005-10-31 03:18:21 by jwe]
jwe
parents: 5520
diff changeset
854 octave_idx_type n_elts = dv(dim); \
4584
f7697d703481 [project @ 2003-10-31 19:47:35 by jwe]
jwe
parents: 4569
diff changeset
855 \
5523
451ad352b288 [project @ 2005-10-31 03:18:21 by jwe]
jwe
parents: 5520
diff changeset
856 retval.resize (dv, INIT_VAL); \
451ad352b288 [project @ 2005-10-31 03:18:21 by jwe]
jwe
parents: 5520
diff changeset
857 \
5955
fc46f9c99028 [project @ 2006-08-22 18:37:43 by jwe]
jwe
parents: 5615
diff changeset
858 if (! empty) \
fc46f9c99028 [project @ 2006-08-22 18:37:43 by jwe]
jwe
parents: 5615
diff changeset
859 { \
fc46f9c99028 [project @ 2006-08-22 18:37:43 by jwe]
jwe
parents: 5615
diff changeset
860 octave_idx_type nel = dv.numel () / n_elts; \
5523
451ad352b288 [project @ 2005-10-31 03:18:21 by jwe]
jwe
parents: 5520
diff changeset
861 \
5955
fc46f9c99028 [project @ 2006-08-22 18:37:43 by jwe]
jwe
parents: 5615
diff changeset
862 octave_idx_type k = 1; \
4584
f7697d703481 [project @ 2003-10-31 19:47:35 by jwe]
jwe
parents: 4569
diff changeset
863 \
5955
fc46f9c99028 [project @ 2006-08-22 18:37:43 by jwe]
jwe
parents: 5615
diff changeset
864 for (octave_idx_type i = 0; i < nel; i++) \
fc46f9c99028 [project @ 2006-08-22 18:37:43 by jwe]
jwe
parents: 5615
diff changeset
865 { \
fc46f9c99028 [project @ 2006-08-22 18:37:43 by jwe]
jwe
parents: 5615
diff changeset
866 OCTAVE_QUIT; \
fc46f9c99028 [project @ 2006-08-22 18:37:43 by jwe]
jwe
parents: 5615
diff changeset
867 \
fc46f9c99028 [project @ 2006-08-22 18:37:43 by jwe]
jwe
parents: 5615
diff changeset
868 ACC_TYPE prev_val = INIT_VAL; \
fc46f9c99028 [project @ 2006-08-22 18:37:43 by jwe]
jwe
parents: 5615
diff changeset
869 \
fc46f9c99028 [project @ 2006-08-22 18:37:43 by jwe]
jwe
parents: 5615
diff changeset
870 for (octave_idx_type j = 0; j < n_elts; j++) \
fc46f9c99028 [project @ 2006-08-22 18:37:43 by jwe]
jwe
parents: 5615
diff changeset
871 { \
fc46f9c99028 [project @ 2006-08-22 18:37:43 by jwe]
jwe
parents: 5615
diff changeset
872 OCTAVE_QUIT; \
5523
451ad352b288 [project @ 2005-10-31 03:18:21 by jwe]
jwe
parents: 5520
diff changeset
873 \
5955
fc46f9c99028 [project @ 2006-08-22 18:37:43 by jwe]
jwe
parents: 5615
diff changeset
874 if (j == 0) \
fc46f9c99028 [project @ 2006-08-22 18:37:43 by jwe]
jwe
parents: 5615
diff changeset
875 { \
fc46f9c99028 [project @ 2006-08-22 18:37:43 by jwe]
jwe
parents: 5615
diff changeset
876 retval(iter_idx) = elem (iter_idx); \
fc46f9c99028 [project @ 2006-08-22 18:37:43 by jwe]
jwe
parents: 5615
diff changeset
877 prev_val = retval(iter_idx); \
fc46f9c99028 [project @ 2006-08-22 18:37:43 by jwe]
jwe
parents: 5615
diff changeset
878 } \
fc46f9c99028 [project @ 2006-08-22 18:37:43 by jwe]
jwe
parents: 5615
diff changeset
879 else \
fc46f9c99028 [project @ 2006-08-22 18:37:43 by jwe]
jwe
parents: 5615
diff changeset
880 { \
fc46f9c99028 [project @ 2006-08-22 18:37:43 by jwe]
jwe
parents: 5615
diff changeset
881 prev_val = prev_val OP elem (iter_idx); \
fc46f9c99028 [project @ 2006-08-22 18:37:43 by jwe]
jwe
parents: 5615
diff changeset
882 retval(iter_idx) = prev_val; \
fc46f9c99028 [project @ 2006-08-22 18:37:43 by jwe]
jwe
parents: 5615
diff changeset
883 } \
5523
451ad352b288 [project @ 2005-10-31 03:18:21 by jwe]
jwe
parents: 5520
diff changeset
884 \
5955
fc46f9c99028 [project @ 2006-08-22 18:37:43 by jwe]
jwe
parents: 5615
diff changeset
885 iter_idx += incr; \
fc46f9c99028 [project @ 2006-08-22 18:37:43 by jwe]
jwe
parents: 5615
diff changeset
886 } \
4584
f7697d703481 [project @ 2003-10-31 19:47:35 by jwe]
jwe
parents: 4569
diff changeset
887 \
5955
fc46f9c99028 [project @ 2006-08-22 18:37:43 by jwe]
jwe
parents: 5615
diff changeset
888 if (k == reset_at) \
5523
451ad352b288 [project @ 2005-10-31 03:18:21 by jwe]
jwe
parents: 5520
diff changeset
889 { \
5955
fc46f9c99028 [project @ 2006-08-22 18:37:43 by jwe]
jwe
parents: 5615
diff changeset
890 base = next_base; \
fc46f9c99028 [project @ 2006-08-22 18:37:43 by jwe]
jwe
parents: 5615
diff changeset
891 next_base += base_incr; \
fc46f9c99028 [project @ 2006-08-22 18:37:43 by jwe]
jwe
parents: 5615
diff changeset
892 iter_idx = base; \
fc46f9c99028 [project @ 2006-08-22 18:37:43 by jwe]
jwe
parents: 5615
diff changeset
893 k = 1; \
4584
f7697d703481 [project @ 2003-10-31 19:47:35 by jwe]
jwe
parents: 4569
diff changeset
894 } \
f7697d703481 [project @ 2003-10-31 19:47:35 by jwe]
jwe
parents: 4569
diff changeset
895 else \
5523
451ad352b288 [project @ 2005-10-31 03:18:21 by jwe]
jwe
parents: 5520
diff changeset
896 { \
5955
fc46f9c99028 [project @ 2006-08-22 18:37:43 by jwe]
jwe
parents: 5615
diff changeset
897 base++; \
fc46f9c99028 [project @ 2006-08-22 18:37:43 by jwe]
jwe
parents: 5615
diff changeset
898 iter_idx = base; \
fc46f9c99028 [project @ 2006-08-22 18:37:43 by jwe]
jwe
parents: 5615
diff changeset
899 k++; \
fc46f9c99028 [project @ 2006-08-22 18:37:43 by jwe]
jwe
parents: 5615
diff changeset
900 } \
4584
f7697d703481 [project @ 2003-10-31 19:47:35 by jwe]
jwe
parents: 4569
diff changeset
901 } \
5523
451ad352b288 [project @ 2005-10-31 03:18:21 by jwe]
jwe
parents: 5520
diff changeset
902 } \
4584
f7697d703481 [project @ 2003-10-31 19:47:35 by jwe]
jwe
parents: 4569
diff changeset
903 \
5523
451ad352b288 [project @ 2005-10-31 03:18:21 by jwe]
jwe
parents: 5520
diff changeset
904 retval.chop_trailing_singletons (); \
451ad352b288 [project @ 2005-10-31 03:18:21 by jwe]
jwe
parents: 5520
diff changeset
905 \
4584
f7697d703481 [project @ 2003-10-31 19:47:35 by jwe]
jwe
parents: 4569
diff changeset
906 return retval
f7697d703481 [project @ 2003-10-31 19:47:35 by jwe]
jwe
parents: 4569
diff changeset
907
2804
eedc2f3f61f7 [project @ 1997-03-11 04:34:50 by jwe]
jwe
parents: 2386
diff changeset
908 #endif
3
9a4c07481e61 [project @ 1993-08-08 01:20:23 by jwe]
jwe
parents:
diff changeset
909
9a4c07481e61 [project @ 1993-08-08 01:20:23 by jwe]
jwe
parents:
diff changeset
910 /*
9a4c07481e61 [project @ 1993-08-08 01:20:23 by jwe]
jwe
parents:
diff changeset
911 ;;; Local Variables: ***
9a4c07481e61 [project @ 1993-08-08 01:20:23 by jwe]
jwe
parents:
diff changeset
912 ;;; mode: C++ ***
9a4c07481e61 [project @ 1993-08-08 01:20:23 by jwe]
jwe
parents:
diff changeset
913 ;;; End: ***
9a4c07481e61 [project @ 1993-08-08 01:20:23 by jwe]
jwe
parents:
diff changeset
914 */