@@ -391,7 +391,6 @@ def unitary_kraus(
391
391
prob : Optional [Sequence [float ]] = None ,
392
392
status : Optional [float ] = None ,
393
393
name : Optional [str ] = None ,
394
- return_gate : bool = False ,
395
394
) -> Tensor :
396
395
"""
397
396
Apply unitary gates in ``kraus`` randomly based on corresponding ``prob``.
@@ -423,7 +422,6 @@ def index2gate(r: Tensor, kraus: Sequence[Tensor]) -> Tensor:
423
422
status = status ,
424
423
get_gate_from_index = index2gate ,
425
424
name = name ,
426
- return_gate = return_gate ,
427
425
)
428
426
429
427
def _unitary_kraus_template (
@@ -436,7 +434,6 @@ def _unitary_kraus_template(
436
434
Callable [[Tensor , Sequence [Tensor ]], Tensor ]
437
435
] = None ,
438
436
name : Optional [str ] = None ,
439
- return_gate : bool = False ,
440
437
) -> Tensor : # DRY
441
438
sites = len (index )
442
439
kraus = [k .tensor if isinstance (k , tn .Node ) else k for k in kraus ]
@@ -478,9 +475,7 @@ def step_function(x: Tensor) -> Tensor:
478
475
raise ValueError ("no `get_gate_from_index` implementation is provided" )
479
476
g = get_gate_from_index (r , kraus )
480
477
g = backend .reshape (g , [self ._d for _ in range (sites * 2 )])
481
- if return_gate :
482
- return r , g
483
- self .any (* index , unitary = g , name = name ) # type: ignore
478
+ self .any (* index , unitary = g , name = name , dim = self ._d ) # type: ignore
484
479
return r
485
480
486
481
def _general_kraus_tf (
@@ -558,7 +553,6 @@ def _general_kraus_2(
558
553
status : Optional [float ] = None ,
559
554
with_prob : bool = False ,
560
555
name : Optional [str ] = None ,
561
- return_gate : bool = False ,
562
556
) -> Tensor :
563
557
# the graph building time is frustratingly slow, several minutes
564
558
# though running time is in terms of ms
@@ -611,7 +605,6 @@ def calculate_kraus_p(i: int) -> Tensor:
611
605
prob = prob ,
612
606
status = status ,
613
607
name = name ,
614
- return_gate = return_gate ,
615
608
)
616
609
if not with_prob :
617
610
return pick
@@ -625,7 +618,6 @@ def general_kraus(
625
618
status : Optional [float ] = None ,
626
619
with_prob : bool = False ,
627
620
name : Optional [str ] = None ,
628
- return_gate : bool = False ,
629
621
) -> Tensor :
630
622
"""
631
623
Monte Carlo trajectory simulation of general Kraus channel whose Kraus operators cannot be
@@ -650,7 +642,6 @@ def general_kraus(
650
642
status = status ,
651
643
with_prob = with_prob ,
652
644
name = name ,
653
- return_gate = return_gate ,
654
645
)
655
646
656
647
apply_general_kraus = general_kraus
0 commit comments