[][src]Struct rust_blas::math::bandmat::BandMat

pub struct BandMat<T> { /* fields omitted */ }

Banded Matrix A banded matrix is a matrix where only the diagonal, a number of super-diagonals and a number of sub-diagonals are non-zero. https://en.wikipedia.org/wiki/Band_matrix

Implementations

impl<T> BandMat<T>[src]

pub fn new(n: usize, m: usize, sub: u32, sup: u32) -> BandMat<T>[src]

pub fn rows(&self) -> usize[src]

pub fn cols(&self) -> usize[src]

pub unsafe fn set_rows(&mut self, n: usize)[src]

Set Rows Manually

Safety

No guarantees are made about rows x columns being equivalent to data length after this operation

pub unsafe fn set_cols(&mut self, n: usize)[src]

Set Columns Manually

Safety

No guarantees are made about rows x columns being equivalent to data length after this operation

pub unsafe fn set_sub_diagonals(&mut self, n: u32)[src]

pub unsafe fn set_sup_diagonals(&mut self, n: u32)[src]

pub unsafe fn push(&mut self, val: T)[src]

impl<T: Copy> BandMat<T>[src]

pub fn from_matrix(
    mat: Mat<T>,
    sub_diagonals: u32,
    sup_diagonals: u32
) -> BandMat<T>
[src]

Converts a Mat into a BandMat.

The idea is to compress the the band matrix by compressing it to a form that is as legible as possible but without many of the extraneous zeros. You can read more about the process here: Wikipedia and Official BLAS Docs, but the best demonstration is probably by example.

Say you have a matrix:

let m =
[
  0.5, 2.0, 0.0, 0.0,
  1.0, 0.5, 2.0, 0.0,
  0.0, 1.0, 0.5, 2.0,
  0.0, 0.0, 1.0, 0.5,
];

This method will transform it into:

let x = 0.0;
let m =
[
  x,   0.5, 2.0,
  1.0, 0.5, 2.0,
  1.0, 0.5, 2.0,
  1.0, 0.5,   x,
];

The x's represent the values that will not be read by the blas operation, and therefore can remain unchanged. Notice that the dimensions of the new matrix are (rows, LDA), where LDA = <sub diagonals> + <sup diagonals> + 1. This matrix will be stored in the original memory of the matrix that is consumed by this method.

For details about how the conversion actually happens, consult the code comments.

Panics

Panics if the size of the vector representing the input matrix is too small, that is rows * LDA > rows * cols. In this case there is not enough space to perform a safe conversion to the Band Storage format.

impl<T: Copy + Default> BandMat<T>[src]

pub fn to_matrix(bandmat: Self) -> Mat<T>[src]

Converts a BandMat back into a Mat.

This method creates a Mat instance by reversing the steps from the from_matrix method. It will also fill in all the values that are "zero" to the default value of T.

For more information about the implementation, please consult the code comments.

Panics

Panics if the values of rows * cols doesn't correspond to the length of the data vector.

impl<T: Clone> BandMat<T>[src]

pub fn fill(value: T, n: usize, m: usize) -> BandMat<T>[src]

Trait Implementations

impl<T> BandMatrix<T> for BandMat<T>[src]

impl<T: Debug> Debug for BandMat<T>[src]

impl<T: Display> Display for BandMat<T>[src]

impl<'a, T> From<&'a (dyn BandMatrix<T> + 'a)> for BandMat<T> where
    T: Copy
[src]

impl<T> Index<usize> for BandMat<T>[src]

type Output = [T]

The returned type after indexing.

impl<T> Matrix<T> for BandMat<T>[src]

impl<T: PartialEq> PartialEq<BandMat<T>> for BandMat<T>[src]

impl<T> StructuralPartialEq for BandMat<T>[src]

Auto Trait Implementations

impl<T> RefUnwindSafe for BandMat<T> where
    T: RefUnwindSafe

impl<T> Send for BandMat<T> where
    T: Send

impl<T> Sync for BandMat<T> where
    T: Sync

impl<T> Unpin for BandMat<T> where
    T: Unpin

impl<T> UnwindSafe for BandMat<T> where
    T: UnwindSafe

Blanket Implementations

impl<T> Any for T where
    T: 'static + ?Sized
[src]

impl<T> Borrow<T> for T where
    T: ?Sized
[src]

impl<T> BorrowMut<T> for T where
    T: ?Sized
[src]

impl<T> From<T> for T[src]

impl<T, U> Into<U> for T where
    U: From<T>, 
[src]

impl<T> ToString for T where
    T: Display + ?Sized
[src]

impl<T, U> TryFrom<U> for T where
    U: Into<T>, 
[src]

type Error = Infallible

The type returned in the event of a conversion error.

impl<T, U> TryInto<U> for T where
    U: TryFrom<T>, 
[src]

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

The type returned in the event of a conversion error.