Skip to content

lazymatrix::Transpose ​

LazyMatrix for Rust · 0.9.0

Source

rust
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.

rust
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)
}
rust
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));
}
rust
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 ​

Source

rust
impl<'a, M: ?Sized> Transpose<'a, M>

as_inner ​

rust
pub const fn as_inner(&self) -> &'a M

Source

Borrow the original operator, including any fitted normalization.

new ​

rust
pub const fn new(operator: &'a M) -> Self

Source

Borrow an operator as its transpose without reading or copying it.

Implementation of Clone ​

Source

rust
impl<M: ?Sized> Clone for Transpose<'_, M>

clone ​

rust
fn clone(&self) -> Self

Source

Implementation of Copy ​

Source

rust
impl<M: ?Sized> Copy for Transpose<'_, M>

Implementation of Debug ​

Source

rust
impl<'a, M: core::fmt::Debug + ?Sized> Debug for Transpose<'a, M>

fmt ​

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

Source

Implementation of MatMatInto ​

Source

rust
impl<M: MatTransposeMatInto<F> + ?Sized, F: Scalar> MatMatInto<F> for Transpose<'_, M>

matmat_into ​

rust
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> + ?Sized

Source

Implementation of MatTransposeMatInto ​

Source

rust
impl<M: MatMatInto<F> + ?Sized, F: Scalar> MatTransposeMatInto<F> for Transpose<'_, M>

mat_transpose_mat_into ​

rust
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> + ?Sized

Source

Implementation of MatTransposeVec ​

Source

rust
impl<M: MatVec<V> + ?Sized, V> MatTransposeVec<V> for Transpose<'_, M>

mat_transpose_vec ​

rust
fn mat_transpose_vec(
    &self,
    x: &V
) -> Result<V, <Self as MatrixErrorType>::Error>

Source

Implementation of MatTransposeVecInto ​

Source

rust
impl<M: MatVecInto<X, Y> + ?Sized, X, Y> MatTransposeVecInto<X, Y> for Transpose<'_, M>

mat_transpose_vec_into ​

rust
fn mat_transpose_vec_into(
    &self,
    x: &X,
    out: &mut Y
) -> Result<(), <Self as MatrixErrorType>::Error>

Source

Implementation of MatTransposeVecScaledInto ​

Source

rust
impl<M: MatVecScaledInto<X, Y, F> + ?Sized, X, Y, F> MatTransposeVecScaledInto<X, Y, F> for Transpose<'_, M>

mat_transpose_vec_scaled_into ​

rust
fn mat_transpose_vec_scaled_into(
    &self,
    alpha: F,
    x: &X,
    beta: F,
    out: &mut Y
) -> Result<(), <Self as MatrixErrorType>::Error>

Source

Implementation of MatVec ​

Source

rust
impl<M: MatTransposeVec<V> + ?Sized, V> MatVec<V> for Transpose<'_, M>

matvec ​

rust
fn matvec(&self, x: &V) -> Result<V, <Self as MatrixErrorType>::Error>

Source

Implementation of MatVecInto ​

Source

rust
impl<M: MatTransposeVecInto<X, Y> + ?Sized, X, Y> MatVecInto<X, Y> for Transpose<'_, M>

matvec_into ​

rust
fn matvec_into(
    &self,
    x: &X,
    out: &mut Y
) -> Result<(), <Self as MatrixErrorType>::Error>

Source

Implementation of MatVecScaledInto ​

Source

rust
impl<M: MatTransposeVecScaledInto<X, Y, F> + ?Sized, X, Y, F> MatVecScaledInto<X, Y, F> for Transpose<'_, M>

matvec_scaled_into ​

rust
fn matvec_scaled_into(
    &self,
    alpha: F,
    x: &X,
    beta: F,
    out: &mut Y
) -> Result<(), <Self as MatrixErrorType>::Error>

Source

Implementation of MatrixErrorType ​

Source

rust
impl<M: MatrixErrorType + ?Sized> MatrixErrorType for Transpose<'_, M>

Error ​

rust
type Error = <M as MatrixErrorType>::Error;

Source

Implementation of MatrixShape ​

Source

rust
impl<M: MatrixShape + ?Sized> MatrixShape for Transpose<'_, M>

ncols ​

rust
fn ncols(&self) -> usize

Source

nrows ​

rust
fn nrows(&self) -> usize

Source

Implementation of Freeze ​

rust
impl<'a, M> Freeze for Transpose<'a, M> where &'a M: Freeze, M: ?Sized

Implementation of RefUnwindSafe ​

rust
impl<'a, M> RefUnwindSafe for Transpose<'a, M> where &'a M: RefUnwindSafe, M: ?Sized

Implementation of Send ​

rust
impl<'a, M> Send for Transpose<'a, M> where &'a M: Send, M: ?Sized

Implementation of Sync ​

rust
impl<'a, M> Sync for Transpose<'a, M> where &'a M: Sync, M: ?Sized

Implementation of Unpin ​

rust
impl<'a, M> Unpin for Transpose<'a, M> where &'a M: Unpin, M: ?Sized

Implementation of UnsafeUnpin ​

rust
impl<'a, M> UnsafeUnpin for Transpose<'a, M> where &'a M: UnsafeUnpin, M: ?Sized

Implementation of UnwindSafe ​

rust
impl<'a, M> UnwindSafe for Transpose<'a, M> where &'a M: UnwindSafe, M: ?Sized

Implementation of Any ​

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

Implementation of Borrow ​

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

Implementation of BorrowMut ​

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

Implementation of ByRef ​

rust
impl<T> ByRef<T> for T

Implementation of CastableFrom ​

rust
impl<ST, DT> CastableFrom<ST, Initialized, Initialized> for DT where ST: ?Sized, DT: ?Sized

Implementation of CastableFrom ​

rust
impl<ST, DT> CastableFrom<ST, Uninit, Uninit> for DT where ST: ?Sized, DT: ?Sized

Implementation of CloneToUninit ​

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

Implementation of From ​

rust
impl<T> From<T> for T

Implementation of Imply ​

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

Implementation of Into ​

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

Implementation of IntoEither ​

rust
impl<T> IntoEither for T

Implementation of MatMat ​

Source

rust
impl<M, F> MatMat<F> for M where M: MatMatInto<F> + ?Sized, F: Scalar

Implementation of MatTransposeMat ​

Source

rust
impl<M, F> MatTransposeMat<F> for M where M: MatTransposeMatInto<F> + ?Sized, F: Scalar

Implementation of Pointable ​

rust
impl<T> Pointable for T

Implementation of Read ​

rust
impl<T> Read<Exclusive, BecauseExclusive> for T where T: ?Sized

Implementation of Same ​

rust
impl<T> Same for T

Implementation of SupersetOf ​

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

Implementation of ToOwned ​

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

Implementation of TryFrom ​

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

Implementation of TryInto ​

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

Released under the MIT and Apache 2.0 licenses.