← Back to team overview

dolfin team mailing list archive

Re: matrix-matrix multiplication

 



arizumi@xxxxxxxxxxxx wrote:
hi, I've been having a problem of calculating sparse matrix-matrix multiplication using uBLASSparseMatrix.
I declare matrices A and B as following.

Matrix A0;
uBLASSparseMatrix& A(A0.down_cast<uBLASSparseMatrix>());
Matrix B0;
uBLASSparseMatrix& B(B0.down_cast<uBLASSparseMatrix>());

After assigning matrix values, use "prod" from boost to multiply.  but, I don't know where to return.  From compiler error 'ublas_sparse_matrix' is not a member of ‘boost::numeric::ublas’.  even if I use 'matrix' as follows, I don't know how to make this into uBLASSparseMatrix.

boost::numeric::ublas::matrix<double> C;
C = boost::numeric::ublas::prod(A.mat(), B.mat()); My first guess was to declare uBLASSpareseMatrix& C1(C); but this will give a compiler error "‘uBLASSpareseMatrix’ was not declared in this scope"

I would greatly appreciate any helpful suggestion.

Try

    uBLASSpareMatrix A;
    ublas_sparse_matrix& B = A.mat();

B will be a uBLAS object (ublas_sparse_matrix is a DOLFIN typedef for the uBLAS matrix which underlies uBLASSpareMatrix).

Garth


Thank you,
Nana Arizumi
_______________________________________________
DOLFIN-dev mailing list
DOLFIN-dev@xxxxxxxxxx
http://www.fenics.org/mailman/listinfo/dolfin-dev




References