pub trait QuantumMatrix:
Debug
+ Send
+ Sync {
// Required methods
fn dim(&self) -> usize;
fn to_dense(&self) -> Array2<Complex64>;
fn to_sparse(&self) -> QuantRS2Result<CsrMatrix<Complex64>>;
fn is_unitary(&self, tolerance: f64) -> QuantRS2Result<bool>;
fn tensor_product(
&self,
other: &dyn QuantumMatrix,
) -> QuantRS2Result<Array2<Complex64>>;
fn apply(
&self,
state: &ArrayView1<'_, Complex64>,
) -> QuantRS2Result<Array1<Complex64>>;
}
Expand description
Trait for quantum matrix operations
Required Methods§
Sourcefn to_sparse(&self) -> QuantRS2Result<CsrMatrix<Complex64>>
fn to_sparse(&self) -> QuantRS2Result<CsrMatrix<Complex64>>
Convert to sparse representation
Sourcefn is_unitary(&self, tolerance: f64) -> QuantRS2Result<bool>
fn is_unitary(&self, tolerance: f64) -> QuantRS2Result<bool>
Check if the matrix is unitary
Sourcefn tensor_product(
&self,
other: &dyn QuantumMatrix,
) -> QuantRS2Result<Array2<Complex64>>
fn tensor_product( &self, other: &dyn QuantumMatrix, ) -> QuantRS2Result<Array2<Complex64>>
Compute the tensor product with another matrix
Sourcefn apply(
&self,
state: &ArrayView1<'_, Complex64>,
) -> QuantRS2Result<Array1<Complex64>>
fn apply( &self, state: &ArrayView1<'_, Complex64>, ) -> QuantRS2Result<Array1<Complex64>>
Apply to a state vector