IntoView

Trait IntoView 

Source
pub trait IntoView {
    type View;

    // Required method
    fn into_view(self) -> Self::View;
}
Expand description

Trait for converting types to immutable views.

This trait provides a unified way to create efficient read-only views of various sparse matrix and vector types without allocation. Views are useful for:

  • Passing data to functions without transferring ownership
  • Creating temporary references for computation
  • Implementing generic algorithms that work with multiple matrix types

§Examples

use algebra_sparse::{CsrMatrix, traits::IntoView};
use nalgebra::DMatrix;

let dense = DMatrix::from_row_slice(2, 2, &[1.0, 2.0, 3.0, 4.0]);
let csr = CsrMatrix::from_dense(dense.as_view());

// Create view for read-only operations
let view = csr.as_view(); // or csr.into_view()
println!("Shape: {:?}", view.shape());

Required Associated Types§

Source

type View

The view type produced by this trait.

Required Methods§

Source

fn into_view(self) -> Self::View

Converts the type into an immutable view.

§Returns

An immutable view of the data

Implementors§

Source§

impl<'a, T> IntoView for &'a CsrMatrixSet<T>

Source§

impl<'a, T> IntoView for &'a CsMatrix<T>

Source§

impl<'a, T> IntoView for &'a CsrMatrix<T>
where T: Real,

Source§

impl<'a, T> IntoView for &'a DiagonalBlockMatrix<T>

Source§

impl<'a, T> IntoView for CsMatrixView<'a, T>

Source§

impl<'a, T> IntoView for CsrMatrixView<'a, T>

Source§

impl<'b, T> IntoView for &CsrMatrixView<'b, T>
where T: Copy,