# Superoperator dims

Jump to navigation
Jump to search

superoperator_dims | |

Computes the input, output, and environment dimensions of a superoperator | |

Other toolboxes required | none |
---|---|

Function category | Helper functions |

This is a helper function that only exists to aid other functions in QETLAB. If you are an end-user of QETLAB, you likely will never have a reason to use this function. |

` superoperator_dims` is a function that computes all of the dimensions of a given superoperator (i.e., the dimensions of its input space, output space, and environment space). It also serves as an error-checking function that will get cranky if the superoperator passed into it does not really represent a superopertor.

## Syntax

`[DA,DB,DE] = superoperator_dims(PHI)``[DA,DB,DE] = superoperator_dims(PHI,ALLOW_RECT)``[DA,DB,DE] = superoperator_dims(PHI,ALLOW_RECT,DIM)`

## Argument descriptions

### Input arguments

`PHI`: A superoperator, represented either as a Choi matrix or as a cell of Kraus operators.`ALLOW_RECT`(optional, default 1): A flag (either 1 or 0) indicating that the input and output spaces of`PHI`can or can't be rectangular (non-square). If`ALLOW_RECT == 0`and`PHI`has non-square input or output space, an error is produced.`DIM`(optional): A 1-by-2 vector containing the dimensions of the input and output space of`PHI`. If this argument is provided, the function serves only as an error-checking function that makes sure that the computed dimensions agree with these given dimensions (and gives an error otherwise).

### Output arguments

`DA`: A 1-by-2 vector containing the row and column dimensions of the input space of`PHI`(if`ALLOW_RECT == 0`then`DA`is a scalar, not a vector).`DB`(optional): A 1-by-2 vector containing the row and column dimensions of the output space of`PHI`(if`ALLOW_RECT == 0`then`DB`is a scalar, not a vector).`DE`(optional): A scalar indicating the environment dimension of`PHI`(this is sometimes call the "Choi rank" of`PHI`: it is the minimal number of Kraus operators in any representation of`PHI`).

## Examples

The following code generates a random quantum channel from $M_3$ to $M_4$ and then computes its dimensions, and verifies that it cannot be written with fewer than 12 Kraus operators (which happens with probability 1):

```
>> Phi = KrausOperators(RandomSuperoperator([3,4]),[3,4]);
>> [da,db,de] = superoperator_dims(Phi)
da =
3 3
db =
4 4
de =
12
```

## Source code

Click here to view this function's source code on github.