qiskit/quantum_info/operators/channel/transformations.py
def _to_ptm(rep, data, input_dim, output_dim):
    """Transform a QuantumChannel to the PTM representation."""
    if rep == 'PTM':
        return data
    # Check valid n-qubit input
    _check_nqubit_dim(input_dim, output_dim)
    if rep == 'Operator':
        return _from_operator('PTM', data, input_dim, output_dim)
    # Convert via Superoperator representation
    if rep != 'SuperOp':
        data = _to_superop(rep, data, input_dim, output_dim)
    return _superop_to_ptm(data, input_dim, output_dim)
def _to_ptm(rep, data, input_dim, output_dim):
    if rep == 'PTM':
        return data
    # Check valid n-qubit input
    _check_nqubit_dim(input_dim, output_dim)
    if rep == 'Operator':
        return _from_operator('PTM', data, input_dim, output_dim)
    # Convert via Superoperator representation
    if rep != 'SuperOp':
        data = _to_superop(rep, data, input_dim, output_dim)
    return _superop_to_ptm(data, input_dim, output_dim)
def _to_ptm ( rep , data , input_dim , output_dim ) : if rep == 'PTM' : return data # Check valid n-qubit input _check_nqubit_dim ( input_dim , output_dim ) if rep == 'Operator' : return _from_operator ( 'PTM' , data , input_dim , output_dim ) # Convert via Superoperator representation if rep != 'SuperOp' : data = _to_superop ( rep , data , input_dim , output_dim ) return _superop_to_ptm ( data , input_dim , output_dim )
Transform a QuantumChannel to the PTM representation.
Transform a QuantumChannel to the PTM representation .