Thread Previous • Date Previous • Date Next • Thread Next |
On Thu, Sep 18, 2008 at 8:21 AM, Johan Hake <hake@xxxxxxxxx> wrote: > On Thursday 18 September 2008 03:21:23 Ostien, Jakob T wrote: >> Hi, >> >> I got myself confused with the down_cast functionality. Say I assemble >> three bilinear forms into Matrix A, B, and C, and then consider the >> expression: >> >> K = A - A (B^-1) C >> >> (which I actually want to do, go figure). I like the uBLAS backend so I >> would like to try >> >> A.mat() - ublas::prod( A.mat(), ublas::prod( B.invert(), C.mat() ) ) >> >> But when I try and down_cast from dolfin::Matrix to uBLASMatrix with >> >> uBLASDenseMatrix AA = A.down_cast<uBLASDenseMatrix>(); > > Hello! > > Did you mean: > > dolfin::uBLASMatrix AA = A.down_cast<dolfin::uBLASMatrix>() > > Otherwise you should try that! :) > > Johan > >> I get a message that down_cast doesn't live in the Matrix class (even >> though its in the GenericTensor class). >> >> So I ask, what is the intended usage to get a uBLASMatrix from a Matrix? >> >> Thanks, >> Jake >> >> >> _______________________________________________ >> DOLFIN-dev mailing list >> DOLFIN-dev@xxxxxxxxxx >> http://www.fenics.org/mailman/listinfo/dolfin-dev > > > _______________________________________________ > DOLFIN-dev mailing list > DOLFIN-dev@xxxxxxxxxx > http://www.fenics.org/mailman/listinfo/dolfin-dev > I tried: Matrix A; uBLASMatrix<ublas_sparse_matrix> mat; mat = A.down_cast< uBLASMatrix<ublas_sparse_matrix> >(); And it worked but once I changed sparse to dense the dynamic_cast died. My guess would be because the ublas matrix starts off its life as a sparse matrix ublas doesn't allow some change in the format. You might try just starting out with the matrix type you want first. -- Andy
Thread Previous • Date Previous • Date Next • Thread Next |