lazymatrix::Transpose
LazyMatrix for Rust · 0.9.0
pub struct Transpose<'a, M: ?Sized>A borrowed view of an operator's transpose.
Construction takes O(1) time, allocates nothing, and does not read the operator. Products swap forward and transpose calls on the original operator, retaining its fitted normalization, numerical behavior, error type, and workspace requirements. No transposed or normalized matrix is materialized. Allocating products still allocate their output vectors or matrices, and reusable-output products may use the original operator's internal scratch. Output may be partial after an error.
Each product capability is available independently when the original operator supports the opposite product. This includes vector, fused vector, and batched products. Transposing the view again represents the original operator.
The view exposes operator products, not storage borrowing. It does not implement crate::SparseColumns or crate::SparseRows, even when the original operator does. A storage-specific transpose may separately offer such access when its borrowed slices satisfy the corresponding contracts.
use lazymatrix::{MatVec, MatTransposeVec, Transpose};
fn apply_transpose<M, V>(operator: &M, input: &V) -> Result<V, M::Error>
where
M: MatTransposeVec<V>,
{
Transpose::new(operator).matvec(input)
}use lazymatrix::{SparseColumns, SparseRows, Transpose};
fn needs_rows<M: SparseRows<f64>>(_: &M) {}
fn transpose_columns<M: SparseColumns<f64>>(matrix: &M) {
needs_rows(&Transpose::new(matrix));
}use lazymatrix::{SparseColumns, SparseRows, Transpose};
fn needs_columns<M: SparseColumns<f64>>(_: &M) {}
fn transpose_rows<M: SparseRows<f64>>(matrix: &M) {
needs_columns(&Transpose::new(matrix));
}Inherent implementation
impl<'a, M: ?Sized> Transpose<'a, M>as_inner
pub const fn as_inner(&self) -> &'a MBorrow the original operator, including any fitted normalization.
new
pub const fn new(operator: &'a M) -> SelfBorrow an operator as its transpose without reading or copying it.
Implementation of Clone
impl<M: ?Sized> Clone for Transpose<'_, M>clone
fn clone(&self) -> SelfImplementation of Copy
impl<M: ?Sized> Copy for Transpose<'_, M>Implementation of Debug
impl<'a, M: core::fmt::Debug + ?Sized> Debug for Transpose<'a, M>fmt
fn fmt(&self, f: &mut core::fmt::Formatter<'_>) -> core::fmt::ResultImplementation of MatMatInto
impl<M: MatTransposeMatInto<F> + ?Sized, F: Scalar> MatMatInto<F> for Transpose<'_, M>matmat_into
fn matmat_into<R, O>(
&self,
rhs: &R,
out: &mut O
) -> Result<(), <Self as MatrixErrorType>::Error> where R: MatrixRead<F> + ?Sized, O: MatrixRead<F> + MatrixWrite<F> + ?SizedImplementation of MatTransposeMatInto
impl<M: MatMatInto<F> + ?Sized, F: Scalar> MatTransposeMatInto<F> for Transpose<'_, M>mat_transpose_mat_into
fn mat_transpose_mat_into<R, O>(
&self,
rhs: &R,
out: &mut O
) -> Result<(), <Self as MatrixErrorType>::Error> where R: MatrixRead<F> + ?Sized, O: MatrixRead<F> + MatrixWrite<F> + ?SizedImplementation of MatTransposeVec
impl<M: MatVec<V> + ?Sized, V> MatTransposeVec<V> for Transpose<'_, M>mat_transpose_vec
fn mat_transpose_vec(
&self,
x: &V
) -> Result<V, <Self as MatrixErrorType>::Error>Implementation of MatTransposeVecInto
impl<M: MatVecInto<X, Y> + ?Sized, X, Y> MatTransposeVecInto<X, Y> for Transpose<'_, M>mat_transpose_vec_into
fn mat_transpose_vec_into(
&self,
x: &X,
out: &mut Y
) -> Result<(), <Self as MatrixErrorType>::Error>Implementation of MatTransposeVecScaledInto
impl<M: MatVecScaledInto<X, Y, F> + ?Sized, X, Y, F> MatTransposeVecScaledInto<X, Y, F> for Transpose<'_, M>mat_transpose_vec_scaled_into
fn mat_transpose_vec_scaled_into(
&self,
alpha: F,
x: &X,
beta: F,
out: &mut Y
) -> Result<(), <Self as MatrixErrorType>::Error>Implementation of MatVec
impl<M: MatTransposeVec<V> + ?Sized, V> MatVec<V> for Transpose<'_, M>matvec
fn matvec(&self, x: &V) -> Result<V, <Self as MatrixErrorType>::Error>Implementation of MatVecInto
impl<M: MatTransposeVecInto<X, Y> + ?Sized, X, Y> MatVecInto<X, Y> for Transpose<'_, M>matvec_into
fn matvec_into(
&self,
x: &X,
out: &mut Y
) -> Result<(), <Self as MatrixErrorType>::Error>Implementation of MatVecScaledInto
impl<M: MatTransposeVecScaledInto<X, Y, F> + ?Sized, X, Y, F> MatVecScaledInto<X, Y, F> for Transpose<'_, M>matvec_scaled_into
fn matvec_scaled_into(
&self,
alpha: F,
x: &X,
beta: F,
out: &mut Y
) -> Result<(), <Self as MatrixErrorType>::Error>Implementation of MatrixErrorType
impl<M: MatrixErrorType + ?Sized> MatrixErrorType for Transpose<'_, M>Error
type Error = <M as MatrixErrorType>::Error;Implementation of MatrixShape
impl<M: MatrixShape + ?Sized> MatrixShape for Transpose<'_, M>ncols
fn ncols(&self) -> usizenrows
fn nrows(&self) -> usizeImplementation of Freeze
impl<'a, M> Freeze for Transpose<'a, M> where &'a M: Freeze, M: ?SizedImplementation of RefUnwindSafe
impl<'a, M> RefUnwindSafe for Transpose<'a, M> where &'a M: RefUnwindSafe, M: ?SizedImplementation of Send
impl<'a, M> Send for Transpose<'a, M> where &'a M: Send, M: ?SizedImplementation of Sync
impl<'a, M> Sync for Transpose<'a, M> where &'a M: Sync, M: ?SizedImplementation of Unpin
impl<'a, M> Unpin for Transpose<'a, M> where &'a M: Unpin, M: ?SizedImplementation of UnsafeUnpin
impl<'a, M> UnsafeUnpin for Transpose<'a, M> where &'a M: UnsafeUnpin, M: ?SizedImplementation of UnwindSafe
impl<'a, M> UnwindSafe for Transpose<'a, M> where &'a M: UnwindSafe, M: ?SizedImplementation of Any
impl<T> Any for T where T: 'static + ?SizedImplementation of Borrow
impl<T> Borrow<T> for T where T: ?SizedImplementation of BorrowMut
impl<T> BorrowMut<T> for T where T: ?SizedImplementation of ByRef
impl<T> ByRef<T> for TImplementation of CastableFrom
impl<ST, DT> CastableFrom<ST, Initialized, Initialized> for DT where ST: ?Sized, DT: ?SizedImplementation of CastableFrom
impl<ST, DT> CastableFrom<ST, Uninit, Uninit> for DT where ST: ?Sized, DT: ?SizedImplementation of CloneToUninit
impl<T> CloneToUninit for T where T: CloneImplementation of From
impl<T> From<T> for TImplementation of Imply
impl<T, U> Imply<T> for U where T: ?Sized, U: ?SizedImplementation of Into
impl<T, U> Into<U> for T where U: From<T>Implementation of IntoEither
impl<T> IntoEither for TImplementation of MatMat
impl<M, F> MatMat<F> for M where M: MatMatInto<F> + ?Sized, F: ScalarImplementation of MatTransposeMat
impl<M, F> MatTransposeMat<F> for M where M: MatTransposeMatInto<F> + ?Sized, F: ScalarImplementation of Pointable
impl<T> Pointable for TImplementation of Read
impl<T> Read<Exclusive, BecauseExclusive> for T where T: ?SizedImplementation of Same
impl<T> Same for TImplementation of SupersetOf
impl<SS, SP> SupersetOf<SS> for SP where SS: SubsetOf<SP>Implementation of ToOwned
impl<T> ToOwned for T where T: CloneImplementation of TryFrom
impl<T, U> TryFrom<U> for T where U: Into<T>Implementation of TryInto
impl<T, U> TryInto<U> for T where U: TryFrom<T>
