comparison src/arith-ops.cc @ 722:c40cdd16121e

[project @ 1994-09-21 15:22:21 by jwe]
author jwe
date Wed, 21 Sep 1994 15:24:26 +0000
parents fae2bd91c027
children 42731861ee09
comparison
equal deleted inserted replaced
721:54a6858bc7e7 722:c40cdd16121e
218 mx_stupid_bool_op (Matrix_bool_op op, double s, const Matrix& a) 218 mx_stupid_bool_op (Matrix_bool_op op, double s, const Matrix& a)
219 { 219 {
220 int ar = a.rows (); 220 int ar = a.rows ();
221 int ac = a.columns (); 221 int ac = a.columns ();
222 222
223 if (ar == 0 || ac == 0)
224 {
225 if (op == Matrix_EQ)
226 return Matrix (1, 1, 0.0);
227 else if (op == Matrix_NE)
228 return Matrix (1, 1, 1.0);
229 }
230
223 Matrix t (ar, ac); 231 Matrix t (ar, ac);
224 232
225 for (int j = 0; j < ac; j++) 233 for (int j = 0; j < ac; j++)
226 for (int i = 0; i < ar; i++) 234 for (int i = 0; i < ar; i++)
227 { 235 {
265 mx_stupid_bool_op (Matrix_bool_op op, double s, const ComplexMatrix& a) 273 mx_stupid_bool_op (Matrix_bool_op op, double s, const ComplexMatrix& a)
266 { 274 {
267 int ar = a.rows (); 275 int ar = a.rows ();
268 int ac = a.columns (); 276 int ac = a.columns ();
269 277
278 if (ar == 0 || ac == 0)
279 {
280 if (op == Matrix_EQ)
281 return Matrix (1, 1, 0.0);
282 else if (op == Matrix_NE)
283 return Matrix (1, 1, 1.0);
284 }
285
270 Matrix t (ar, ac); 286 Matrix t (ar, ac);
271 287
272 for (int j = 0; j < ac; j++) 288 for (int j = 0; j < ac; j++)
273 for (int i = 0; i < ar; i++) 289 for (int i = 0; i < ar; i++)
274 { 290 {
312 mx_stupid_bool_op (Matrix_bool_op op, const Matrix& a, double s) 328 mx_stupid_bool_op (Matrix_bool_op op, const Matrix& a, double s)
313 { 329 {
314 int ar = a.rows (); 330 int ar = a.rows ();
315 int ac = a.columns (); 331 int ac = a.columns ();
316 332
333 if (ar == 0 || ac == 0)
334 {
335 if (op == Matrix_EQ)
336 return Matrix (1, 1, 0.0);
337 else if (op == Matrix_NE)
338 return Matrix (1, 1, 1.0);
339 }
340
317 Matrix t (ar, ac); 341 Matrix t (ar, ac);
318 342
319 for (int j = 0; j < ac; j++) 343 for (int j = 0; j < ac; j++)
320 for (int i = 0; i < ar; i++) 344 for (int i = 0; i < ar; i++)
321 { 345 {
359 mx_stupid_bool_op (Matrix_bool_op op, const Matrix& a, const Complex& s) 383 mx_stupid_bool_op (Matrix_bool_op op, const Matrix& a, const Complex& s)
360 { 384 {
361 int ar = a.rows (); 385 int ar = a.rows ();
362 int ac = a.columns (); 386 int ac = a.columns ();
363 387
388 if (ar == 0 || ac == 0)
389 {
390 if (op == Matrix_EQ)
391 return Matrix (1, 1, 0.0);
392 else if (op == Matrix_NE)
393 return Matrix (1, 1, 1.0);
394 }
395
364 Matrix t (ar, ac); 396 Matrix t (ar, ac);
365 397
366 for (int j = 0; j < ac; j++) 398 for (int j = 0; j < ac; j++)
367 for (int i = 0; i < ar; i++) 399 for (int i = 0; i < ar; i++)
368 { 400 {
409 return Matrix (); 441 return Matrix ();
410 442
411 int ar = a.rows (); 443 int ar = a.rows ();
412 int ac = a.columns (); 444 int ac = a.columns ();
413 445
446 if (ar == 0 || ac == 0)
447 {
448 if (op == Matrix_EQ)
449 return Matrix (1, 1, 1.0);
450 else if (op == Matrix_NE)
451 return Matrix (1, 1, 0.0);
452 }
453
414 Matrix c (ar, ac); 454 Matrix c (ar, ac);
415 455
416 for (int j = 0; j < ac; j++) 456 for (int j = 0; j < ac; j++)
417 for (int i = 0; i < ar; i++) 457 for (int i = 0; i < ar; i++)
418 { 458 {
459 return Matrix (); 499 return Matrix ();
460 500
461 int ar = a.rows (); 501 int ar = a.rows ();
462 int ac = a.columns (); 502 int ac = a.columns ();
463 503
504 if (ar == 0 || ac == 0)
505 {
506 if (op == Matrix_EQ)
507 return Matrix (1, 1, 1.0);
508 else if (op == Matrix_NE)
509 return Matrix (1, 1, 0.0);
510 }
511
464 Matrix c (ar, ac); 512 Matrix c (ar, ac);
465 513
466 for (int j = 0; j < ac; j++) 514 for (int j = 0; j < ac; j++)
467 for (int i = 0; i < ar; i++) 515 for (int i = 0; i < ar; i++)
468 { 516 {
505 mx_stupid_bool_op (Matrix_bool_op op, const Complex& s, const Matrix& a) 553 mx_stupid_bool_op (Matrix_bool_op op, const Complex& s, const Matrix& a)
506 { 554 {
507 int ar = a.rows (); 555 int ar = a.rows ();
508 int ac = a.columns (); 556 int ac = a.columns ();
509 557
558 if (ar == 0 || ac == 0)
559 {
560 if (op == Matrix_EQ)
561 return Matrix (1, 1, 0.0);
562 else if (op == Matrix_NE)
563 return Matrix (1, 1, 1.0);
564 }
565
510 Matrix t (ar, ac); 566 Matrix t (ar, ac);
511 567
512 for (int j = 0; j < ac; j++) 568 for (int j = 0; j < ac; j++)
513 for (int i = 0; i < ar; i++) 569 for (int i = 0; i < ar; i++)
514 { 570 {
552 mx_stupid_bool_op (Matrix_bool_op op, const Complex& s, const ComplexMatrix& a) 608 mx_stupid_bool_op (Matrix_bool_op op, const Complex& s, const ComplexMatrix& a)
553 { 609 {
554 int ar = a.rows (); 610 int ar = a.rows ();
555 int ac = a.columns (); 611 int ac = a.columns ();
556 612
613 if (ar == 0 || ac == 0)
614 {
615 if (op == Matrix_EQ)
616 return Matrix (1, 1, 0.0);
617 else if (op == Matrix_NE)
618 return Matrix (1, 1, 1.0);
619 }
620
557 Matrix t (ar, ac); 621 Matrix t (ar, ac);
558 622
559 for (int j = 0; j < ac; j++) 623 for (int j = 0; j < ac; j++)
560 for (int i = 0; i < ar; i++) 624 for (int i = 0; i < ar; i++)
561 { 625 {
599 mx_stupid_bool_op (Matrix_bool_op op, const ComplexMatrix& a, double s) 663 mx_stupid_bool_op (Matrix_bool_op op, const ComplexMatrix& a, double s)
600 { 664 {
601 int ar = a.rows (); 665 int ar = a.rows ();
602 int ac = a.columns (); 666 int ac = a.columns ();
603 667
668 if (ar == 0 || ac == 0)
669 {
670 if (op == Matrix_EQ)
671 return Matrix (1, 1, 0.0);
672 else if (op == Matrix_NE)
673 return Matrix (1, 1, 1.0);
674 }
675
604 Matrix t (ar, ac); 676 Matrix t (ar, ac);
605 677
606 for (int j = 0; j < ac; j++) 678 for (int j = 0; j < ac; j++)
607 for (int i = 0; i < ar; i++) 679 for (int i = 0; i < ar; i++)
608 { 680 {
646 mx_stupid_bool_op (Matrix_bool_op op, const ComplexMatrix& a, const Complex& s) 718 mx_stupid_bool_op (Matrix_bool_op op, const ComplexMatrix& a, const Complex& s)
647 { 719 {
648 int ar = a.rows (); 720 int ar = a.rows ();
649 int ac = a.columns (); 721 int ac = a.columns ();
650 722
723 if (ar == 0 || ac == 0)
724 {
725 if (op == Matrix_EQ)
726 return Matrix (1, 1, 0.0);
727 else if (op == Matrix_NE)
728 return Matrix (1, 1, 1.0);
729 }
730
651 Matrix t (ar, ac); 731 Matrix t (ar, ac);
652 732
653 for (int j = 0; j < ac; j++) 733 for (int j = 0; j < ac; j++)
654 for (int i = 0; i < ar; i++) 734 for (int i = 0; i < ar; i++)
655 { 735 {
696 return Matrix (); 776 return Matrix ();
697 777
698 int ar = a.rows (); 778 int ar = a.rows ();
699 int ac = a.columns (); 779 int ac = a.columns ();
700 780
781 if (ar == 0 || ac == 0)
782 {
783 if (op == Matrix_EQ)
784 return Matrix (1, 1, 1.0);
785 else if (op == Matrix_NE)
786 return Matrix (1, 1, 0.0);
787 }
788
701 Matrix c (ar, ac); 789 Matrix c (ar, ac);
702 790
703 for (int j = 0; j < ac; j++) 791 for (int j = 0; j < ac; j++)
704 for (int i = 0; i < ar; i++) 792 for (int i = 0; i < ar; i++)
705 { 793 {
745 if (! m_add_conform (a, b, 1)) 833 if (! m_add_conform (a, b, 1))
746 return Matrix (); 834 return Matrix ();
747 835
748 int ar = a.rows (); 836 int ar = a.rows ();
749 int ac = a.columns (); 837 int ac = a.columns ();
838
839 if (ar == 0 || ac == 0)
840 {
841 if (op == Matrix_EQ)
842 return Matrix (1, 1, 1.0);
843 else if (op == Matrix_NE)
844 return Matrix (1, 1, 0.0);
845 }
750 846
751 Matrix c (ar, ac); 847 Matrix c (ar, ac);
752 848
753 for (int j = 0; j < ac; j++) 849 for (int j = 0; j < ac; j++)
754 for (int i = 0; i < ar; i++) 850 for (int i = 0; i < ar; i++)