(self)
| 662 | assert_equal(res, mask_rowcols(x, rowcols_axis)) |
| 663 | |
| 664 | def test_dot(self): |
| 665 | # Tests dot product |
| 666 | n = np.arange(1, 7) |
| 667 | # |
| 668 | m = [1, 0, 0, 0, 0, 0] |
| 669 | a = masked_array(n, mask=m).reshape(2, 3) |
| 670 | b = masked_array(n, mask=m).reshape(3, 2) |
| 671 | c = dot(a, b, strict=True) |
| 672 | assert_equal(c.mask, [[1, 1], [1, 0]]) |
| 673 | c = dot(b, a, strict=True) |
| 674 | assert_equal(c.mask, [[1, 1, 1], [1, 0, 0], [1, 0, 0]]) |
| 675 | c = dot(a, b, strict=False) |
| 676 | assert_equal(c, np.dot(a.filled(0), b.filled(0))) |
| 677 | c = dot(b, a, strict=False) |
| 678 | assert_equal(c, np.dot(b.filled(0), a.filled(0))) |
| 679 | # |
| 680 | m = [0, 0, 0, 0, 0, 1] |
| 681 | a = masked_array(n, mask=m).reshape(2, 3) |
| 682 | b = masked_array(n, mask=m).reshape(3, 2) |
| 683 | c = dot(a, b, strict=True) |
| 684 | assert_equal(c.mask, [[0, 1], [1, 1]]) |
| 685 | c = dot(b, a, strict=True) |
| 686 | assert_equal(c.mask, [[0, 0, 1], [0, 0, 1], [1, 1, 1]]) |
| 687 | c = dot(a, b, strict=False) |
| 688 | assert_equal(c, np.dot(a.filled(0), b.filled(0))) |
| 689 | assert_equal(c, dot(a, b)) |
| 690 | c = dot(b, a, strict=False) |
| 691 | assert_equal(c, np.dot(b.filled(0), a.filled(0))) |
| 692 | # |
| 693 | m = [0, 0, 0, 0, 0, 0] |
| 694 | a = masked_array(n, mask=m).reshape(2, 3) |
| 695 | b = masked_array(n, mask=m).reshape(3, 2) |
| 696 | c = dot(a, b) |
| 697 | assert_equal(c.mask, nomask) |
| 698 | c = dot(b, a) |
| 699 | assert_equal(c.mask, nomask) |
| 700 | # |
| 701 | a = masked_array(n, mask=[1, 0, 0, 0, 0, 0]).reshape(2, 3) |
| 702 | b = masked_array(n, mask=[0, 0, 0, 0, 0, 0]).reshape(3, 2) |
| 703 | c = dot(a, b, strict=True) |
| 704 | assert_equal(c.mask, [[1, 1], [0, 0]]) |
| 705 | c = dot(a, b, strict=False) |
| 706 | assert_equal(c, np.dot(a.filled(0), b.filled(0))) |
| 707 | c = dot(b, a, strict=True) |
| 708 | assert_equal(c.mask, [[1, 0, 0], [1, 0, 0], [1, 0, 0]]) |
| 709 | c = dot(b, a, strict=False) |
| 710 | assert_equal(c, np.dot(b.filled(0), a.filled(0))) |
| 711 | # |
| 712 | a = masked_array(n, mask=[0, 0, 0, 0, 0, 1]).reshape(2, 3) |
| 713 | b = masked_array(n, mask=[0, 0, 0, 0, 0, 0]).reshape(3, 2) |
| 714 | c = dot(a, b, strict=True) |
| 715 | assert_equal(c.mask, [[0, 0], [1, 1]]) |
| 716 | c = dot(a, b) |
| 717 | assert_equal(c, np.dot(a.filled(0), b.filled(0))) |
| 718 | c = dot(b, a, strict=True) |
| 719 | assert_equal(c.mask, [[0, 0, 1], [0, 0, 1], [0, 0, 1]]) |
| 720 | c = dot(b, a, strict=False) |
| 721 | assert_equal(c, np.dot(b.filled(0), a.filled(0))) |
nothing calls this directly
no test coverage detected