use crate::convert::serial::*; use crate::coo::CooMatrix; use crate::csc::CscMatrix; use crate::csr::CsrMatrix; use nalgebra::storage::RawStorage; use nalgebra::{ClosedAdd, DMatrix, Dim, Matrix, Scalar}; use num_traits::Zero; impl<'a, T, R, C, S> From<&'a Matrix> for CooMatrix where T: Scalar + Zero, R: Dim, C: Dim, S: RawStorage, { fn from(matrix: &'a Matrix) -> Self { convert_dense_coo(matrix) } } impl<'a, T> From<&'a CooMatrix> for DMatrix where T: Scalar + Zero + ClosedAdd, { fn from(coo: &'a CooMatrix) -> Self { convert_coo_dense(coo) } } impl<'a, T> From<&'a CooMatrix> for CsrMatrix where T: Scalar + Zero + ClosedAdd, { fn from(matrix: &'a CooMatrix) -> Self { convert_coo_csr(matrix) } } impl<'a, T> From<&'a CsrMatrix> for CooMatrix where T: Scalar + Zero + ClosedAdd, { fn from(matrix: &'a CsrMatrix) -> Self { convert_csr_coo(matrix) } } impl<'a, T, R, C, S> From<&'a Matrix> for CsrMatrix where T: Scalar + Zero, R: Dim, C: Dim, S: RawStorage, { fn from(matrix: &'a Matrix) -> Self { convert_dense_csr(matrix) } } impl<'a, T> From<&'a CsrMatrix> for DMatrix where T: Scalar + Zero + ClosedAdd, { fn from(matrix: &'a CsrMatrix) -> Self { convert_csr_dense(matrix) } } impl<'a, T> From<&'a CooMatrix> for CscMatrix where T: Scalar + Zero + ClosedAdd, { fn from(matrix: &'a CooMatrix) -> Self { convert_coo_csc(matrix) } } impl<'a, T> From<&'a CscMatrix> for CooMatrix where T: Scalar + Zero, { fn from(matrix: &'a CscMatrix) -> Self { convert_csc_coo(matrix) } } impl<'a, T, R, C, S> From<&'a Matrix> for CscMatrix where T: Scalar + Zero, R: Dim, C: Dim, S: RawStorage, { fn from(matrix: &'a Matrix) -> Self { convert_dense_csc(matrix) } } impl<'a, T> From<&'a CscMatrix> for DMatrix where T: Scalar + Zero + ClosedAdd, { fn from(matrix: &'a CscMatrix) -> Self { convert_csc_dense(matrix) } } impl<'a, T> From<&'a CscMatrix> for CsrMatrix where T: Scalar, { fn from(matrix: &'a CscMatrix) -> Self { convert_csc_csr(matrix) } } impl<'a, T> From<&'a CsrMatrix> for CscMatrix where T: Scalar, { fn from(matrix: &'a CsrMatrix) -> Self { convert_csr_csc(matrix) } }