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