pub struct Operator { /* private fields */ }Expand description
Concrete operator returned by universal assembly.
Implementations§
Source§impl Operator
impl Operator
Sourcepub fn from_dense(
rows: usize,
columns: usize,
values_row_major: Vec<Complex64>,
) -> Result<Self>
pub fn from_dense( rows: usize, columns: usize, values_row_major: Vec<Complex64>, ) -> Result<Self>
Construct a row-major dense rectangular operator.
Sourcepub fn from_triplets(
rows: usize,
columns: usize,
triplets: impl IntoIterator<Item = (usize, usize, Complex64)>,
format: MatrixFormat,
) -> Result<Self>
pub fn from_triplets( rows: usize, columns: usize, triplets: impl IntoIterator<Item = (usize, usize, Complex64)>, format: MatrixFormat, ) -> Result<Self>
Construct an operator from zero-based (row, column, value) entries.
Duplicate coordinates are summed, exact numerical zeros are discarded,
and the result is canonicalized for format.
Sourcepub fn to_dense(&self) -> Vec<Complex64> ⓘ
pub fn to_dense(&self) -> Vec<Complex64> ⓘ
Materialize a row-major dense copy of this operator.
Sourcepub fn conjugated(&self) -> Result<Self>
pub fn conjugated(&self) -> Result<Self>
Return an elementwise complex-conjugated operator.
Sourcepub fn right_apply(&self, input: &[Complex64]) -> Result<Vec<Complex64>>
pub fn right_apply(&self, input: &[Complex64]) -> Result<Vec<Complex64>>
Row-vector action inputᵀ A without conjugating the input.
Sourcepub fn memory_bytes(&self) -> usize
pub fn memory_bytes(&self) -> usize
Estimate bytes owned by the current materialized representation.
Sourcepub fn triplets(&self) -> Vec<(usize, usize, Complex64)>
pub fn triplets(&self) -> Vec<(usize, usize, Complex64)>
Canonical nonzero (row, column, value) entries without dense materialization.
Sourcepub fn converted(&self, format: MatrixFormat) -> Result<Self>
pub fn converted(&self, format: MatrixFormat) -> Result<Self>
Convert the operator without changing its numerical values.
pub fn diagonal(&self) -> Vec<Complex64> ⓘ
pub fn trace(&self) -> Result<Complex64>
pub fn scaled(&self, coefficient: impl Into<Complex64>) -> Result<Self>
pub fn add(&self, right: &Self) -> Result<Self>
pub fn subtract(&self, right: &Self) -> Result<Self>
Sourcepub fn projected_by(&self, projector: &Self) -> Result<Self>
pub fn projected_by(&self, projector: &Self) -> Result<Self>
Project a square operator into the column space of projector.
For a projector-like rectangular matrix P with shape (N, M), this
returns P† self P with shape (M, M). The operation intentionally
accepts any rectangular linear map; callers that require an isometry
may validate P†P = I separately.
pub fn pow(&self, exponent: u32) -> Result<Self>
pub fn adjoint(&self) -> Result<Self>
pub fn transpose(&self) -> Result<Self>
Sourcepub fn rotated(&self, unitary: &Self, tolerance: f64) -> Result<Self>
pub fn rotated(&self, unitary: &Self, tolerance: f64) -> Result<Self>
Similarity rotation U† A U after validating unitarity.
pub fn is_hermitian(&self, tolerance: f64) -> bool
Trait Implementations§
Source§impl LinearOperator for Operator
impl LinearOperator for Operator
Source§fn format(&self) -> MatrixFormat
fn format(&self) -> MatrixFormat
Source§fn apply_real(&self, input: &[f64], output: &mut [f64]) -> Result<()>
fn apply_real(&self, input: &[f64], output: &mut [f64]) -> Result<()>
Source§fn apply(&self, input: &[Complex64], output: &mut [Complex64]) -> Result<()>
fn apply(&self, input: &[Complex64], output: &mut [Complex64]) -> Result<()>
output = A * input. Read moreSource§fn stored_triplets(&self) -> Result<Option<Vec<(usize, usize, Complex64)>>>
fn stored_triplets(&self) -> Result<Option<Vec<(usize, usize, Complex64)>>>
Source§fn shifted_solver(
&self,
shift: f64,
) -> Result<Option<Box<dyn ShiftedLinearSolver>>>
fn shifted_solver( &self, shift: f64, ) -> Result<Option<Box<dyn ShiftedLinearSolver>>>
(A - shift I) x = b, when supported.Auto Trait Implementations§
impl Freeze for Operator
impl RefUnwindSafe for Operator
impl Send for Operator
impl Sync for Operator
impl Unpin for Operator
impl UnsafeUnpin for Operator
impl UnwindSafe for Operator
Blanket Implementations§
Source§impl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
Source§fn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Source§impl<T> CloneToUninit for Twhere
T: Clone,
impl<T> CloneToUninit for Twhere
T: Clone,
Source§impl<O> RuntimeAdjointLinearOperator<CpuRuntime> for Owhere
O: LinearOperator + ?Sized,
impl<O> RuntimeAdjointLinearOperator<CpuRuntime> for Owhere
O: LinearOperator + ?Sized,
Source§fn apply_adjoint_on(
&self,
_runtime: &CpuRuntime,
input: &CpuBuffer,
output: &mut CpuBuffer,
) -> Result<(), QmbedError>
fn apply_adjoint_on( &self, _runtime: &CpuRuntime, input: &CpuBuffer, output: &mut CpuBuffer, ) -> Result<(), QmbedError>
output = A† * input in runtime-owned storage.Source§impl<O> RuntimeLinearOperator<CpuRuntime> for Owhere
O: LinearOperator + ?Sized,
impl<O> RuntimeLinearOperator<CpuRuntime> for Owhere
O: LinearOperator + ?Sized,
Source§fn runtime_shape(&self) -> (usize, usize)
fn runtime_shape(&self) -> (usize, usize)
(rows, columns) in runtime coordinates.Source§fn apply_on(
&self,
_runtime: &CpuRuntime,
input: &CpuBuffer,
output: &mut CpuBuffer,
) -> Result<(), QmbedError>
fn apply_on( &self, _runtime: &CpuRuntime, input: &CpuBuffer, output: &mut CpuBuffer, ) -> Result<(), QmbedError>
§impl<SS, SP> SupersetOf<SS> for SPwhere
SS: SubsetOf<SP>,
impl<SS, SP> SupersetOf<SS> for SPwhere
SS: SubsetOf<SP>,
§fn to_subset(&self) -> Option<SS>
fn to_subset(&self) -> Option<SS>
self from the equivalent element of its
superset. Read more§fn is_in_subset(&self) -> bool
fn is_in_subset(&self) -> bool
self is actually part of its subset T (and can be converted to it).§fn to_subset_unchecked(&self) -> SS
fn to_subset_unchecked(&self) -> SS
self.to_subset but without any property checks. Always succeeds.§fn from_subset(element: &SS) -> SP
fn from_subset(element: &SS) -> SP
self to the equivalent element of its superset.