<html><head><meta http-equiv="Content-Type" content="text/html; charset=utf-8"></head><body style="word-wrap: break-word; -webkit-nbsp-mode: space; line-break: after-white-space;" class="">Hello,<div class="">Given a Mat A, I’d like to know if there is an implementation available for doing C=A*B</div><div class="">I was previously using MatHasOperation(A, MATOP_MATMAT_MULT, &hasMatMatMult) but the result is not correct in at least two cases:</div><div class="">1) A is a MATTRANSPOSE and the underlying Mat B=A^T has a MatTransposeMatMult implementation (there is currently no MATOP_MATTRANSPOSEMAT_MULT)</div><div class="">2) A is a MATNEST. This could be fixed in MatHasOperation_Nest, by checking MATOP_MATMAT_MULT of all matrices in the MATNEST, but this would be incorrect again if there is a single MATTRANPOSE in there</div><div class="">What is then the proper way to check that I can indeed call MatMatMult(A,…)?</div><div class="">Do I need to copy/paste all this <a href="https://www.mcs.anl.gov/petsc/petsc-current/src/mat/interface/matrix.c.html#line9801" class="">https://www.mcs.anl.gov/petsc/petsc-current/src/mat/interface/matrix.c.html#line9801</a> in user code?</div><div class=""><br class=""></div><div class="">Thanks,</div><div class="">Pierre</div><div class=""><br class=""></div><div class="">PS: in my case, C and B are always of type MATDENSE. Should we handle this in MatMatMult and never error out for such a simple case. Indeed, one can just loop on the columns of B and C by doing multiple MatMult. This is what I’m currently doing in user code when hasMatMatMult == PETSC_FALSE.</div></body></html>