458
|
1 // RowVector manipulations. -*- C++ -*- |
|
2 /* |
|
3 |
1011
|
4 Copyright (C) 1992, 1993, 1994, 1995 John W. Eaton |
458
|
5 |
|
6 This file is part of Octave. |
|
7 |
|
8 Octave is free software; you can redistribute it and/or modify it |
|
9 under the terms of the GNU General Public License as published by the |
|
10 Free Software Foundation; either version 2, or (at your option) any |
|
11 later version. |
|
12 |
|
13 Octave is distributed in the hope that it will be useful, but WITHOUT |
|
14 ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or |
|
15 FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License |
|
16 for more details. |
|
17 |
|
18 You should have received a copy of the GNU General Public License |
|
19 along with Octave; see the file COPYING. If not, write to the Free |
|
20 Software Foundation, 675 Mass Ave, Cambridge, MA 02139, USA. |
|
21 |
|
22 */ |
|
23 |
|
24 #ifdef HAVE_CONFIG_H |
1192
|
25 #include <config.h> |
458
|
26 #endif |
|
27 |
|
28 #include <iostream.h> |
|
29 |
|
30 #include <Complex.h> |
|
31 |
|
32 #include "mx-base.h" |
|
33 #include "mx-inlines.cc" |
|
34 #include "lo-error.h" |
|
35 #include "f77-uscore.h" |
|
36 |
|
37 // Fortran functions we call. |
|
38 |
|
39 extern "C" |
|
40 { |
1251
|
41 int F77_FCN (zgemv) (const char*, const int&, const int&, |
|
42 const Complex&, const Complex*, const int&, |
|
43 const Complex*, const int&, const Complex&, |
|
44 Complex*, const int&, long); |
458
|
45 } |
|
46 |
|
47 /* |
|
48 * Complex Row Vector class |
|
49 */ |
|
50 |
|
51 ComplexRowVector::ComplexRowVector (const RowVector& a) |
1214
|
52 : MArray<Complex> (a.length ()) |
458
|
53 { |
|
54 for (int i = 0; i < length (); i++) |
|
55 elem (i) = a.elem (i); |
|
56 } |
|
57 |
|
58 int |
|
59 ComplexRowVector::operator == (const ComplexRowVector& a) const |
|
60 { |
|
61 int len = length (); |
|
62 if (len != a.length ()) |
|
63 return 0; |
|
64 return equal (data (), a.data (), len); |
|
65 } |
|
66 |
|
67 int |
|
68 ComplexRowVector::operator != (const ComplexRowVector& a) const |
|
69 { |
|
70 return !(*this == a); |
|
71 } |
|
72 |
|
73 // destructive insert/delete/reorder operations |
|
74 |
|
75 ComplexRowVector& |
|
76 ComplexRowVector::insert (const RowVector& a, int c) |
|
77 { |
|
78 int a_len = a.length (); |
|
79 if (c < 0 || c + a_len - 1 > length ()) |
|
80 { |
|
81 (*current_liboctave_error_handler) ("range error for insert"); |
|
82 return *this; |
|
83 } |
|
84 |
|
85 for (int i = 0; i < a_len; i++) |
|
86 elem (c+i) = a.elem (i); |
|
87 |
|
88 return *this; |
|
89 } |
|
90 |
|
91 ComplexRowVector& |
|
92 ComplexRowVector::insert (const ComplexRowVector& a, int c) |
|
93 { |
|
94 int a_len = a.length (); |
|
95 if (c < 0 || c + a_len - 1 > length ()) |
|
96 { |
|
97 (*current_liboctave_error_handler) ("range error for insert"); |
|
98 return *this; |
|
99 } |
|
100 |
|
101 for (int i = 0; i < a_len; i++) |
|
102 elem (c+i) = a.elem (i); |
|
103 |
|
104 return *this; |
|
105 } |
|
106 |
|
107 ComplexRowVector& |
|
108 ComplexRowVector::fill (double val) |
|
109 { |
|
110 int len = length (); |
|
111 if (len > 0) |
|
112 for (int i = 0; i < len; i++) |
|
113 elem (i) = val; |
|
114 return *this; |
|
115 } |
|
116 |
|
117 ComplexRowVector& |
|
118 ComplexRowVector::fill (const Complex& val) |
|
119 { |
|
120 int len = length (); |
|
121 if (len > 0) |
|
122 for (int i = 0; i < len; i++) |
|
123 elem (i) = val; |
|
124 return *this; |
|
125 } |
|
126 |
|
127 ComplexRowVector& |
|
128 ComplexRowVector::fill (double val, int c1, int c2) |
|
129 { |
|
130 int len = length (); |
|
131 if (c1 < 0 || c2 < 0 || c1 >= len || c2 >= len) |
|
132 { |
|
133 (*current_liboctave_error_handler) ("range error for fill"); |
|
134 return *this; |
|
135 } |
|
136 |
|
137 if (c1 > c2) { int tmp = c1; c1 = c2; c2 = tmp; } |
|
138 |
|
139 for (int i = c1; i <= c2; i++) |
|
140 elem (i) = val; |
|
141 |
|
142 return *this; |
|
143 } |
|
144 |
|
145 ComplexRowVector& |
|
146 ComplexRowVector::fill (const Complex& val, int c1, int c2) |
|
147 { |
|
148 int len = length (); |
|
149 if (c1 < 0 || c2 < 0 || c1 >= len || c2 >= len) |
|
150 { |
|
151 (*current_liboctave_error_handler) ("range error for fill"); |
|
152 return *this; |
|
153 } |
|
154 |
|
155 if (c1 > c2) { int tmp = c1; c1 = c2; c2 = tmp; } |
|
156 |
|
157 for (int i = c1; i <= c2; i++) |
|
158 elem (i) = val; |
|
159 |
|
160 return *this; |
|
161 } |
|
162 |
|
163 ComplexRowVector |
|
164 ComplexRowVector::append (const RowVector& a) const |
|
165 { |
|
166 int len = length (); |
|
167 int nc_insert = len; |
|
168 ComplexRowVector retval (len + a.length ()); |
|
169 retval.insert (*this, 0); |
|
170 retval.insert (a, nc_insert); |
|
171 return retval; |
|
172 } |
|
173 |
|
174 ComplexRowVector |
|
175 ComplexRowVector::append (const ComplexRowVector& a) const |
|
176 { |
|
177 int len = length (); |
|
178 int nc_insert = len; |
|
179 ComplexRowVector retval (len + a.length ()); |
|
180 retval.insert (*this, 0); |
|
181 retval.insert (a, nc_insert); |
|
182 return retval; |
|
183 } |
|
184 |
|
185 ComplexColumnVector |
|
186 ComplexRowVector::hermitian (void) const |
|
187 { |
|
188 int len = length (); |
|
189 return ComplexColumnVector (conj_dup (data (), len), len); |
|
190 } |
|
191 |
|
192 ComplexColumnVector |
|
193 ComplexRowVector::transpose (void) const |
|
194 { |
|
195 int len = length (); |
|
196 return ComplexColumnVector (dup (data (), len), len); |
|
197 } |
|
198 |
|
199 ComplexRowVector |
|
200 conj (const ComplexRowVector& a) |
|
201 { |
|
202 int a_len = a.length (); |
|
203 ComplexRowVector retval; |
|
204 if (a_len > 0) |
|
205 retval = ComplexRowVector (conj_dup (a.data (), a_len), a_len); |
|
206 return retval; |
|
207 } |
|
208 |
|
209 // resize is the destructive equivalent for this one |
|
210 |
|
211 ComplexRowVector |
|
212 ComplexRowVector::extract (int c1, int c2) const |
|
213 { |
|
214 if (c1 > c2) { int tmp = c1; c1 = c2; c2 = tmp; } |
|
215 |
|
216 int new_c = c2 - c1 + 1; |
|
217 |
|
218 ComplexRowVector result (new_c); |
|
219 |
|
220 for (int i = 0; i < new_c; i++) |
|
221 result.elem (i) = elem (c1+i); |
|
222 |
|
223 return result; |
|
224 } |
|
225 |
|
226 // row vector by row vector -> row vector operations |
|
227 |
|
228 ComplexRowVector& |
|
229 ComplexRowVector::operator += (const RowVector& a) |
|
230 { |
|
231 int len = length (); |
|
232 if (len != a.length ()) |
|
233 { |
|
234 (*current_liboctave_error_handler) |
|
235 ("nonconformant vector += operation attempted"); |
|
236 return *this; |
|
237 } |
|
238 |
|
239 if (len == 0) |
|
240 return *this; |
|
241 |
|
242 Complex *d = fortran_vec (); // Ensures only one reference to my privates! |
|
243 |
|
244 add2 (d, a.data (), len); |
|
245 return *this; |
|
246 } |
|
247 |
|
248 ComplexRowVector& |
|
249 ComplexRowVector::operator -= (const RowVector& a) |
|
250 { |
|
251 int len = length (); |
|
252 if (len != a.length ()) |
|
253 { |
|
254 (*current_liboctave_error_handler) |
|
255 ("nonconformant vector -= operation attempted"); |
|
256 return *this; |
|
257 } |
|
258 |
|
259 if (len == 0) |
|
260 return *this; |
|
261 |
|
262 Complex *d = fortran_vec (); // Ensures only one reference to my privates! |
|
263 |
|
264 subtract2 (d, a.data (), len); |
|
265 return *this; |
|
266 } |
|
267 |
|
268 ComplexRowVector& |
|
269 ComplexRowVector::operator += (const ComplexRowVector& a) |
|
270 { |
|
271 int len = length (); |
|
272 if (len != a.length ()) |
|
273 { |
|
274 (*current_liboctave_error_handler) |
|
275 ("nonconformant vector += operation attempted"); |
|
276 return *this; |
|
277 } |
|
278 |
|
279 if (len == 0) |
|
280 return *this; |
|
281 |
|
282 Complex *d = fortran_vec (); // Ensures only one reference to my privates! |
|
283 |
|
284 add2 (d, a.data (), len); |
|
285 return *this; |
|
286 } |
|
287 |
|
288 ComplexRowVector& |
|
289 ComplexRowVector::operator -= (const ComplexRowVector& a) |
|
290 { |
|
291 int len = length (); |
|
292 if (len != a.length ()) |
|
293 { |
|
294 (*current_liboctave_error_handler) |
|
295 ("nonconformant vector -= operation attempted"); |
|
296 return *this; |
|
297 } |
|
298 |
|
299 if (len == 0) |
|
300 return *this; |
|
301 |
|
302 Complex *d = fortran_vec (); // Ensures only one reference to my privates! |
|
303 |
|
304 subtract2 (d, a.data (), len); |
|
305 return *this; |
|
306 } |
|
307 |
|
308 // row vector by scalar -> row vector operations |
|
309 |
|
310 ComplexRowVector |
|
311 operator + (const ComplexRowVector& v, double s) |
|
312 { |
|
313 int len = v.length (); |
|
314 return ComplexRowVector (add (v.data (), len, s), len); |
|
315 } |
|
316 |
|
317 ComplexRowVector |
|
318 operator - (const ComplexRowVector& v, double s) |
|
319 { |
|
320 int len = v.length (); |
|
321 return ComplexRowVector (subtract (v.data (), len, s), len); |
|
322 } |
|
323 |
|
324 ComplexRowVector |
|
325 operator * (const ComplexRowVector& v, double s) |
|
326 { |
|
327 int len = v.length (); |
|
328 return ComplexRowVector (multiply (v.data (), len, s), len); |
|
329 } |
|
330 |
|
331 ComplexRowVector |
|
332 operator / (const ComplexRowVector& v, double s) |
|
333 { |
|
334 int len = v.length (); |
|
335 return ComplexRowVector (divide (v.data (), len, s), len); |
|
336 } |
|
337 |
1205
|
338 ComplexRowVector |
|
339 operator + (const RowVector& v, const Complex& s) |
|
340 { |
|
341 int len = v.length (); |
|
342 return ComplexRowVector (add (v.data (), len, s), len); |
|
343 } |
|
344 |
|
345 ComplexRowVector |
|
346 operator - (const RowVector& v, const Complex& s) |
|
347 { |
|
348 int len = v.length (); |
|
349 return ComplexRowVector (subtract (v.data (), len, s), len); |
|
350 } |
|
351 |
|
352 ComplexRowVector |
|
353 operator * (const RowVector& v, const Complex& s) |
|
354 { |
|
355 int len = v.length (); |
|
356 return ComplexRowVector (multiply (v.data (), len, s), len); |
|
357 } |
|
358 |
|
359 ComplexRowVector |
|
360 operator / (const RowVector& v, const Complex& s) |
|
361 { |
|
362 int len = v.length (); |
|
363 return ComplexRowVector (divide (v.data (), len, s), len); |
|
364 } |
|
365 |
458
|
366 // scalar by row vector -> row vector operations |
|
367 |
|
368 ComplexRowVector |
|
369 operator + (double s, const ComplexRowVector& a) |
|
370 { |
|
371 int a_len = a.length (); |
|
372 return ComplexRowVector (add (a.data (), a_len, s), a_len); |
|
373 } |
|
374 |
|
375 ComplexRowVector |
|
376 operator - (double s, const ComplexRowVector& a) |
|
377 { |
|
378 int a_len = a.length (); |
|
379 return ComplexRowVector (subtract (s, a.data (), a_len), a_len); |
|
380 } |
|
381 |
|
382 ComplexRowVector |
|
383 operator * (double s, const ComplexRowVector& a) |
|
384 { |
|
385 int a_len = a.length (); |
|
386 return ComplexRowVector (multiply (a.data (), a_len, s), a_len); |
|
387 } |
|
388 |
|
389 ComplexRowVector |
|
390 operator / (double s, const ComplexRowVector& a) |
|
391 { |
|
392 int a_len = a.length (); |
|
393 return ComplexRowVector (divide (s, a.data (), a_len), a_len); |
|
394 } |
|
395 |
1205
|
396 ComplexRowVector |
|
397 operator + (const Complex& s, const RowVector& a) |
458
|
398 { |
1205
|
399 return ComplexRowVector (); |
458
|
400 } |
|
401 |
1205
|
402 ComplexRowVector |
|
403 operator - (const Complex& s, const RowVector& a) |
458
|
404 { |
1205
|
405 return ComplexRowVector (); |
|
406 } |
458
|
407 |
1205
|
408 ComplexRowVector |
|
409 operator * (const Complex& s, const RowVector& a) |
|
410 { |
|
411 return ComplexRowVector (); |
|
412 } |
458
|
413 |
1205
|
414 ComplexRowVector |
|
415 operator / (const Complex& s, const RowVector& a) |
|
416 { |
|
417 return ComplexRowVector (); |
458
|
418 } |
|
419 |
|
420 // row vector by matrix -> row vector |
|
421 |
|
422 ComplexRowVector |
|
423 operator * (const ComplexRowVector& v, const ComplexMatrix& a) |
|
424 { |
|
425 int len = v.length (); |
|
426 if (a.rows () != len) |
|
427 { |
|
428 (*current_liboctave_error_handler) |
|
429 ("nonconformant vector multiplication attempted"); |
|
430 return ComplexRowVector (); |
|
431 } |
|
432 |
|
433 if (len == 0 || a.cols () == 0) |
|
434 return ComplexRowVector (0); |
|
435 |
|
436 // Transpose A to form A'*x == (x'*A)' |
|
437 |
|
438 int a_nr = a.rows (); |
|
439 int a_nc = a.cols (); |
|
440 |
|
441 int ld = a_nr; |
|
442 |
|
443 Complex *y = new Complex [len]; |
|
444 |
1251
|
445 F77_FCN (zgemv) ("T", a_nc, a_nr, 1.0, a.data (), ld, v.data (), 1, |
|
446 0.0, y, 1, 1L); |
458
|
447 |
|
448 return ComplexRowVector (y, len); |
|
449 } |
|
450 |
1205
|
451 ComplexRowVector |
|
452 operator * (const RowVector& v, const ComplexMatrix& a) |
|
453 { |
|
454 ComplexRowVector tmp (v); |
|
455 return tmp * a; |
|
456 } |
|
457 |
458
|
458 // row vector by row vector -> row vector operations |
|
459 |
|
460 ComplexRowVector |
|
461 operator + (const ComplexRowVector& v, const RowVector& a) |
|
462 { |
|
463 int len = v.length (); |
|
464 if (len != a.length ()) |
|
465 { |
|
466 (*current_liboctave_error_handler) |
|
467 ("nonconformant vector addition attempted"); |
|
468 return ComplexRowVector (); |
|
469 } |
|
470 |
|
471 if (len == 0) |
|
472 return ComplexRowVector (0); |
|
473 |
|
474 return ComplexRowVector (add (v.data (), a.data (), len), len); |
|
475 } |
|
476 |
|
477 ComplexRowVector |
|
478 operator - (const ComplexRowVector& v, const RowVector& a) |
|
479 { |
|
480 int len = v.length (); |
|
481 if (len != a.length ()) |
|
482 { |
|
483 (*current_liboctave_error_handler) |
|
484 ("nonconformant vector subtraction attempted"); |
|
485 return ComplexRowVector (); |
|
486 } |
|
487 |
|
488 if (len == 0) |
|
489 return ComplexRowVector (0); |
|
490 |
|
491 return ComplexRowVector (subtract (v.data (), a.data (), len), len); |
|
492 } |
|
493 |
|
494 ComplexRowVector |
1205
|
495 operator + (const RowVector& v, const ComplexRowVector& a) |
|
496 { |
|
497 int len = v.length (); |
|
498 if (len != a.length ()) |
|
499 { |
|
500 (*current_liboctave_error_handler) |
|
501 ("nonconformant vector addition attempted"); |
|
502 return ComplexRowVector (); |
|
503 } |
|
504 |
|
505 if (len == 0) |
|
506 return ComplexRowVector (0); |
|
507 |
|
508 return ComplexRowVector (add (v.data (), a.data (), len), len); |
|
509 } |
|
510 |
|
511 ComplexRowVector |
|
512 operator - (const RowVector& v, const ComplexRowVector& a) |
|
513 { |
|
514 int len = v.length (); |
|
515 if (len != a.length ()) |
|
516 { |
|
517 (*current_liboctave_error_handler) |
|
518 ("nonconformant vector subtraction attempted"); |
|
519 return ComplexRowVector (); |
|
520 } |
|
521 |
|
522 if (len == 0) |
|
523 return ComplexRowVector (0); |
|
524 |
|
525 return ComplexRowVector (subtract (v.data (), a.data (), len), len); |
|
526 } |
|
527 |
|
528 ComplexRowVector |
458
|
529 product (const ComplexRowVector& v, const RowVector& a) |
|
530 { |
|
531 int len = v.length (); |
|
532 if (len != a.length ()) |
|
533 { |
|
534 (*current_liboctave_error_handler) |
|
535 ("nonconformant vector product attempted"); |
|
536 return ComplexRowVector (); |
|
537 } |
|
538 |
|
539 if (len == 0) |
|
540 return ComplexRowVector (0); |
|
541 |
|
542 return ComplexRowVector (multiply (v.data (), a.data (), len), len); |
|
543 } |
|
544 |
|
545 ComplexRowVector |
|
546 quotient (const ComplexRowVector& v, const RowVector& a) |
|
547 { |
|
548 int len = v.length (); |
|
549 if (len != a.length ()) |
|
550 { |
|
551 (*current_liboctave_error_handler) |
|
552 ("nonconformant vector quotient attempted"); |
|
553 return ComplexRowVector (); |
|
554 } |
|
555 |
|
556 if (len == 0) |
|
557 return ComplexRowVector (0); |
|
558 |
|
559 return ComplexRowVector (divide (v.data (), a.data (), len), len); |
|
560 } |
|
561 |
1205
|
562 ComplexRowVector |
|
563 product (const RowVector& v, const ComplexRowVector& a) |
|
564 { |
|
565 int len = v.length (); |
|
566 if (len != a.length ()) |
|
567 { |
|
568 (*current_liboctave_error_handler) |
|
569 ("nonconformant vector product attempted"); |
|
570 return ComplexRowVector (); |
|
571 } |
|
572 |
|
573 if (len == 0) |
|
574 return ComplexRowVector (0); |
|
575 |
|
576 return ComplexRowVector (multiply (v.data (), a.data (), len), len); |
|
577 } |
|
578 |
|
579 ComplexRowVector |
|
580 quotient (const RowVector& v, const ComplexRowVector& a) |
|
581 { |
|
582 int len = v.length (); |
|
583 if (len != a.length ()) |
|
584 { |
|
585 (*current_liboctave_error_handler) |
|
586 ("nonconformant vector quotient attempted"); |
|
587 return ComplexRowVector (); |
|
588 } |
|
589 |
|
590 if (len == 0) |
|
591 return ComplexRowVector (0); |
|
592 |
|
593 return ComplexRowVector (divide (v.data (), a.data (), len), len); |
|
594 } |
|
595 |
458
|
596 // other operations |
|
597 |
|
598 ComplexRowVector |
|
599 map (c_c_Mapper f, const ComplexRowVector& a) |
|
600 { |
|
601 ComplexRowVector b (a); |
|
602 b.map (f); |
|
603 return b; |
|
604 } |
|
605 |
|
606 void |
|
607 ComplexRowVector::map (c_c_Mapper f) |
|
608 { |
|
609 for (int i = 0; i < length (); i++) |
|
610 elem (i) = f (elem (i)); |
|
611 } |
|
612 |
|
613 Complex |
|
614 ComplexRowVector::min (void) const |
|
615 { |
|
616 int len = length (); |
|
617 if (len == 0) |
|
618 return Complex (0.0); |
|
619 |
|
620 Complex res = elem (0); |
|
621 double absres = abs (res); |
|
622 |
|
623 for (int i = 1; i < len; i++) |
|
624 if (abs (elem (i)) < absres) |
|
625 { |
|
626 res = elem (i); |
|
627 absres = abs (res); |
|
628 } |
|
629 |
|
630 return res; |
|
631 } |
|
632 |
|
633 Complex |
|
634 ComplexRowVector::max (void) const |
|
635 { |
|
636 int len = length (); |
|
637 if (len == 0) |
|
638 return Complex (0.0); |
|
639 |
|
640 Complex res = elem (0); |
|
641 double absres = abs (res); |
|
642 |
|
643 for (int i = 1; i < len; i++) |
|
644 if (abs (elem (i)) > absres) |
|
645 { |
|
646 res = elem (i); |
|
647 absres = abs (res); |
|
648 } |
|
649 |
|
650 return res; |
|
651 } |
|
652 |
|
653 // i/o |
|
654 |
|
655 ostream& |
|
656 operator << (ostream& os, const ComplexRowVector& a) |
|
657 { |
|
658 // int field_width = os.precision () + 7; |
|
659 for (int i = 0; i < a.length (); i++) |
|
660 os << " " /* setw (field_width) */ << a.elem (i); |
|
661 return os; |
|
662 } |
|
663 |
|
664 istream& |
|
665 operator >> (istream& is, ComplexRowVector& a) |
|
666 { |
|
667 int len = a.length(); |
|
668 |
|
669 if (len < 1) |
|
670 is.clear (ios::badbit); |
|
671 else |
|
672 { |
|
673 Complex tmp; |
|
674 for (int i = 0; i < len; i++) |
|
675 { |
|
676 is >> tmp; |
|
677 if (is) |
|
678 a.elem (i) = tmp; |
|
679 else |
|
680 break; |
|
681 } |
|
682 } |
532
|
683 return is; |
458
|
684 } |
|
685 |
1205
|
686 // row vector by column vector -> scalar |
|
687 |
|
688 // row vector by column vector -> scalar |
|
689 |
|
690 Complex |
|
691 operator * (const ComplexRowVector& v, const ColumnVector& a) |
|
692 { |
|
693 ComplexColumnVector tmp (a); |
|
694 return v * tmp; |
|
695 } |
|
696 |
|
697 Complex |
|
698 operator * (const ComplexRowVector& v, const ComplexColumnVector& a) |
|
699 { |
|
700 int len = v.length (); |
|
701 if (len != a.length ()) |
|
702 { |
|
703 (*current_liboctave_error_handler) |
|
704 ("nonconformant vector multiplication attempted"); |
|
705 return 0.0; |
|
706 } |
|
707 |
|
708 Complex retval (0.0, 0.0); |
|
709 |
|
710 for (int i = 0; i < len; i++) |
|
711 retval += v.elem (i) * a.elem (i); |
|
712 |
|
713 return retval; |
|
714 } |
|
715 |
|
716 // other operations |
|
717 |
|
718 ComplexRowVector |
|
719 linspace (const Complex& x1, const Complex& x2, int n) |
|
720 { |
|
721 ComplexRowVector retval; |
|
722 |
|
723 if (n > 0) |
|
724 { |
|
725 retval.resize (n); |
|
726 Complex delta = (x2 - x1) / (n - 1); |
|
727 retval.elem (0) = x1; |
|
728 for (int i = 1; i < n-1; i++) |
|
729 retval.elem (i) = x1 + i * delta; |
|
730 retval.elem (n-1) = x2; |
|
731 } |
|
732 |
|
733 return retval; |
|
734 } |
|
735 |
458
|
736 /* |
|
737 ;;; Local Variables: *** |
|
738 ;;; mode: C++ *** |
|
739 ;;; page-delimiter: "^/\\*" *** |
|
740 ;;; End: *** |
|
741 */ |