523
|
1 /* |
|
2 |
2847
|
3 Copyright (C) 1996, 1997 John W. Eaton |
523
|
4 |
|
5 This file is part of Octave. |
|
6 |
|
7 Octave is free software; you can redistribute it and/or modify it |
|
8 under the terms of the GNU General Public License as published by the |
|
9 Free Software Foundation; either version 2, or (at your option) any |
|
10 later version. |
|
11 |
|
12 Octave is distributed in the hope that it will be useful, but WITHOUT |
|
13 ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or |
|
14 FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License |
|
15 for more details. |
|
16 |
|
17 You should have received a copy of the GNU General Public License |
|
18 along with Octave; see the file COPYING. If not, write to the Free |
1315
|
19 Software Foundation, 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. |
523
|
20 |
|
21 */ |
|
22 |
|
23 #ifdef HAVE_CONFIG_H |
1192
|
24 #include <config.h> |
523
|
25 #endif |
|
26 |
2184
|
27 #include <cfloat> |
|
28 #include <cmath> |
|
29 |
1728
|
30 #include <string> |
|
31 |
2184
|
32 #include "lo-ieee.h" |
1755
|
33 #include "str-vec.h" |
|
34 |
1352
|
35 #include "defun.h" |
|
36 #include "error.h" |
|
37 #include "gripes.h" |
|
38 #include "oct-map.h" |
2366
|
39 #include "ov.h" |
|
40 #include "variables.h" |
1742
|
41 #include "oct-obj.h" |
523
|
42 #include "utils.h" |
|
43 |
|
44 #ifndef MIN |
|
45 #define MIN(a,b) ((a) < (b) ? (a) : (b)) |
|
46 #endif |
|
47 |
767
|
48 #ifndef ABS |
|
49 #define ABS(x) (((x) < 0) ? (-x) : (x)) |
|
50 #endif |
|
51 |
2188
|
52 // Should expressions like ones (-1, 5) result in an empty matrix or |
|
53 // an error? A positive value means yes. A negative value means |
|
54 // yes, but print a warning message. Zero means it should be |
|
55 // considered an error. |
|
56 static int Vtreat_neg_dim_as_zero; |
|
57 |
1957
|
58 DEFUN (all, args, , |
523
|
59 "all (X): are all elements of X nonzero?") |
|
60 { |
2086
|
61 octave_value_list retval; |
523
|
62 |
|
63 int nargin = args.length (); |
|
64 |
712
|
65 if (nargin == 1 && args(0).is_defined ()) |
|
66 retval = args(0).all (); |
|
67 else |
523
|
68 print_usage ("all"); |
|
69 |
|
70 return retval; |
|
71 } |
|
72 |
1957
|
73 DEFUN (any, args, , |
523
|
74 "any (X): are any elements of X nonzero?") |
|
75 { |
2086
|
76 octave_value_list retval; |
523
|
77 |
|
78 int nargin = args.length (); |
|
79 |
712
|
80 if (nargin == 1 && args(0).is_defined ()) |
|
81 retval = args(0).any (); |
|
82 else |
523
|
83 print_usage ("any"); |
|
84 |
|
85 return retval; |
|
86 } |
|
87 |
649
|
88 // These mapping functions may also be useful in other places, eh? |
|
89 |
|
90 typedef double (*d_dd_fcn) (double, double); |
|
91 |
|
92 static Matrix |
2672
|
93 map_d_m (d_dd_fcn f, double x, const Matrix& y) |
649
|
94 { |
|
95 int nr = y.rows (); |
|
96 int nc = y.columns (); |
|
97 |
|
98 Matrix retval (nr, nc); |
|
99 |
|
100 for (int j = 0; j < nc; j++) |
|
101 for (int i = 0; i < nr; i++) |
2305
|
102 retval (i, j) = f (x, y (i, j)); |
649
|
103 |
|
104 return retval; |
|
105 } |
|
106 |
|
107 static Matrix |
2672
|
108 map_m_d (d_dd_fcn f, const Matrix& x, double y) |
649
|
109 { |
|
110 int nr = x.rows (); |
|
111 int nc = x.columns (); |
|
112 |
|
113 Matrix retval (nr, nc); |
|
114 |
|
115 for (int j = 0; j < nc; j++) |
|
116 for (int i = 0; i < nr; i++) |
2305
|
117 retval (i, j) = f (x (i, j), y); |
649
|
118 |
|
119 return retval; |
|
120 } |
|
121 |
|
122 static Matrix |
2672
|
123 map_m_m (d_dd_fcn f, const Matrix& x, const Matrix& y) |
649
|
124 { |
|
125 int x_nr = x.rows (); |
|
126 int x_nc = x.columns (); |
|
127 |
|
128 int y_nr = y.rows (); |
|
129 int y_nc = y.columns (); |
|
130 |
719
|
131 assert (x_nr == y_nr && x_nc == y_nc); |
649
|
132 |
|
133 Matrix retval (x_nr, x_nc); |
|
134 |
|
135 for (int j = 0; j < x_nc; j++) |
|
136 for (int i = 0; i < x_nr; i++) |
2305
|
137 retval (i, j) = f (x (i, j), y (i, j)); |
649
|
138 |
|
139 return retval; |
|
140 } |
|
141 |
1957
|
142 DEFUN (atan2, args, , |
649
|
143 "atan2 (Y, X): atan (Y / X) in range -pi to pi") |
|
144 { |
2086
|
145 octave_value_list retval; |
649
|
146 |
712
|
147 int nargin = args.length (); |
|
148 |
|
149 if (nargin == 2 && args(0).is_defined () && args(1).is_defined ()) |
649
|
150 { |
2086
|
151 octave_value arg_y = args(0); |
|
152 octave_value arg_x = args(1); |
649
|
153 |
|
154 int y_nr = arg_y.rows (); |
|
155 int y_nc = arg_y.columns (); |
|
156 |
|
157 int x_nr = arg_x.rows (); |
|
158 int x_nc = arg_x.columns (); |
|
159 |
|
160 int arg_y_empty = empty_arg ("atan2", y_nr, y_nc); |
|
161 int arg_x_empty = empty_arg ("atan2", x_nr, x_nc); |
|
162 |
719
|
163 if (arg_y_empty > 0 && arg_x_empty > 0) |
|
164 return Matrix (); |
|
165 else if (arg_y_empty || arg_x_empty) |
649
|
166 return retval; |
|
167 |
|
168 int y_is_scalar = (y_nr == 1 && y_nc == 1); |
|
169 int x_is_scalar = (x_nr == 1 && x_nc == 1); |
|
170 |
|
171 if (y_is_scalar && x_is_scalar) |
|
172 { |
|
173 double y = arg_y.double_value (); |
|
174 |
|
175 if (! error_state) |
|
176 { |
|
177 double x = arg_x.double_value (); |
|
178 |
|
179 if (! error_state) |
|
180 retval = atan2 (y, x); |
|
181 } |
|
182 } |
|
183 else if (y_is_scalar) |
|
184 { |
|
185 double y = arg_y.double_value (); |
|
186 |
|
187 if (! error_state) |
|
188 { |
|
189 Matrix x = arg_x.matrix_value (); |
|
190 |
|
191 if (! error_state) |
2672
|
192 retval = map_d_m (atan2, y, x); |
649
|
193 } |
|
194 } |
|
195 else if (x_is_scalar) |
|
196 { |
|
197 Matrix y = arg_y.matrix_value (); |
|
198 |
|
199 if (! error_state) |
|
200 { |
|
201 double x = arg_x.double_value (); |
|
202 |
|
203 if (! error_state) |
2672
|
204 retval = map_m_d (atan2, y, x); |
649
|
205 } |
|
206 } |
|
207 else if (y_nr == x_nr && y_nc == x_nc) |
|
208 { |
|
209 Matrix y = arg_y.matrix_value (); |
|
210 |
|
211 if (! error_state) |
|
212 { |
|
213 Matrix x = arg_x.matrix_value (); |
|
214 |
|
215 if (! error_state) |
2672
|
216 retval = map_m_m (atan2, y, x); |
649
|
217 } |
|
218 } |
|
219 else |
|
220 error ("atan2: nonconformant matrices"); |
|
221 } |
712
|
222 else |
|
223 print_usage ("atan2"); |
649
|
224 |
|
225 return retval; |
|
226 } |
|
227 |
1957
|
228 DEFUN (cumprod, args, , |
523
|
229 "cumprod (X): cumulative products") |
|
230 { |
2086
|
231 octave_value_list retval; |
523
|
232 |
|
233 int nargin = args.length (); |
|
234 |
760
|
235 if (nargin == 1) |
|
236 { |
2086
|
237 octave_value arg = args(0); |
760
|
238 |
|
239 if (arg.is_real_type ()) |
|
240 { |
|
241 Matrix tmp = arg.matrix_value (); |
|
242 |
|
243 if (! error_state) |
|
244 retval(0) = tmp.cumprod (); |
|
245 } |
|
246 else if (arg.is_complex_type ()) |
|
247 { |
|
248 ComplexMatrix tmp = arg.complex_matrix_value (); |
|
249 |
|
250 if (! error_state) |
|
251 retval(0) = tmp.cumprod (); |
|
252 } |
|
253 else |
|
254 { |
|
255 gripe_wrong_type_arg ("cumprod", arg); |
|
256 return retval; |
|
257 } |
|
258 } |
712
|
259 else |
523
|
260 print_usage ("cumprod"); |
|
261 |
|
262 return retval; |
|
263 } |
|
264 |
1957
|
265 DEFUN (cumsum, args, , |
523
|
266 "cumsum (X): cumulative sums") |
|
267 { |
2086
|
268 octave_value_list retval; |
523
|
269 |
|
270 int nargin = args.length (); |
|
271 |
760
|
272 if (nargin == 1) |
|
273 { |
2086
|
274 octave_value arg = args(0); |
760
|
275 |
|
276 if (arg.is_real_type ()) |
|
277 { |
|
278 Matrix tmp = arg.matrix_value (); |
|
279 |
|
280 if (! error_state) |
|
281 retval(0) = tmp.cumsum (); |
|
282 } |
|
283 else if (arg.is_complex_type ()) |
|
284 { |
|
285 ComplexMatrix tmp = arg.complex_matrix_value (); |
|
286 |
|
287 if (! error_state) |
|
288 retval(0) = tmp.cumsum (); |
|
289 } |
|
290 else |
|
291 { |
|
292 gripe_wrong_type_arg ("cumsum", arg); |
|
293 return retval; |
|
294 } |
|
295 } |
712
|
296 else |
523
|
297 print_usage ("cumsum"); |
|
298 |
|
299 return retval; |
|
300 } |
|
301 |
2086
|
302 static octave_value |
767
|
303 make_diag (const Matrix& v, int k) |
|
304 { |
|
305 int nr = v.rows (); |
|
306 int nc = v.columns (); |
|
307 assert (nc == 1 || nr == 1); |
|
308 |
2086
|
309 octave_value retval; |
767
|
310 |
|
311 int roff = 0; |
|
312 int coff = 0; |
|
313 if (k > 0) |
|
314 { |
|
315 roff = 0; |
|
316 coff = k; |
|
317 } |
|
318 else if (k < 0) |
|
319 { |
|
320 roff = -k; |
|
321 coff = 0; |
|
322 } |
|
323 |
|
324 if (nr == 1) |
|
325 { |
|
326 int n = nc + ABS (k); |
|
327 Matrix m (n, n, 0.0); |
|
328 for (int i = 0; i < nc; i++) |
2305
|
329 m (i+roff, i+coff) = v (0, i); |
2086
|
330 retval = octave_value (m); |
767
|
331 } |
|
332 else |
|
333 { |
|
334 int n = nr + ABS (k); |
|
335 Matrix m (n, n, 0.0); |
|
336 for (int i = 0; i < nr; i++) |
2305
|
337 m (i+roff, i+coff) = v (i, 0); |
2086
|
338 retval = octave_value (m); |
767
|
339 } |
|
340 |
|
341 return retval; |
|
342 } |
|
343 |
2086
|
344 static octave_value |
767
|
345 make_diag (const ComplexMatrix& v, int k) |
|
346 { |
|
347 int nr = v.rows (); |
|
348 int nc = v.columns (); |
|
349 assert (nc == 1 || nr == 1); |
|
350 |
2086
|
351 octave_value retval; |
767
|
352 |
|
353 int roff = 0; |
|
354 int coff = 0; |
|
355 if (k > 0) |
|
356 { |
|
357 roff = 0; |
|
358 coff = k; |
|
359 } |
|
360 else if (k < 0) |
|
361 { |
|
362 roff = -k; |
|
363 coff = 0; |
|
364 } |
|
365 |
|
366 if (nr == 1) |
|
367 { |
|
368 int n = nc + ABS (k); |
|
369 ComplexMatrix m (n, n, 0.0); |
|
370 for (int i = 0; i < nc; i++) |
2305
|
371 m (i+roff, i+coff) = v (0, i); |
2086
|
372 retval = octave_value (m); |
767
|
373 } |
|
374 else |
|
375 { |
|
376 int n = nr + ABS (k); |
|
377 ComplexMatrix m (n, n, 0.0); |
|
378 for (int i = 0; i < nr; i++) |
2305
|
379 m (i+roff, i+coff) = v (i, 0); |
2086
|
380 retval = octave_value (m); |
767
|
381 } |
|
382 |
|
383 return retval; |
|
384 } |
|
385 |
2086
|
386 static octave_value |
|
387 make_diag (const octave_value& arg) |
767
|
388 { |
2086
|
389 octave_value retval; |
767
|
390 |
|
391 if (arg.is_real_type ()) |
|
392 { |
|
393 Matrix m = arg.matrix_value (); |
|
394 |
|
395 if (! error_state) |
|
396 { |
|
397 int nr = m.rows (); |
|
398 int nc = m.columns (); |
|
399 |
|
400 if (nr == 0 || nc == 0) |
|
401 retval = Matrix (); |
|
402 else if (nr == 1 || nc == 1) |
|
403 retval = make_diag (m, 0); |
|
404 else |
|
405 { |
|
406 ColumnVector v = m.diag (); |
|
407 if (v.capacity () > 0) |
|
408 retval = v; |
|
409 } |
|
410 } |
|
411 else |
|
412 gripe_wrong_type_arg ("diag", arg); |
|
413 } |
|
414 else if (arg.is_complex_type ()) |
|
415 { |
|
416 ComplexMatrix cm = arg.complex_matrix_value (); |
|
417 |
|
418 if (! error_state) |
|
419 { |
|
420 int nr = cm.rows (); |
|
421 int nc = cm.columns (); |
|
422 |
|
423 if (nr == 0 || nc == 0) |
|
424 retval = Matrix (); |
|
425 else if (nr == 1 || nc == 1) |
|
426 retval = make_diag (cm, 0); |
|
427 else |
|
428 { |
|
429 ComplexColumnVector v = cm.diag (); |
|
430 if (v.capacity () > 0) |
|
431 retval = v; |
|
432 } |
|
433 } |
|
434 else |
|
435 gripe_wrong_type_arg ("diag", arg); |
|
436 } |
|
437 else |
|
438 gripe_wrong_type_arg ("diag", arg); |
|
439 |
|
440 return retval; |
|
441 } |
|
442 |
2086
|
443 static octave_value |
|
444 make_diag (const octave_value& a, const octave_value& b) |
767
|
445 { |
2086
|
446 octave_value retval; |
767
|
447 |
3202
|
448 int k = b.nint_value (); |
767
|
449 |
|
450 if (error_state) |
|
451 { |
|
452 error ("diag: invalid second argument"); |
|
453 return retval; |
|
454 } |
|
455 |
|
456 if (a.is_real_type ()) |
|
457 { |
3307
|
458 Matrix m = a.matrix_value (); |
767
|
459 |
3307
|
460 if (! error_state) |
767
|
461 { |
|
462 int nr = m.rows (); |
|
463 int nc = m.columns (); |
|
464 |
|
465 if (nr == 0 || nc == 0) |
|
466 retval = Matrix (); |
|
467 else if (nr == 1 || nc == 1) |
|
468 retval = make_diag (m, k); |
|
469 else |
|
470 { |
|
471 ColumnVector d = m.diag (k); |
|
472 retval = d; |
|
473 } |
|
474 } |
|
475 } |
|
476 else if (a.is_complex_type ()) |
|
477 { |
3307
|
478 ComplexMatrix cm = a.complex_matrix_value (); |
767
|
479 |
3307
|
480 if (! error_state) |
767
|
481 { |
|
482 int nr = cm.rows (); |
|
483 int nc = cm.columns (); |
|
484 |
|
485 if (nr == 0 || nc == 0) |
|
486 retval = Matrix (); |
|
487 else if (nr == 1 || nc == 1) |
|
488 retval = make_diag (cm, k); |
|
489 else |
|
490 { |
|
491 ComplexColumnVector d = cm.diag (k); |
|
492 retval = d; |
|
493 } |
|
494 } |
|
495 } |
|
496 else |
|
497 gripe_wrong_type_arg ("diag", a); |
|
498 |
|
499 return retval; |
|
500 } |
|
501 |
1957
|
502 DEFUN (diag, args, , |
523
|
503 "diag (X [,k]): form/extract diagonals") |
|
504 { |
2086
|
505 octave_value_list retval; |
523
|
506 |
|
507 int nargin = args.length (); |
|
508 |
712
|
509 if (nargin == 1 && args(0).is_defined ()) |
767
|
510 retval = make_diag (args(0)); |
712
|
511 else if (nargin == 2 && args(0).is_defined () && args(1).is_defined ()) |
767
|
512 retval = make_diag (args(0), args(1)); |
523
|
513 else |
|
514 print_usage ("diag"); |
|
515 |
|
516 return retval; |
|
517 } |
|
518 |
1957
|
519 DEFUN (prod, args, , |
523
|
520 "prod (X): products") |
|
521 { |
2086
|
522 octave_value_list retval; |
523
|
523 |
|
524 int nargin = args.length (); |
|
525 |
760
|
526 if (nargin == 1) |
|
527 { |
2086
|
528 octave_value arg = args(0); |
760
|
529 |
|
530 if (arg.is_real_type ()) |
|
531 { |
|
532 Matrix tmp = arg.matrix_value (); |
|
533 |
|
534 if (! error_state) |
|
535 retval(0) = tmp.prod (); |
|
536 } |
|
537 else if (arg.is_complex_type ()) |
|
538 { |
|
539 ComplexMatrix tmp = arg.complex_matrix_value (); |
|
540 |
|
541 if (! error_state) |
|
542 retval(0) = tmp.prod (); |
|
543 } |
|
544 else |
|
545 { |
|
546 gripe_wrong_type_arg ("prod", arg); |
|
547 return retval; |
|
548 } |
|
549 } |
712
|
550 else |
523
|
551 print_usage ("prod"); |
|
552 |
|
553 return retval; |
|
554 } |
|
555 |
3195
|
556 DEFUN (length, args, , |
|
557 "length (x): return the `length' of the object X\n\ |
|
558 \n\ |
|
559 For matrix objects, the length is the number of rows or columns,\n\ |
|
560 whichever is greater (this odd definition is used for compatibility\n\ |
|
561 with Matlab).\n\ |
|
562 \n\ |
|
563 See also: size, rows, columns, is_scalar, is_vector, is_matrix") |
|
564 { |
|
565 octave_value retval; |
|
566 |
|
567 if (args.length () == 1) |
|
568 { |
|
569 int len = args(0).length (); |
|
570 |
|
571 if (! error_state) |
|
572 retval = static_cast<double> (len); |
|
573 } |
|
574 else |
|
575 print_usage ("length"); |
|
576 |
|
577 return retval; |
|
578 } |
|
579 |
1957
|
580 DEFUN (size, args, nargout, |
1032
|
581 "[m, n] = size (x): return rows and columns of X\n\ |
1031
|
582 \n\ |
|
583 d = size (x): return number of rows and columns of x as a row vector\n\ |
|
584 \n\ |
|
585 m = size (x, 1): return number of rows in x\n\ |
|
586 m = size (x, 2): return number of columns in x") |
523
|
587 { |
2086
|
588 octave_value_list retval; |
523
|
589 |
|
590 int nargin = args.length (); |
|
591 |
1031
|
592 if (nargin == 1 && nargout < 3) |
523
|
593 { |
712
|
594 int nr = args(0).rows (); |
|
595 int nc = args(0).columns (); |
1031
|
596 |
712
|
597 if (nargout == 0 || nargout == 1) |
523
|
598 { |
712
|
599 Matrix m (1, 2); |
2305
|
600 m (0, 0) = nr; |
|
601 m (0, 1) = nc; |
712
|
602 retval = m; |
523
|
603 } |
712
|
604 else if (nargout == 2) |
|
605 { |
2800
|
606 retval(1) = static_cast<double> (nc); |
|
607 retval(0) = static_cast<double> (nr); |
712
|
608 } |
1031
|
609 } |
|
610 else if (nargin == 2 && nargout < 2) |
|
611 { |
3202
|
612 int nd = args(1).nint_value (); |
1031
|
613 |
|
614 if (error_state) |
|
615 error ("size: expecting scalar as second argument"); |
712
|
616 else |
1031
|
617 { |
|
618 if (nd == 1) |
2800
|
619 retval(0) = static_cast<double> (args(0).rows ()); |
1031
|
620 else if (nd == 2) |
2800
|
621 retval(0) = static_cast<double> (args(0).columns ()); |
1031
|
622 else |
|
623 error ("size: invalid second argument -- expecting 1 or 2"); |
|
624 } |
523
|
625 } |
712
|
626 else |
|
627 print_usage ("size"); |
523
|
628 |
|
629 return retval; |
|
630 } |
|
631 |
1957
|
632 DEFUN (sum, args, , |
523
|
633 "sum (X): sum of elements") |
|
634 { |
2086
|
635 octave_value_list retval; |
523
|
636 |
|
637 int nargin = args.length (); |
|
638 |
760
|
639 if (nargin == 1) |
|
640 { |
2086
|
641 octave_value arg = args(0); |
760
|
642 |
|
643 if (arg.is_real_type ()) |
|
644 { |
|
645 Matrix tmp = arg.matrix_value (); |
|
646 |
|
647 if (! error_state) |
|
648 retval(0) = tmp.sum (); |
|
649 } |
|
650 else if (arg.is_complex_type ()) |
|
651 { |
|
652 ComplexMatrix tmp = arg.complex_matrix_value (); |
|
653 |
|
654 if (! error_state) |
|
655 retval(0) = tmp.sum (); |
|
656 } |
|
657 else |
|
658 { |
|
659 gripe_wrong_type_arg ("sum", arg); |
|
660 return retval; |
|
661 } |
|
662 } |
523
|
663 else |
712
|
664 print_usage ("sum"); |
523
|
665 |
|
666 return retval; |
|
667 } |
|
668 |
1957
|
669 DEFUN (sumsq, args, , |
3095
|
670 "sumsq (X): sum of squares of elements.\n\ |
|
671 \n\ |
|
672 This function is equivalent to computing\n\ |
|
673 \n\ |
|
674 sum (X .* conj (X))\n\ |
|
675 \n\ |
|
676 but it uses less memory and avoids calling conj if X is real.") |
523
|
677 { |
2086
|
678 octave_value_list retval; |
523
|
679 |
|
680 int nargin = args.length (); |
|
681 |
760
|
682 if (nargin == 1) |
|
683 { |
2086
|
684 octave_value arg = args(0); |
760
|
685 |
|
686 if (arg.is_real_type ()) |
|
687 { |
|
688 Matrix tmp = arg.matrix_value (); |
|
689 |
|
690 if (! error_state) |
|
691 retval(0) = tmp.sumsq (); |
|
692 } |
|
693 else if (arg.is_complex_type ()) |
|
694 { |
|
695 ComplexMatrix tmp = arg.complex_matrix_value (); |
|
696 |
|
697 if (! error_state) |
|
698 retval(0) = tmp.sumsq (); |
|
699 } |
|
700 else |
|
701 { |
|
702 gripe_wrong_type_arg ("sumsq", arg); |
|
703 return retval; |
|
704 } |
|
705 } |
712
|
706 else |
523
|
707 print_usage ("sumsq"); |
|
708 |
|
709 return retval; |
|
710 } |
|
711 |
3209
|
712 DEFUN (is_bool, args, , |
|
713 "is_bool (x): return nonzero if x is a boolean object") |
|
714 { |
|
715 octave_value retval; |
|
716 |
|
717 if (args.length () == 1) |
3258
|
718 retval = args(0).is_bool_type (); |
3209
|
719 else |
|
720 print_usage ("is_bool"); |
|
721 |
|
722 return retval; |
|
723 } |
|
724 |
|
725 DEFALIAS (islogical, is_bool); |
|
726 |
3186
|
727 DEFUN (is_complex, args, , |
3258
|
728 "is_complex (x): return nonzero if x is a complex-valued numeric object") |
3186
|
729 { |
|
730 octave_value retval; |
|
731 |
|
732 if (args.length () == 1) |
3258
|
733 retval = args(0).is_complex_type (); |
3186
|
734 else |
|
735 print_usage ("is_complex"); |
|
736 |
|
737 return retval; |
|
738 } |
|
739 |
3258
|
740 DEFUN (isreal, args, , |
|
741 "isreal (x): return nonzero if x is a real-valued numeric object") |
|
742 { |
|
743 octave_value retval; |
|
744 |
|
745 if (args.length () == 1) |
|
746 retval = args(0).is_real_type (); |
|
747 else |
|
748 print_usage ("isreal"); |
|
749 |
|
750 return retval; |
|
751 } |
|
752 |
3202
|
753 DEFUN (isempty, args, , |
3215
|
754 "isempty (x): return nonzero if x is an empty matrix, string, or list") |
3202
|
755 { |
|
756 double retval = 0.0; |
|
757 |
|
758 if (args.length () == 1) |
|
759 { |
|
760 octave_value arg = args(0); |
|
761 |
|
762 if (arg.is_matrix_type ()) |
|
763 retval = static_cast<double> (arg.rows () == 0 || arg.columns () == 0); |
3215
|
764 else if (arg.is_list () || arg.is_string ()) |
3202
|
765 retval = static_cast<double> (arg.length () == 0); |
|
766 } |
|
767 else |
|
768 print_usage ("isempty"); |
|
769 |
|
770 return retval; |
|
771 } |
|
772 |
3206
|
773 DEFUN (isnumeric, args, , |
|
774 "isnumeric (x): return nonzero if x is a numeric object") |
|
775 { |
|
776 octave_value retval; |
|
777 |
|
778 if (args.length () == 1) |
3258
|
779 retval = args(0).is_numeric_type (); |
3206
|
780 else |
3238
|
781 print_usage ("isnumeric"); |
3206
|
782 |
|
783 return retval; |
|
784 } |
|
785 |
3204
|
786 DEFUN (is_list, args, , |
|
787 "is_list (x): return nonzero if x is a list") |
|
788 { |
|
789 octave_value retval; |
|
790 |
|
791 if (args.length () == 1) |
3258
|
792 retval = args(0).is_list (); |
3204
|
793 else |
|
794 print_usage ("is_list"); |
|
795 |
|
796 return retval; |
|
797 } |
|
798 |
3202
|
799 DEFUN (is_matrix, args, , |
3321
|
800 "-*- texinfo -*-\n\ |
|
801 @deftypefn {Usage} {} is_matrix (@var{a})\n\ |
|
802 Return 1 if @var{a} is a matrix. Otherwise, return 0.\n\ |
|
803 @end deftypefn\n\ |
|
804 ") |
3202
|
805 { |
|
806 double retval = 0.0; |
|
807 |
|
808 if (args.length () == 1) |
|
809 { |
|
810 octave_value arg = args(0); |
|
811 |
3212
|
812 if (arg.is_scalar_type () || arg.is_range ()) |
3202
|
813 retval = 1.0; |
|
814 else if (arg.is_matrix_type ()) |
|
815 retval = static_cast<double> (arg.rows () >= 1 && arg.columns () >= 1); |
|
816 } |
|
817 else |
|
818 print_usage ("is_matrix"); |
|
819 |
|
820 return retval; |
|
821 } |
|
822 |
1957
|
823 DEFUN (is_struct, args, , |
939
|
824 "is_struct (x): return nonzero if x is a structure") |
|
825 { |
3186
|
826 octave_value retval; |
939
|
827 |
3186
|
828 if (args.length () == 1) |
3258
|
829 retval = args(0).is_map (); |
939
|
830 else |
|
831 print_usage ("is_struct"); |
|
832 |
|
833 return retval; |
|
834 } |
|
835 |
1957
|
836 DEFUN (struct_elements, args, , |
1402
|
837 "struct_elements (S)\n\ |
|
838 \n\ |
|
839 Return a list of the names of the elements of the structure S.") |
|
840 { |
2086
|
841 octave_value_list retval; |
1402
|
842 |
|
843 int nargin = args.length (); |
|
844 |
|
845 if (nargin == 1) |
|
846 { |
|
847 if (args (0).is_map ()) |
|
848 { |
|
849 Octave_map m = args(0).map_value (); |
1755
|
850 retval(0) = m.make_name_list (); |
1402
|
851 } |
|
852 else |
|
853 gripe_wrong_type_arg ("struct_elements", args (0)); |
|
854 } |
|
855 else |
|
856 print_usage ("struct_elements"); |
|
857 |
|
858 return retval; |
|
859 } |
|
860 |
1957
|
861 DEFUN (struct_contains, args, , |
1216
|
862 "struct_contains (S, NAME)\n\ |
|
863 \n\ |
2420
|
864 Return nonzero if S is a structure with element NAME.\n\ |
|
865 S must be a structure and NAME must be a string.") |
1216
|
866 { |
2086
|
867 octave_value_list retval; |
1216
|
868 |
|
869 int nargin = args.length (); |
|
870 |
|
871 if (nargin == 2) |
|
872 { |
|
873 retval = 0.0; |
2420
|
874 |
2963
|
875 // XXX FIXME XXX -- should this work for all types that can do |
|
876 // structure reference operations? |
|
877 |
1277
|
878 if (args(0).is_map () && args(1).is_string ()) |
1216
|
879 { |
1755
|
880 string s = args(1).string_value (); |
2963
|
881 octave_value tmp = args(0).do_struct_elt_index_op (s, true); |
2800
|
882 retval = static_cast<double> (tmp.is_defined ()); |
1216
|
883 } |
2420
|
884 else |
|
885 print_usage ("struct_contains"); |
1216
|
886 } |
|
887 else |
|
888 print_usage ("struct_contains"); |
|
889 |
|
890 return retval; |
|
891 } |
|
892 |
523
|
893 static void |
|
894 check_dimensions (int& nr, int& nc, const char *warnfor) |
|
895 { |
|
896 if (nr < 0 || nc < 0) |
|
897 { |
2188
|
898 if (Vtreat_neg_dim_as_zero) |
597
|
899 { |
|
900 nr = (nr < 0) ? 0 : nr; |
|
901 nc = (nc < 0) ? 0 : nc; |
1129
|
902 |
2188
|
903 if (Vtreat_neg_dim_as_zero < 0) |
1129
|
904 warning ("%s: converting negative dimension to zero", |
|
905 warnfor); |
597
|
906 } |
523
|
907 else |
|
908 error ("%s: can't create a matrix with negative dimensions", |
|
909 warnfor); |
|
910 } |
|
911 } |
|
912 |
|
913 static void |
2086
|
914 get_dimensions (const octave_value& a, const char *warn_for, |
523
|
915 int& nr, int& nc) |
|
916 { |
634
|
917 if (a.is_scalar_type ()) |
523
|
918 { |
3202
|
919 nr = nc = a.nint_value (); |
523
|
920 } |
|
921 else |
|
922 { |
634
|
923 nr = a.rows (); |
|
924 nc = a.columns (); |
523
|
925 |
|
926 if ((nr == 1 && nc == 2) || (nr == 2 && nc == 1)) |
|
927 { |
634
|
928 ColumnVector v = a.vector_value (); |
523
|
929 |
633
|
930 if (error_state) |
|
931 return; |
|
932 |
2305
|
933 nr = NINT (v (0)); |
|
934 nc = NINT (v (1)); |
523
|
935 } |
|
936 else |
|
937 warning ("%s (A): use %s (size (A)) instead", warn_for, warn_for); |
|
938 } |
|
939 |
|
940 check_dimensions (nr, nc, warn_for); // May set error_state. |
|
941 } |
|
942 |
|
943 static void |
2086
|
944 get_dimensions (const octave_value& a, const octave_value& b, |
523
|
945 const char *warn_for, int& nr, int& nc) |
|
946 { |
3202
|
947 nr = a.is_empty () ? 0 : a.nint_value (); |
|
948 nc = b.is_empty () ? 0 : b.nint_value (); |
523
|
949 |
634
|
950 if (error_state) |
|
951 error ("%s: expecting two scalar arguments", warn_for); |
523
|
952 else |
634
|
953 check_dimensions (nr, nc, warn_for); // May set error_state. |
523
|
954 } |
|
955 |
2086
|
956 static octave_value |
|
957 fill_matrix (const octave_value& a, double val, const char *warn_for) |
523
|
958 { |
|
959 int nr, nc; |
|
960 get_dimensions (a, warn_for, nr, nc); |
|
961 |
|
962 if (error_state) |
2086
|
963 return octave_value (); |
523
|
964 |
|
965 Matrix m (nr, nc, val); |
|
966 |
|
967 return m; |
|
968 } |
|
969 |
2086
|
970 static octave_value |
|
971 fill_matrix (const octave_value& a, const octave_value& b, |
523
|
972 double val, const char *warn_for) |
|
973 { |
|
974 int nr, nc; |
|
975 get_dimensions (a, b, warn_for, nr, nc); // May set error_state. |
|
976 |
|
977 if (error_state) |
2086
|
978 return octave_value (); |
523
|
979 |
|
980 Matrix m (nr, nc, val); |
|
981 |
|
982 return m; |
|
983 } |
|
984 |
1957
|
985 DEFUN (ones, args, , |
523
|
986 "ones (N), ones (N, M), ones (X): create a matrix of all ones") |
|
987 { |
2086
|
988 octave_value_list retval; |
523
|
989 |
|
990 int nargin = args.length (); |
|
991 |
|
992 switch (nargin) |
|
993 { |
712
|
994 case 0: |
|
995 retval = 1.0; |
|
996 break; |
777
|
997 |
610
|
998 case 1: |
712
|
999 retval = fill_matrix (args(0), 1.0, "ones"); |
610
|
1000 break; |
777
|
1001 |
523
|
1002 case 2: |
712
|
1003 retval = fill_matrix (args(0), args(1), 1.0, "ones"); |
523
|
1004 break; |
777
|
1005 |
523
|
1006 default: |
|
1007 print_usage ("ones"); |
|
1008 break; |
|
1009 } |
|
1010 |
|
1011 return retval; |
|
1012 } |
|
1013 |
1957
|
1014 DEFUN (zeros, args, , |
523
|
1015 "zeros (N), zeros (N, M), zeros (X): create a matrix of all zeros") |
|
1016 { |
2086
|
1017 octave_value_list retval; |
523
|
1018 |
|
1019 int nargin = args.length (); |
|
1020 |
|
1021 switch (nargin) |
|
1022 { |
712
|
1023 case 0: |
|
1024 retval = 0.0; |
|
1025 break; |
777
|
1026 |
610
|
1027 case 1: |
712
|
1028 retval = fill_matrix (args(0), 0.0, "zeros"); |
610
|
1029 break; |
777
|
1030 |
523
|
1031 case 2: |
712
|
1032 retval = fill_matrix (args(0), args(1), 0.0, "zeros"); |
523
|
1033 break; |
777
|
1034 |
523
|
1035 default: |
|
1036 print_usage ("zeros"); |
|
1037 break; |
|
1038 } |
|
1039 |
|
1040 return retval; |
|
1041 } |
|
1042 |
2086
|
1043 static octave_value |
|
1044 identity_matrix (const octave_value& a) |
523
|
1045 { |
|
1046 int nr, nc; |
|
1047 get_dimensions (a, "eye", nr, nc); // May set error_state. |
|
1048 |
|
1049 if (error_state) |
2086
|
1050 return octave_value (); |
523
|
1051 |
|
1052 Matrix m (nr, nc, 0.0); |
|
1053 |
|
1054 if (nr > 0 && nc > 0) |
|
1055 { |
|
1056 int n = MIN (nr, nc); |
|
1057 for (int i = 0; i < n; i++) |
2305
|
1058 m (i, i) = 1.0; |
523
|
1059 } |
|
1060 |
|
1061 return m; |
|
1062 } |
|
1063 |
2086
|
1064 static octave_value |
|
1065 identity_matrix (const octave_value& a, const octave_value& b) |
523
|
1066 { |
|
1067 int nr, nc; |
|
1068 get_dimensions (a, b, "eye", nr, nc); // May set error_state. |
|
1069 |
|
1070 if (error_state) |
2086
|
1071 return octave_value (); |
523
|
1072 |
|
1073 Matrix m (nr, nc, 0.0); |
|
1074 |
|
1075 if (nr > 0 && nc > 0) |
|
1076 { |
|
1077 int n = MIN (nr, nc); |
|
1078 for (int i = 0; i < n; i++) |
2305
|
1079 m (i, i) = 1.0; |
523
|
1080 } |
|
1081 |
|
1082 return m; |
|
1083 } |
|
1084 |
1957
|
1085 DEFUN (eye, args, , |
523
|
1086 "eye (N), eye (N, M), eye (X): create an identity matrix") |
|
1087 { |
2086
|
1088 octave_value_list retval; |
523
|
1089 |
|
1090 int nargin = args.length (); |
|
1091 |
|
1092 switch (nargin) |
|
1093 { |
712
|
1094 case 0: |
|
1095 retval = 1.0; |
|
1096 break; |
777
|
1097 |
610
|
1098 case 1: |
712
|
1099 retval = identity_matrix (args(0)); |
610
|
1100 break; |
777
|
1101 |
523
|
1102 case 2: |
712
|
1103 retval = identity_matrix (args(0), args(1)); |
523
|
1104 break; |
777
|
1105 |
523
|
1106 default: |
|
1107 print_usage ("eye"); |
|
1108 break; |
|
1109 } |
|
1110 |
|
1111 return retval; |
|
1112 } |
|
1113 |
1957
|
1114 DEFUN (linspace, args, , |
1100
|
1115 "usage: linspace (x1, x2, n)\n\ |
|
1116 \n\ |
|
1117 Return a vector of n equally spaced points between x1 and x2\n\ |
|
1118 inclusive.\n\ |
|
1119 \n\ |
|
1120 If the final argument is omitted, n = 100 is assumed.\n\ |
|
1121 \n\ |
|
1122 All three arguments must be scalars.\n\ |
|
1123 \n\ |
|
1124 See also: logspace") |
|
1125 { |
2086
|
1126 octave_value_list retval; |
1100
|
1127 |
|
1128 int nargin = args.length (); |
|
1129 |
|
1130 int npoints = 100; |
|
1131 |
1940
|
1132 if (nargin != 2 && nargin != 3) |
|
1133 { |
|
1134 print_usage ("linspace"); |
|
1135 return retval; |
|
1136 } |
|
1137 |
1100
|
1138 if (nargin == 3) |
3202
|
1139 npoints = args(2).nint_value (); |
1100
|
1140 |
|
1141 if (! error_state) |
|
1142 { |
|
1143 if (npoints > 1) |
|
1144 { |
2086
|
1145 octave_value arg_1 = args(0); |
|
1146 octave_value arg_2 = args(1); |
1100
|
1147 |
|
1148 if (arg_1.is_complex_type () || arg_2.is_complex_type ()) |
|
1149 { |
|
1150 Complex x1 = arg_1.complex_value (); |
|
1151 Complex x2 = arg_2.complex_value (); |
|
1152 |
|
1153 if (! error_state) |
|
1154 { |
|
1155 ComplexRowVector rv = linspace (x1, x2, npoints); |
|
1156 |
|
1157 if (! error_state) |
2086
|
1158 retval (0) = octave_value (rv, 0); |
1100
|
1159 } |
|
1160 } |
|
1161 else |
|
1162 { |
|
1163 double x1 = arg_1.double_value (); |
|
1164 double x2 = arg_2.double_value (); |
|
1165 |
|
1166 if (! error_state) |
|
1167 { |
|
1168 RowVector rv = linspace (x1, x2, npoints); |
|
1169 |
|
1170 if (! error_state) |
2086
|
1171 retval (0) = octave_value (rv, 0); |
1100
|
1172 } |
|
1173 } |
|
1174 } |
|
1175 else |
|
1176 error ("linspace: npoints must be greater than 2"); |
|
1177 } |
|
1178 |
|
1179 return retval; |
|
1180 } |
|
1181 |
2188
|
1182 static int |
|
1183 treat_neg_dim_as_zero (void) |
|
1184 { |
|
1185 Vtreat_neg_dim_as_zero = check_preference ("treat_neg_dim_as_zero"); |
|
1186 |
|
1187 return 0; |
|
1188 } |
|
1189 |
2184
|
1190 void |
|
1191 symbols_of_data (void) |
|
1192 { |
3321
|
1193 |
|
1194 #define IMAGINARY_DOC_STRING "-*- texinfo -*-\n\ |
|
1195 @defvr {Built-in Variable} I\n\ |
|
1196 @defvrx {Built-in Variable} J\n\ |
|
1197 @defvrx {Built-in Variable} i\n\ |
|
1198 @defvrx {Built-in Variable} j\n\ |
|
1199 A pure imaginary number, defined as\n\ |
|
1200 @iftex\n\ |
|
1201 @tex\n\ |
|
1202 $\\sqrt{-1}$.\n\ |
|
1203 @end tex\n\ |
|
1204 @end iftex\n\ |
|
1205 @ifinfo\n\ |
|
1206 @code{sqrt (-1)}.\n\ |
|
1207 @end ifinfo\n\ |
|
1208 The @code{I} and @code{J} forms are true constants, and cannot be\n\ |
|
1209 modified. The @code{i} and @code{j} forms are like ordinary variables,\n\ |
|
1210 and may be used for other purposes. However, unlike other variables,\n\ |
|
1211 they once again assume their special predefined values if they are\n\ |
|
1212 cleared @xref{Status of Variables}.\n\ |
|
1213 @end defvr" |
|
1214 |
|
1215 #define INFINITY_DOC_STRING "-*- texinfo -*-\n\ |
|
1216 @defvr {Built-in Variable} Inf\n\ |
|
1217 @defvrx {Built-in Variable} inf\n\ |
|
1218 Infinity. This is the result of an operation like 1/0, or an operation\n\ |
|
1219 that results in a floating point overflow.\n\ |
|
1220 @end defvr" |
|
1221 |
|
1222 #define NAN_DOC_STRING "-*- texinfo -*-\n\ |
|
1223 @defvr {Built-in Variable} NaN\n\ |
|
1224 @defvrx {Built-in Variable} nan\n\ |
|
1225 Not a number. This is the result of an operation like\n\ |
|
1226 @iftex\n\ |
|
1227 @tex\n\ |
|
1228 $0/0$, or $\\infty - \\infty$,\n\ |
|
1229 @end tex\n\ |
|
1230 @end iftex\n\ |
|
1231 @ifinfo\n\ |
|
1232 0/0, or @samp{Inf - Inf},\n\ |
|
1233 @end ifinfo\n\ |
|
1234 or any operation with a NaN.\n\ |
|
1235 \n\ |
|
1236 Note that NaN always compares not equal to NaN. This behavior is\n\ |
|
1237 specified by the IEEE standard for floating point arithmetic. To\n\ |
|
1238 find NaN values, you must use the @code{isnan} function.\n\ |
|
1239 @end defvr" |
|
1240 |
3141
|
1241 DEFCONST (I, Complex (0.0, 1.0), |
3321
|
1242 IMAGINARY_DOC_STRING); |
2184
|
1243 |
3141
|
1244 DEFCONST (Inf, octave_Inf, |
3321
|
1245 INFINITY_DOC_STRING); |
2184
|
1246 |
3141
|
1247 DEFCONST (J, Complex (0.0, 1.0), |
3321
|
1248 IMAGINARY_DOC_STRING); |
2184
|
1249 |
3141
|
1250 DEFCONST (NaN, octave_NaN, |
3321
|
1251 NAN_DOC_STRING); |
2184
|
1252 |
|
1253 #if defined (M_E) |
|
1254 double e_val = M_E; |
|
1255 #else |
|
1256 double e_val = exp (1.0); |
|
1257 #endif |
|
1258 |
3141
|
1259 DEFCONST (e, e_val, |
3321
|
1260 "-*- texinfo -*-\n\ |
|
1261 @defvr {Built-in Variable} e\n\ |
|
1262 The base of natural logarithms. The constant\n\ |
|
1263 @iftex\n\ |
|
1264 @tex\n\ |
|
1265 $e$\n\ |
|
1266 @end tex\n\ |
|
1267 @end iftex\n\ |
|
1268 @ifinfo\n\ |
|
1269 @var{e}\n\ |
|
1270 @end ifinfo\n\ |
|
1271 satisfies the equation\n\ |
|
1272 @iftex\n\ |
|
1273 @tex\n\ |
|
1274 $\\log (e) = 1$.\n\ |
|
1275 @end tex\n\ |
|
1276 @end iftex\n\ |
|
1277 @ifinfo\n\ |
|
1278 @code{log} (@var{e}) = 1.\n\ |
|
1279 @end ifinfo\n\ |
|
1280 @end defvr"); |
2184
|
1281 |
3141
|
1282 DEFCONST (eps, DBL_EPSILON, |
3321
|
1283 "-*- texinfo -*-\n\ |
|
1284 @defvr {Built-in Variable} eps\n\ |
|
1285 The machine precision. More precisely, @code{eps} is the largest\n\ |
|
1286 relative spacing between any two adjacent numbers in the machine's\n\ |
|
1287 floating point system. This number is obviously system-dependent. On\n\ |
|
1288 machines that support 64 bit IEEE floating point arithmetic, @code{eps}\n\ |
|
1289 is approximately\n\ |
|
1290 @ifinfo\n\ |
|
1291 2.2204e-16.\n\ |
|
1292 @end ifinfo\n\ |
|
1293 @iftex\n\ |
|
1294 @tex\n\ |
|
1295 $2.2204\\times10^{-16}$.\n\ |
|
1296 @end tex\n\ |
|
1297 @end iftex\n\ |
|
1298 @end defvr"); |
2184
|
1299 |
3258
|
1300 DEFCONST (false, false, |
|
1301 "logical false value"); |
|
1302 |
3141
|
1303 DEFCONST (i, Complex (0.0, 1.0), |
3321
|
1304 IMAGINARY_DOC_STRING); |
2184
|
1305 |
3141
|
1306 DEFCONST (inf, octave_Inf, |
3321
|
1307 INFINITY_DOC_STRING); |
2184
|
1308 |
3141
|
1309 DEFCONST (j, Complex (0.0, 1.0), |
3321
|
1310 IMAGINARY_DOC_STRING); |
2184
|
1311 |
3141
|
1312 DEFCONST (nan, octave_NaN, |
3321
|
1313 NAN_DOC_STRING); |
2184
|
1314 |
|
1315 #if defined (M_PI) |
|
1316 double pi_val = M_PI; |
|
1317 #else |
|
1318 double pi_val = 4.0 * atan (1.0); |
|
1319 #endif |
|
1320 |
3141
|
1321 DEFCONST (pi, pi_val, |
3321
|
1322 "-*- texinfo -*-\n\ |
|
1323 @defvr {Built-in Variable} pi\n\ |
|
1324 The ratio of the circumference of a circle to its diameter.\n\ |
|
1325 Internally, @code{pi} is computed as @samp{4.0 * atan (1.0)}.\n\ |
|
1326 @end defvr"); |
2184
|
1327 |
3141
|
1328 DEFCONST (realmax, DBL_MAX, |
3321
|
1329 "-*- texinfo -*-\n\ |
|
1330 @defvr {Built-in Variable} realmax\n\ |
|
1331 The largest floating point number that is representable. The actual\n\ |
|
1332 value is system-dependent. On machines that support 64 bit IEEE\n\ |
|
1333 floating point arithmetic, @code{realmax} is approximately\n\ |
|
1334 @ifinfo\n\ |
|
1335 1.7977e+308\n\ |
|
1336 @end ifinfo\n\ |
|
1337 @iftex\n\ |
|
1338 @tex\n\ |
|
1339 $1.7977\\times10^{308}$.\n\ |
|
1340 @end tex\n\ |
|
1341 @end iftex\n\ |
|
1342 @end defvr"); |
2184
|
1343 |
3141
|
1344 DEFCONST (realmin, DBL_MIN, |
3321
|
1345 "-*- texinfo -*-\n\ |
|
1346 @defvr {Built-in Variable} realmin\n\ |
|
1347 The smallest floating point number that is representable. The actual\n\ |
|
1348 value is system-dependent. On machines that support 64 bit IEEE\n\ |
|
1349 floating point arithmetic, @code{realmin} is approximately\n\ |
|
1350 @ifinfo\n\ |
|
1351 2.2251e-308\n\ |
|
1352 @end ifinfo\n\ |
|
1353 @iftex\n\ |
|
1354 @tex\n\ |
|
1355 $2.2251\\times10^{-308}$.\n\ |
|
1356 @end tex\n\ |
|
1357 @end iftex\n\ |
|
1358 @end defvr"); |
2188
|
1359 |
3258
|
1360 DEFVAR (treat_neg_dim_as_zero, 0.0, treat_neg_dim_as_zero, |
2188
|
1361 "convert negative dimensions to zero"); |
3258
|
1362 |
|
1363 DEFCONST (true, true, |
|
1364 "logical true value"); |
2184
|
1365 } |
|
1366 |
523
|
1367 /* |
|
1368 ;;; Local Variables: *** |
|
1369 ;;; mode: C++ *** |
|
1370 ;;; End: *** |
|
1371 */ |