Mercurial > hg > octave-lyh
comparison src/xpow.cc @ 2086:bfb775fb6fe8
[project @ 1996-04-25 05:55:19 by jwe]
author | jwe |
---|---|
date | Thu, 25 Apr 1996 05:55:19 +0000 |
parents | 003570e69c7b |
children | 5a3f1d00a474 |
comparison
equal
deleted
inserted
replaced
2085:7603b37325db | 2086:bfb775fb6fe8 |
---|---|
77 // +---+---+----+----+ | 77 // +---+---+----+----+ |
78 // | 78 // |
79 // E -> error, trapped in arith-ops.cc. | 79 // E -> error, trapped in arith-ops.cc. |
80 | 80 |
81 // -*- 1 -*- | 81 // -*- 1 -*- |
82 tree_constant | 82 octave_value |
83 xpow (double a, double b) | 83 xpow (double a, double b) |
84 { | 84 { |
85 if (a < 0.0 && (int) b != b) | 85 if (a < 0.0 && (int) b != b) |
86 { | 86 { |
87 Complex atmp (a); | 87 Complex atmp (a); |
90 else | 90 else |
91 return pow (a, b); | 91 return pow (a, b); |
92 } | 92 } |
93 | 93 |
94 // -*- 2 -*- | 94 // -*- 2 -*- |
95 tree_constant | 95 octave_value |
96 xpow (double a, const Matrix& b) | 96 xpow (double a, const Matrix& b) |
97 { | 97 { |
98 tree_constant retval; | 98 octave_value retval; |
99 | 99 |
100 int nr = b.rows (); | 100 int nr = b.rows (); |
101 int nc = b.columns (); | 101 int nc = b.columns (); |
102 | 102 |
103 if (nr == 0 || nc == 0 || nr != nc) | 103 if (nr == 0 || nc == 0 || nr != nc) |
123 | 123 |
124 return retval; | 124 return retval; |
125 } | 125 } |
126 | 126 |
127 // -*- 3 -*- | 127 // -*- 3 -*- |
128 tree_constant | 128 octave_value |
129 xpow (double a, const Complex& b) | 129 xpow (double a, const Complex& b) |
130 { | 130 { |
131 Complex result; | 131 Complex result; |
132 Complex atmp (a); | 132 Complex atmp (a); |
133 result = pow (atmp, b); | 133 result = pow (atmp, b); |
134 return result; | 134 return result; |
135 } | 135 } |
136 | 136 |
137 // -*- 4 -*- | 137 // -*- 4 -*- |
138 tree_constant | 138 octave_value |
139 xpow (double a, const ComplexMatrix& b) | 139 xpow (double a, const ComplexMatrix& b) |
140 { | 140 { |
141 tree_constant retval; | 141 octave_value retval; |
142 | 142 |
143 int nr = b.rows (); | 143 int nr = b.rows (); |
144 int nc = b.columns (); | 144 int nc = b.columns (); |
145 | 145 |
146 if (nr == 0 || nc == 0 || nr != nc) | 146 if (nr == 0 || nc == 0 || nr != nc) |
168 | 168 |
169 return retval; | 169 return retval; |
170 } | 170 } |
171 | 171 |
172 // -*- 5 -*- | 172 // -*- 5 -*- |
173 tree_constant | 173 octave_value |
174 xpow (const Matrix& a, double b) | 174 xpow (const Matrix& a, double b) |
175 { | 175 { |
176 tree_constant retval; | 176 octave_value retval; |
177 | 177 |
178 int nr = a.rows (); | 178 int nr = a.rows (); |
179 int nc = a.columns (); | 179 int nc = a.columns (); |
180 | 180 |
181 if (nr == 0 || nc == 0 || nr != nc) | 181 if (nr == 0 || nc == 0 || nr != nc) |
238 | 238 |
239 return retval; | 239 return retval; |
240 } | 240 } |
241 | 241 |
242 // -*- 6 -*- | 242 // -*- 6 -*- |
243 tree_constant | 243 octave_value |
244 xpow (const Matrix& a, const Complex& b) | 244 xpow (const Matrix& a, const Complex& b) |
245 { | 245 { |
246 tree_constant retval; | 246 octave_value retval; |
247 | 247 |
248 int nr = a.rows (); | 248 int nr = a.rows (); |
249 int nc = a.columns (); | 249 int nc = a.columns (); |
250 | 250 |
251 if (nr == 0 || nc == 0 || nr != nc) | 251 if (nr == 0 || nc == 0 || nr != nc) |
268 | 268 |
269 return retval; | 269 return retval; |
270 } | 270 } |
271 | 271 |
272 // -*- 7 -*- | 272 // -*- 7 -*- |
273 tree_constant | 273 octave_value |
274 xpow (const Complex& a, double b) | 274 xpow (const Complex& a, double b) |
275 { | 275 { |
276 Complex result; | 276 Complex result; |
277 | 277 |
278 if (xisint (b)) | 278 if (xisint (b)) |
282 | 282 |
283 return result; | 283 return result; |
284 } | 284 } |
285 | 285 |
286 // -*- 8 -*- | 286 // -*- 8 -*- |
287 tree_constant | 287 octave_value |
288 xpow (const Complex& a, const Matrix& b) | 288 xpow (const Complex& a, const Matrix& b) |
289 { | 289 { |
290 tree_constant retval; | 290 octave_value retval; |
291 | 291 |
292 int nr = b.rows (); | 292 int nr = b.rows (); |
293 int nc = b.columns (); | 293 int nc = b.columns (); |
294 | 294 |
295 if (nr == 0 || nc == 0 || nr != nc) | 295 if (nr == 0 || nc == 0 || nr != nc) |
317 | 317 |
318 return retval; | 318 return retval; |
319 } | 319 } |
320 | 320 |
321 // -*- 9 -*- | 321 // -*- 9 -*- |
322 tree_constant | 322 octave_value |
323 xpow (const Complex& a, const Complex& b) | 323 xpow (const Complex& a, const Complex& b) |
324 { | 324 { |
325 Complex result; | 325 Complex result; |
326 result = pow (a, b); | 326 result = pow (a, b); |
327 return result; | 327 return result; |
328 } | 328 } |
329 | 329 |
330 // -*- 10 -*- | 330 // -*- 10 -*- |
331 tree_constant | 331 octave_value |
332 xpow (const Complex& a, const ComplexMatrix& b) | 332 xpow (const Complex& a, const ComplexMatrix& b) |
333 { | 333 { |
334 tree_constant retval; | 334 octave_value retval; |
335 | 335 |
336 int nr = b.rows (); | 336 int nr = b.rows (); |
337 int nc = b.columns (); | 337 int nc = b.columns (); |
338 | 338 |
339 if (nr == 0 || nc == 0 || nr != nc) | 339 if (nr == 0 || nc == 0 || nr != nc) |
361 | 361 |
362 return retval; | 362 return retval; |
363 } | 363 } |
364 | 364 |
365 // -*- 11 -*- | 365 // -*- 11 -*- |
366 tree_constant | 366 octave_value |
367 xpow (const ComplexMatrix& a, double b) | 367 xpow (const ComplexMatrix& a, double b) |
368 { | 368 { |
369 tree_constant retval; | 369 octave_value retval; |
370 | 370 |
371 int nr = a.rows (); | 371 int nr = a.rows (); |
372 int nc = a.columns (); | 372 int nc = a.columns (); |
373 | 373 |
374 if (nr == 0 || nc == 0 || nr != nc) | 374 if (nr == 0 || nc == 0 || nr != nc) |
431 | 431 |
432 return retval; | 432 return retval; |
433 } | 433 } |
434 | 434 |
435 // -*- 12 -*- | 435 // -*- 12 -*- |
436 tree_constant | 436 octave_value |
437 xpow (const ComplexMatrix& a, const Complex& b) | 437 xpow (const ComplexMatrix& a, const Complex& b) |
438 { | 438 { |
439 tree_constant retval; | 439 octave_value retval; |
440 | 440 |
441 int nr = a.rows (); | 441 int nr = a.rows (); |
442 int nc = a.columns (); | 442 int nc = a.columns (); |
443 | 443 |
444 if (nr == 0 || nc == 0 || nr != nc) | 444 if (nr == 0 || nc == 0 || nr != nc) |
476 // +---+---+----+----+ | 476 // +---+---+----+----+ |
477 // | 477 // |
478 // * -> not needed. | 478 // * -> not needed. |
479 | 479 |
480 // -*- 1 -*- | 480 // -*- 1 -*- |
481 tree_constant | 481 octave_value |
482 elem_xpow (double a, const Matrix& b) | 482 elem_xpow (double a, const Matrix& b) |
483 { | 483 { |
484 tree_constant retval; | 484 octave_value retval; |
485 | 485 |
486 int nr = b.rows (); | 486 int nr = b.rows (); |
487 int nc = b.columns (); | 487 int nc = b.columns (); |
488 | 488 |
489 // For now, assume the worst. | 489 // For now, assume the worst. |
510 | 510 |
511 return retval; | 511 return retval; |
512 } | 512 } |
513 | 513 |
514 // -*- 2 -*- | 514 // -*- 2 -*- |
515 tree_constant | 515 octave_value |
516 elem_xpow (double a, const ComplexMatrix& b) | 516 elem_xpow (double a, const ComplexMatrix& b) |
517 { | 517 { |
518 int nr = b.rows (); | 518 int nr = b.rows (); |
519 int nc = b.columns (); | 519 int nc = b.columns (); |
520 | 520 |
525 | 525 |
526 return result; | 526 return result; |
527 } | 527 } |
528 | 528 |
529 // -*- 3 -*- | 529 // -*- 3 -*- |
530 tree_constant | 530 octave_value |
531 elem_xpow (const Matrix& a, double b) | 531 elem_xpow (const Matrix& a, double b) |
532 { | 532 { |
533 tree_constant retval; | 533 octave_value retval; |
534 | 534 |
535 int nr = a.rows (); | 535 int nr = a.rows (); |
536 int nc = a.columns (); | 536 int nc = a.columns (); |
537 | 537 |
538 if ((int) b != b && any_element_is_negative (a)) | 538 if ((int) b != b && any_element_is_negative (a)) |
559 | 559 |
560 return retval; | 560 return retval; |
561 } | 561 } |
562 | 562 |
563 // -*- 4 -*- | 563 // -*- 4 -*- |
564 tree_constant | 564 octave_value |
565 elem_xpow (const Matrix& a, const Matrix& b) | 565 elem_xpow (const Matrix& a, const Matrix& b) |
566 { | 566 { |
567 tree_constant retval; | 567 octave_value retval; |
568 | 568 |
569 int nr = a.rows (); | 569 int nr = a.rows (); |
570 int nc = a.columns (); | 570 int nc = a.columns (); |
571 | 571 |
572 assert (nr == b.rows () && nc == b.columns ()); | 572 assert (nr == b.rows () && nc == b.columns ()); |
613 | 613 |
614 return retval; | 614 return retval; |
615 } | 615 } |
616 | 616 |
617 // -*- 5 -*- | 617 // -*- 5 -*- |
618 tree_constant | 618 octave_value |
619 elem_xpow (const Matrix& a, const Complex& b) | 619 elem_xpow (const Matrix& a, const Complex& b) |
620 { | 620 { |
621 int nr = a.rows (); | 621 int nr = a.rows (); |
622 int nc = a.columns (); | 622 int nc = a.columns (); |
623 | 623 |
628 | 628 |
629 return result; | 629 return result; |
630 } | 630 } |
631 | 631 |
632 // -*- 6 -*- | 632 // -*- 6 -*- |
633 tree_constant | 633 octave_value |
634 elem_xpow (const Matrix& a, const ComplexMatrix& b) | 634 elem_xpow (const Matrix& a, const ComplexMatrix& b) |
635 { | 635 { |
636 int nr = a.rows (); | 636 int nr = a.rows (); |
637 int nc = a.columns (); | 637 int nc = a.columns (); |
638 | 638 |
645 | 645 |
646 return result; | 646 return result; |
647 } | 647 } |
648 | 648 |
649 // -*- 7 -*- | 649 // -*- 7 -*- |
650 tree_constant | 650 octave_value |
651 elem_xpow (const Complex& a, const Matrix& b) | 651 elem_xpow (const Complex& a, const Matrix& b) |
652 { | 652 { |
653 int nr = b.rows (); | 653 int nr = b.rows (); |
654 int nc = b.columns (); | 654 int nc = b.columns (); |
655 | 655 |
666 | 666 |
667 return result; | 667 return result; |
668 } | 668 } |
669 | 669 |
670 // -*- 8 -*- | 670 // -*- 8 -*- |
671 tree_constant | 671 octave_value |
672 elem_xpow (const Complex& a, const ComplexMatrix& b) | 672 elem_xpow (const Complex& a, const ComplexMatrix& b) |
673 { | 673 { |
674 int nr = b.rows (); | 674 int nr = b.rows (); |
675 int nc = b.columns (); | 675 int nc = b.columns (); |
676 | 676 |
681 | 681 |
682 return result; | 682 return result; |
683 } | 683 } |
684 | 684 |
685 // -*- 9 -*- | 685 // -*- 9 -*- |
686 tree_constant | 686 octave_value |
687 elem_xpow (const ComplexMatrix& a, double b) | 687 elem_xpow (const ComplexMatrix& a, double b) |
688 { | 688 { |
689 int nr = a.rows (); | 689 int nr = a.rows (); |
690 int nc = a.columns (); | 690 int nc = a.columns (); |
691 | 691 |
706 | 706 |
707 return result; | 707 return result; |
708 } | 708 } |
709 | 709 |
710 // -*- 10 -*- | 710 // -*- 10 -*- |
711 tree_constant | 711 octave_value |
712 elem_xpow (const ComplexMatrix& a, const Matrix& b) | 712 elem_xpow (const ComplexMatrix& a, const Matrix& b) |
713 { | 713 { |
714 int nr = a.rows (); | 714 int nr = a.rows (); |
715 int nc = a.columns (); | 715 int nc = a.columns (); |
716 | 716 |
729 | 729 |
730 return result; | 730 return result; |
731 } | 731 } |
732 | 732 |
733 // -*- 11 -*- | 733 // -*- 11 -*- |
734 tree_constant | 734 octave_value |
735 elem_xpow (const ComplexMatrix& a, const Complex& b) | 735 elem_xpow (const ComplexMatrix& a, const Complex& b) |
736 { | 736 { |
737 int nr = a.rows (); | 737 int nr = a.rows (); |
738 int nc = a.columns (); | 738 int nc = a.columns (); |
739 | 739 |
744 | 744 |
745 return result; | 745 return result; |
746 } | 746 } |
747 | 747 |
748 // -*- 12 -*- | 748 // -*- 12 -*- |
749 tree_constant | 749 octave_value |
750 elem_xpow (const ComplexMatrix& a, const ComplexMatrix& b) | 750 elem_xpow (const ComplexMatrix& a, const ComplexMatrix& b) |
751 { | 751 { |
752 int nr = a.rows (); | 752 int nr = a.rows (); |
753 int nc = a.columns (); | 753 int nc = a.columns (); |
754 | 754 |