@@ -201,8 +201,12 @@ def adjoint(self):
201201 def _adjoint (self ):
202202 """Default implementation of _adjoint; defers to rmatvec."""
203203 shape = (self .shape [1 ], self .shape [0 ])
204- return _CustomLinearOperator (shape , matvec = self .rmatvec ,
205- rmatvec = self .matvec ,
204+ return _CustomLinearOperator (shape , matvec = self ._rmatvec ,
205+ rmatvec = self ._matvec ,
206+ compute = (self .compute [1 ],
207+ self .compute [0 ]),
208+ todask = (self .todask [1 ],
209+ self .todask [0 ]),
206210 dtype = self .dtype )
207211
208212 def div1 (self , y , niter = 100 ):
@@ -286,7 +290,7 @@ def _adjoint(self):
286290 matvec = self .__rmatvec_impl ,
287291 rmatvec = self .__matvec_impl ,
288292 dtype = self .dtype ,
289- compute = self .compute ,
293+ compute = ( self .compute [ 1 ], self . compute [ 0 ]) ,
290294 todask = (self .todask [1 ], self .todask [0 ]))
291295
292296
@@ -319,13 +323,13 @@ def __init__(self, A, B):
319323 self .args = (Ac , Bc )
320324
321325 def _matvec (self , x ):
322- return self .args [0 ].matvec (x ) + self .args [1 ].matvec (x )
326+ return self .args [0 ]._matvec (x ) + self .args [1 ]._matvec (x )
323327
324328 def _rmatvec (self , x ):
325- return self .args [0 ].rmatvec (x ) + self .args [1 ].rmatvec (x )
329+ return self .args [0 ]._rmatvec (x ) + self .args [1 ]._rmatvec (x )
326330
327331 def _matmat (self , x ):
328- return self .args [0 ].matmat (x ) + self .args [1 ].matmat (x )
332+ return self .args [0 ]._matmat (x ) + self .args [1 ]._matmat (x )
329333
330334 def _adjoint (self ):
331335 A , B = self .args
@@ -345,8 +349,8 @@ def __init__(self, A, B):
345349 dtype = A .dtype , Op = None ,
346350 explicit = A .explicit and
347351 B .explicit ,
348- compute = (B .compute [0 ],
349- A .compute [1 ]),
352+ compute = (A .compute [0 ],
353+ B .compute [1 ]),
350354 todask = (B .todask [0 ],
351355 A .todask [1 ]))
352356 # Force compute and todask not to be applied to individual operators
@@ -359,13 +363,13 @@ def __init__(self, A, B):
359363 self .args = (Ac , Bc )
360364
361365 def _matvec (self , x ):
362- return self .args [0 ].matvec (self .args [1 ].matvec (x ))
366+ return self .args [0 ]._matvec (self .args [1 ]._matvec (x ))
363367
364368 def _rmatvec (self , x ):
365- return self .args [1 ].rmatvec (self .args [0 ].rmatvec (x ))
369+ return self .args [1 ]._rmatvec (self .args [0 ]._rmatvec (x ))
366370
367371 def _matmat (self , x ):
368- return self .args [0 ].matmat (self .args [1 ].matmat (x ))
372+ return self .args [0 ]._matmat (self .args [1 ]._matmat (x ))
369373
370374 def _adjoint (self ):
371375 A , B = self .args
@@ -390,13 +394,13 @@ def __init__(self, A, alpha):
390394 self .args = (Ac , alpha )
391395
392396 def _matvec (self , x ):
393- return self .args [1 ] * self .args [0 ].matvec (x )
397+ return self .args [1 ] * self .args [0 ]._matvec (x )
394398
395399 def _rmatvec (self , x ):
396- return np .conj (self .args [1 ]) * self .args [0 ].rmatvec (x )
400+ return np .conj (self .args [1 ]) * self .args [0 ]._rmatvec (x )
397401
398402 def _matmat (self , x ):
399- return self .args [1 ] * self .args [0 ].matmat (x )
403+ return self .args [1 ] * self .args [0 ]._matmat (x )
400404
401405 def _adjoint (self ):
402406 A , alpha = self .args
@@ -428,13 +432,13 @@ def _power(self, fun, x, compute):
428432 return res
429433
430434 def _matvec (self , x ):
431- return self ._power (self .args [0 ].matvec , x , self .compute [0 ])
435+ return self ._power (self .args [0 ]._matvec , x , self .compute [0 ])
432436
433437 def _rmatvec (self , x ):
434- return self ._power (self .args [0 ].rmatvec , x , self .compute [1 ])
438+ return self ._power (self .args [0 ]._rmatvec , x , self .compute [1 ])
435439
436440 def _matmat (self , x ):
437- return self ._power (self .args [0 ].matmat , x , self .compute [0 ])
441+ return self ._power (self .args [0 ]._matmat , x , self .compute [0 ])
438442
439443 def _adjoint (self ):
440444 A , p = self .args
@@ -489,4 +493,4 @@ def aslinearoperator(Op):
489493 return Op
490494 else :
491495 return LinearOperator (Op .shape , Op .dtype , Op , explicit = Op .explicit ,
492- compute = Op .compute , todask = Op .todask )
496+ compute = Op .compute , todask = Op .todask )
0 commit comments