Mentions légales du service

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

Add pyfaust.lazylinop.asLazyLinearOp and its unit test.

parent 670c5527
Branches
No related tags found
No related merge requests found
...@@ -507,3 +507,9 @@ def isLazyLinearOp(obj): ...@@ -507,3 +507,9 @@ def isLazyLinearOp(obj):
Returns True if obj is a LazyLinearOp, False otherwise. Returns True if obj is a LazyLinearOp, False otherwise.
""" """
return LazyLinearOp.isLazyLinearOp(obj) return LazyLinearOp.isLazyLinearOp(obj)
def asLazyLinearOp(obj):
"""
Creates a LazyLinearOp based on the object obj which must be of a linear operator compatible type.
"""
return LazyLinearOp.create(obj)
...@@ -185,5 +185,12 @@ class TestLazyLinearOpFaust(unittest.TestCase): ...@@ -185,5 +185,12 @@ class TestLazyLinearOpFaust(unittest.TestCase):
lcF = lcF.imag lcF = lcF.imag
self.assertAlmostEqual(LA.norm(lcF.toarray()-cF.imag.toarray()), 0) self.assertAlmostEqual(LA.norm(lcF.toarray()-cF.imag.toarray()), 0)
def test_aslazylinop(self):
from pyfaust.lazylinop import asLazyLinearOp
cF = pf.rand(10, 15, field='complex')
lcF = asLazyLinearOp(cF)
self.assertTrue(pf.lazylinop.isLazyLinearOp(lcF))
self.assertEqual(cF.shape, lcF.shape)
if '__main__' == __name__: if '__main__' == __name__:
unittest.main() unittest.main()
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment