Skip to main content

Operator

Struct Operator 

Source
pub struct Operator { /* private fields */ }
Expand description

Concrete operator returned by universal assembly.

Implementations§

Source§

impl Operator

Source

pub fn from_dense( rows: usize, columns: usize, values_row_major: Vec<Complex64>, ) -> Result<Self>

Construct a row-major dense rectangular operator.

Source

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.

Source

pub fn to_dense(&self) -> Vec<Complex64>

Materialize a row-major dense copy of this operator.

Source

pub fn conjugated(&self) -> Result<Self>

Return an elementwise complex-conjugated operator.

Source

pub fn right_apply(&self, input: &[Complex64]) -> Result<Vec<Complex64>>

Row-vector action inputᵀ A without conjugating the input.

Source

pub fn memory_bytes(&self) -> usize

Estimate bytes owned by the current materialized representation.

Source

pub fn nnz(&self) -> usize

Count stored mathematical nonzeros.

Source

pub fn triplets(&self) -> Vec<(usize, usize, Complex64)>

Canonical nonzero (row, column, value) entries without dense materialization.

Source

pub fn converted(&self, format: MatrixFormat) -> Result<Self>

Convert the operator without changing its numerical values.

Source

pub fn diagonal(&self) -> Vec<Complex64>

Source

pub fn trace(&self) -> Result<Complex64>

Source

pub fn scaled(&self, coefficient: impl Into<Complex64>) -> Result<Self>

Source

pub fn add(&self, right: &Self) -> Result<Self>

Source

pub fn subtract(&self, right: &Self) -> Result<Self>

Source

pub fn product(&self, right: &Self) -> Result<Self>

Matrix product self * right.

Source

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.

Source

pub fn pow(&self, exponent: u32) -> Result<Self>

Source

pub fn adjoint(&self) -> Result<Self>

Source

pub fn transpose(&self) -> Result<Self>

Source

pub fn rotated(&self, unitary: &Self, tolerance: f64) -> Result<Self>

Similarity rotation U† A U after validating unitarity.

Source

pub fn is_hermitian(&self, tolerance: f64) -> bool

Trait Implementations§

Source§

impl Clone for Operator

Source§

fn clone(&self) -> Operator

Returns a duplicate of the value. Read more
1.0.0 (const: unstable) · Source§

fn clone_from(&mut self, source: &Self)

Performs copy-assignment from source. Read more
Source§

impl Debug for Operator

Source§

fn fmt(&self, f: &mut Formatter<'_>) -> Result

Formats the value using the given formatter. Read more
Source§

impl LinearOperator for Operator

Source§

fn shape(&self) -> (usize, usize)

Return (rows, columns).
Source§

fn format(&self) -> MatrixFormat

Report the public materialization format.
Source§

fn is_real(&self) -> bool

Whether this operator preserves real vectors exactly. Read more
Source§

fn apply_real(&self, input: &[f64], output: &mut [f64]) -> Result<()>

Apply this operator to a real vector. Read more
Source§

fn apply(&self, input: &[Complex64], output: &mut [Complex64]) -> Result<()>

Compute output = A * input. Read more
Source§

fn stored_triplets(&self) -> Result<Option<Vec<(usize, usize, Complex64)>>>

Return canonical stored nonzeros when the representation already owns them.
Source§

fn shifted_solver( &self, shift: f64, ) -> Result<Option<Box<dyn ShiftedLinearSolver>>>

Prepare a reusable solver for (A - shift I) x = b, when supported.
Source§

fn apply_transpose( &self, input: &[Complex64], output: &mut [Complex64], ) -> Result<()>

Apply the algebraic transpose without conjugating either operand. Read more
Source§

fn apply_adjoint( &self, input: &[Complex64], output: &mut [Complex64], ) -> Result<()>

Apply the conjugate transpose.

Auto Trait Implementations§

Blanket Implementations§

Source§

impl<T> Any for T
where T: 'static + ?Sized,

Source§

fn type_id(&self) -> TypeId

Gets the TypeId of self. Read more
Source§

impl<T> Borrow<T> for T
where T: ?Sized,

Source§

fn borrow(&self) -> &T

Immutably borrows from an owned value. Read more
Source§

impl<T> BorrowMut<T> for T
where T: ?Sized,

Source§

fn borrow_mut(&mut self) -> &mut T

Mutably borrows from an owned value. Read more
§

impl<T> ByRef<T> for T

§

fn by_ref(&self) -> &T

Source§

impl<T> CloneToUninit for T
where T: Clone,

Source§

unsafe fn clone_to_uninit(&self, dest: *mut u8)

🔬This is a nightly-only experimental API. (clone_to_uninit)
Performs copy-assignment from self to dest. Read more
Source§

impl<T> From<T> for T

Source§

fn from(t: T) -> T

Returns the argument unchanged.

Source§

impl<T, U> Into<U> for T
where U: From<T>,

Source§

fn into(self) -> U

Calls U::from(self).

That is, this conversion is whatever the implementation of From<T> for U chooses to do.

Source§

impl<O> RuntimeAdjointLinearOperator<CpuRuntime> for O
where O: LinearOperator + ?Sized,

Source§

fn apply_adjoint_on( &self, _runtime: &CpuRuntime, input: &CpuBuffer, output: &mut CpuBuffer, ) -> Result<(), QmbedError>

Compute output = A† * input in runtime-owned storage.
Source§

impl<O> RuntimeLinearOperator<CpuRuntime> for O
where O: LinearOperator + ?Sized,

Source§

fn runtime_shape(&self) -> (usize, usize)

Return (rows, columns) in runtime coordinates.
Source§

fn apply_on( &self, _runtime: &CpuRuntime, input: &CpuBuffer, output: &mut CpuBuffer, ) -> Result<(), QmbedError>

Apply this map to backend-owned buffers.
Source§

impl<T> Same for T

Source§

type Output = T

Should always be Self
§

impl<SS, SP> SupersetOf<SS> for SP
where SS: SubsetOf<SP>,

§

fn to_subset(&self) -> Option<SS>

The inverse inclusion map: attempts to construct self from the equivalent element of its superset. Read more
§

fn is_in_subset(&self) -> bool

Checks if self is actually part of its subset T (and can be converted to it).
§

fn to_subset_unchecked(&self) -> SS

Use with care! Same as self.to_subset but without any property checks. Always succeeds.
§

fn from_subset(element: &SS) -> SP

The inclusion map: converts self to the equivalent element of its superset.
Source§

impl<T> ToOwned for T
where T: Clone,

Source§

type Owned = T

The resulting type after obtaining ownership.
Source§

fn to_owned(&self) -> T

Creates owned data from borrowed data, usually by cloning. Read more
Source§

fn clone_into(&self, target: &mut T)

Uses borrowed data to replace owned data, usually by cloning. Read more
Source§

impl<T, U> TryFrom<U> for T
where U: Into<T>,

Source§

type Error = Infallible

The type returned in the event of a conversion error.
Source§

fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>

Performs the conversion.
Source§

impl<T, U> TryInto<U> for T
where U: TryFrom<T>,

Source§

type Error = <U as TryFrom<T>>::Error

The type returned in the event of a conversion error.
Source§

fn try_into(self) -> Result<U, <U as TryFrom<T>>::Error>

Performs the conversion.
§

impl<T, U> Imply<T> for U
where T: ?Sized, U: ?Sized,