(self)
| 750 | assert_equal(res, mask_rowcols(x, rowcols_axis)) |
| 751 | |
| 752 | def test_dot(self): |
| 753 | # Tests dot product |
| 754 | n = np.arange(1, 7) |
| 755 | # |
| 756 | m = [1, 0, 0, 0, 0, 0] |
| 757 | a = masked_array(n, mask=m).reshape(2, 3) |
| 758 | b = masked_array(n, mask=m).reshape(3, 2) |
| 759 | c = dot(a, b, strict=True) |
| 760 | assert_equal(c.mask, [[1, 1], [1, 0]]) |
| 761 | c = dot(b, a, strict=True) |
| 762 | assert_equal(c.mask, [[1, 1, 1], [1, 0, 0], [1, 0, 0]]) |
| 763 | c = dot(a, b, strict=False) |
| 764 | assert_equal(c, np.dot(a.filled(0), b.filled(0))) |
| 765 | c = dot(b, a, strict=False) |
| 766 | assert_equal(c, np.dot(b.filled(0), a.filled(0))) |
| 767 | # |
| 768 | m = [0, 0, 0, 0, 0, 1] |
| 769 | a = masked_array(n, mask=m).reshape(2, 3) |
| 770 | b = masked_array(n, mask=m).reshape(3, 2) |
| 771 | c = dot(a, b, strict=True) |
| 772 | assert_equal(c.mask, [[0, 1], [1, 1]]) |
| 773 | c = dot(b, a, strict=True) |
| 774 | assert_equal(c.mask, [[0, 0, 1], [0, 0, 1], [1, 1, 1]]) |
| 775 | c = dot(a, b, strict=False) |
| 776 | assert_equal(c, np.dot(a.filled(0), b.filled(0))) |
| 777 | assert_equal(c, dot(a, b)) |
| 778 | c = dot(b, a, strict=False) |
| 779 | assert_equal(c, np.dot(b.filled(0), a.filled(0))) |
| 780 | # |
| 781 | m = [0, 0, 0, 0, 0, 0] |
| 782 | a = masked_array(n, mask=m).reshape(2, 3) |
| 783 | b = masked_array(n, mask=m).reshape(3, 2) |
| 784 | c = dot(a, b) |
| 785 | assert_equal(c.mask, nomask) |
| 786 | c = dot(b, a) |
| 787 | assert_equal(c.mask, nomask) |
| 788 | # |
| 789 | a = masked_array(n, mask=[1, 0, 0, 0, 0, 0]).reshape(2, 3) |
| 790 | b = masked_array(n, mask=[0, 0, 0, 0, 0, 0]).reshape(3, 2) |
| 791 | c = dot(a, b, strict=True) |
| 792 | assert_equal(c.mask, [[1, 1], [0, 0]]) |
| 793 | c = dot(a, b, strict=False) |
| 794 | assert_equal(c, np.dot(a.filled(0), b.filled(0))) |
| 795 | c = dot(b, a, strict=True) |
| 796 | assert_equal(c.mask, [[1, 0, 0], [1, 0, 0], [1, 0, 0]]) |
| 797 | c = dot(b, a, strict=False) |
| 798 | assert_equal(c, np.dot(b.filled(0), a.filled(0))) |
| 799 | # |
| 800 | a = masked_array(n, mask=[0, 0, 0, 0, 0, 1]).reshape(2, 3) |
| 801 | b = masked_array(n, mask=[0, 0, 0, 0, 0, 0]).reshape(3, 2) |
| 802 | c = dot(a, b, strict=True) |
| 803 | assert_equal(c.mask, [[0, 0], [1, 1]]) |
| 804 | c = dot(a, b) |
| 805 | assert_equal(c, np.dot(a.filled(0), b.filled(0))) |
| 806 | c = dot(b, a, strict=True) |
| 807 | assert_equal(c.mask, [[0, 0, 1], [0, 0, 1], [0, 0, 1]]) |
| 808 | c = dot(b, a, strict=False) |
| 809 | assert_equal(c, np.dot(b.filled(0), a.filled(0))) |
nothing calls this directly
no test coverage detected