MCPcopy Create free account
hub / github.com/numpy/numpy / test_dot

Method test_dot

numpy/ma/tests/test_core.py:4007–4029  ·  view source on GitHub ↗
(self)

Source from the content-addressed store, hash-verified

4005 assert_equal(arr.trace(axis1=1, axis2=2), m_arr.trace(axis1=1, axis2=2))
4006
4007 def test_dot(self):
4008 # Tests dot on MaskedArrays.
4009 (x, X, XX, m, mx, mX, mXX, m2x, m2X, m2XX) = self.d
4010 fx = mx.filled(0)
4011 r = mx.dot(mx)
4012 assert_almost_equal(r.filled(0), fx.dot(fx))
4013 assert_(r.mask is nomask)
4014
4015 fX = mX.filled(0)
4016 r = mX.dot(mX)
4017 assert_almost_equal(r.filled(0), fX.dot(fX))
4018 assert_(r.mask[1,3])
4019 r1 = empty_like(r)
4020 mX.dot(mX, out=r1)
4021 assert_almost_equal(r, r1)
4022
4023 mYY = mXX.swapaxes(-1, -2)
4024 fXX, fYY = mXX.filled(0), mYY.filled(0)
4025 r = mXX.dot(mYY)
4026 assert_almost_equal(r.filled(0), fXX.dot(fYY))
4027 r1 = empty_like(r)
4028 mXX.dot(mYY, out=r1)
4029 assert_almost_equal(r, r1)
4030
4031 def test_dot_shape_mismatch(self):
4032 # regression test

Callers

nothing calls this directly

Calls 5

assert_almost_equalFunction · 0.90
empty_likeFunction · 0.90
dotMethod · 0.80
assert_Function · 0.50
filledMethod · 0.45

Tested by

no test coverage detected