comparison src/DLD-FUNCTIONS/minmax.cc @ 4869:b92d59213e63

[project @ 2004-04-21 17:03:02 by jwe]
author jwe
date Wed, 21 Apr 2004 17:03:02 +0000
parents 9f7ef92b50b0
children 23b37da9fd5b
comparison
equal deleted inserted replaced
4868:0d7b436d0e87 4869:b92d59213e63
98 dim = 0; \ 98 dim = 0; \
99 } \ 99 } \
100 \ 100 \
101 bool single_arg = (nargin == 1) || arg2.is_empty(); \ 101 bool single_arg = (nargin == 1) || arg2.is_empty(); \
102 \ 102 \
103 if (single_arg) \
104 { \
105 dv(dim) = 1; \
106 int n_dims = dv.length (); \
107 for (int i = n_dims; i > 1; i--) \
108 { \
109 if (dv(i-1) == 1) \
110 n_dims--; \
111 else \
112 break; \
113 } \
114 dv.resize (n_dims); \
115 } \
116 \
117 if (single_arg && (nargout == 1 || nargout == 0)) \ 103 if (single_arg && (nargout == 1 || nargout == 0)) \
118 { \ 104 { \
119 if (arg1.is_real_type ()) \ 105 if (arg1.is_real_type ()) \
120 { \ 106 { \
121 NDArray m = arg1.array_value (); \ 107 NDArray m = arg1.array_value (); \
122 \ 108 \
123 if (! error_state) \ 109 if (! error_state) \
124 { \ 110 { \
125 NDArray n = m. FCN (dim); \ 111 NDArray n = m. FCN (dim); \
126 n.resize (dv); \
127 retval(0) = n; \ 112 retval(0) = n; \
128 } \ 113 } \
129 } \ 114 } \
130 else if (arg1.is_complex_type ()) \ 115 else if (arg1.is_complex_type ()) \
131 { \ 116 { \
132 ComplexNDArray m = arg1.complex_array_value (); \ 117 ComplexNDArray m = arg1.complex_array_value (); \
133 \ 118 \
134 if (! error_state) \ 119 if (! error_state) \
135 { \ 120 { \
136 ComplexNDArray n = m. FCN (dim); \ 121 ComplexNDArray n = m. FCN (dim); \
137 n.resize (dv); \
138 retval(0) = n; \ 122 retval(0) = n; \
139 } \ 123 } \
140 } \ 124 } \
141 else \ 125 else \
142 gripe_wrong_type_arg (#FCN, arg1); \ 126 gripe_wrong_type_arg (#FCN, arg1); \
150 NDArray m = arg1.array_value (); \ 134 NDArray m = arg1.array_value (); \
151 \ 135 \
152 if (! error_state) \ 136 if (! error_state) \
153 { \ 137 { \
154 NDArray n = m. FCN (index, dim); \ 138 NDArray n = m. FCN (index, dim); \
155 n.resize (dv); \
156 retval(0) = n; \ 139 retval(0) = n; \
157 } \ 140 } \
158 } \ 141 } \
159 else if (arg1.is_complex_type ()) \ 142 else if (arg1.is_complex_type ()) \
160 { \ 143 { \
161 ComplexNDArray m = arg1.complex_array_value (); \ 144 ComplexNDArray m = arg1.complex_array_value (); \
162 \ 145 \
163 if (! error_state) \ 146 if (! error_state) \
164 { \ 147 { \
165 ComplexNDArray n = m. FCN (index, dim); \ 148 ComplexNDArray n = m. FCN (index, dim); \
166 n.resize (dv); \
167 retval(0) = n; \ 149 retval(0) = n; \
168 } \ 150 } \
169 } \ 151 } \
170 else \ 152 else \
171 gripe_wrong_type_arg (#FCN, arg1); \ 153 gripe_wrong_type_arg (#FCN, arg1); \