Mentions légales du service

Skip to content
Snippets Groups Projects
Commit 670c5527 authored by hhakim's avatar hhakim
Browse files

Add FaustLazyLinearOp.imag and its unit test.

parent dd747d97
No related branches found
No related tags found
No related merge requests found
......@@ -445,6 +445,18 @@ class LazyLinearOp:
root_obj=self._root_obj)
return new_op
@property
def imag(self):
"""
Returns the LazyLinearOp for imag.
"""
self._checkattr('imag')
new_op = self.__class__(init_lambda=lambda:
(self._lambda_stack()).imag,
shape=self.shape,
root_obj=self._root_obj)
return new_op
@staticmethod
def isLazyLinearOp(obj):
......
......@@ -179,5 +179,11 @@ class TestLazyLinearOpFaust(unittest.TestCase):
lcF = lcF.real
self.assertAlmostEqual(LA.norm(lcF.toarray()-cF.real.toarray()), 0)
def test_imag(self):
cF = pf.rand(10, 15, field='complex')
lcF = LazyLinearOp.create(cF)
lcF = lcF.imag
self.assertAlmostEqual(LA.norm(lcF.toarray()-cF.imag.toarray()), 0)
if '__main__' == __name__:
unittest.main()
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment