MCPcopy Index your code
hub / github.com/numpy/numpy / test_conjugate

Method test_conjugate

numpy/_core/tests/test_multiarray.py:4237–4272  ·  view source on GitHub ↗
(self)

Source from the content-addressed store, hash-verified

4235 b = c
4236
4237 def test_conjugate(self):
4238 a = np.array([1 - 1j, 1 + 1j, 23 + 23.0j])
4239 ac = a.conj()
4240 assert_equal(a.real, ac.real)
4241 assert_equal(a.imag, -ac.imag)
4242 assert_equal(ac, a.conjugate())
4243 assert_equal(ac, np.conjugate(a))
4244
4245 a = np.array([1 - 1j, 1 + 1j, 23 + 23.0j], 'F')
4246 ac = a.conj()
4247 assert_equal(a.real, ac.real)
4248 assert_equal(a.imag, -ac.imag)
4249 assert_equal(ac, a.conjugate())
4250 assert_equal(ac, np.conjugate(a))
4251
4252 a = np.array([1, 2, 3])
4253 ac = a.conj()
4254 assert_equal(a, ac)
4255 assert_equal(ac, a.conjugate())
4256 assert_equal(ac, np.conjugate(a))
4257
4258 a = np.array([1.0, 2.0, 3.0])
4259 ac = a.conj()
4260 assert_equal(a, ac)
4261 assert_equal(ac, a.conjugate())
4262 assert_equal(ac, np.conjugate(a))
4263
4264 a = np.array([1 - 1j, 1 + 1j, 1, 2.0], object)
4265 ac = a.conj()
4266 assert_equal(ac, [k.conjugate() for k in a])
4267 assert_equal(ac, a.conjugate())
4268 assert_equal(ac, np.conjugate(a))
4269
4270 a = np.array([1 - 1j, 1, 2.0, 'f'], object)
4271 assert_raises(TypeError, a.conj)
4272 assert_raises(TypeError, a.conjugate)
4273
4274 @pytest.mark.parametrize("dtype", ["?", "b", "h", "I"])
4275 def test_conjugate_view(self, dtype):

Callers

nothing calls this directly

Calls 3

assert_equalFunction · 0.90
assert_raisesFunction · 0.90
conjugateMethod · 0.80

Tested by

no test coverage detected