qiskit_noise_learning.math.LinearMap
class qiskit_noise_learning.math.LinearMap(input_space: IndexedSpace[InputIndex], output_space: IndexedSpace[OutputIndex])
Bases: Generic[InputIndex, OutputIndex], ABC
An implicit linear map between two indexed spaces.
Parameters
- input_space – The input space.
- output_space – The output space.
__init__
__init__(input_space: IndexedSpace[InputIndex], output_space: IndexedSpace[OutputIndex])
Methods
Column 1 | Column 2 |
|---|---|
__init__(input_space, output_space) | |
compose(outer) | Post-compose: self maps I->O, outer maps O->C, result maps I->C. |
left_multiply(matrix) | Multiply on the left by an explicit matrix. |
pre_compose(inner) | Pre-compose: inner maps A->I, self maps I->O, result maps A->O. |
projected_output(output_indices, vector) | Compute a projection of the map applied to a vector. |
rows(output_indices) | Construct the sub-matrix whose rows are the given output indices. |
Attributes
Column 1 | Column 2 |
|---|---|
input_space | The input space. |
output_space | The output space. |
input_space
Type: IndexedSpace[InputIndex]
The input space.
output_space
Type: IndexedSpace[OutputIndex]
The output space.
rows
abstractmethod rows(output_indices: Iterable[OutputIndex]) → IndexedMatrix[OutputIndex, InputIndex]
Construct the sub-matrix whose rows are the given output indices.
Parameters
output_indices – The labels for the desired rows of the matrix.
Returns
left_multiply
left_multiply(matrix: IndexedMatrix[RowLabel, OutputIndex]) → IndexedMatrix[RowLabel, InputIndex]
Multiply on the left by an explicit matrix.
Parameters
matrix – A matrix whose column indices are output indices of this map.
Returns
The resulting matrix.
projected_output
projected_output(output_indices: Iterable[OutputIndex], vector: Mapping[InputIndex, float]) → IndexedVector[OutputIndex]
Compute a projection of the map applied to a vector.
The projection is defined by an iterable of output indices: only the component of the vector on those output indices will be returned.
Parameters
- output_indices – The output indices defining the projection.
- vector – A mapping from input indices to floats.
Returns
The projected output vector.
Raises
KeyError – If an input index appearing in the rows is not present in vector.
compose
compose(outer: LinearMap[OutputIndex, OtherOutput]) → ComposedLinearMap[InputIndex, OtherOutput]
Post-compose: self maps I->O, outer maps O->C, result maps I->C.
pre_compose
pre_compose(inner: LinearMap[OtherInput, InputIndex]) → ComposedLinearMap[OtherInput, OutputIndex]
Pre-compose: inner maps A->I, self maps I->O, result maps A->O.