Function sprs::sparse::construct::bmat [] [src]

pub fn bmat<'a, N, OuterArray, InnerArray>(mats: &OuterArray) -> Result<CsMatOwned<N>, SprsError> where N: 'a + Copy + Default, OuterArray: 'a + AsRef<[InnerArray]>, InnerArray: 'a + AsRef<[Option<CsMatView<'a, N>>]>

Specify a sparse matrix by constructing it from blocks of other matrices

Examples

use sprs::sparse::CompressedStorage::CSR;
use sprs::CsMatOwned;
let a = CsMatOwned::<f64>::eye(CSR, 3);
let b = CsMatOwned::<f64>::eye(CSR, 4);
let c = sprs::bmat(&[[Some(a.borrowed()), None],
                     [None, Some(b.borrowed())]]).unwrap();
assert_eq!(c.rows(), 7);