Hi,<br><br>I'm using (from error log) "Petsc Development HG revision: 0216b5820377f721a70342e04a44fa54f3883ec9 HG Date: Sun Oct 30 23:58:53 2011 -0500 "<br><br>I had some problems using MatMatMultTranspose for SeqAIJ matrices. It seems to me that MatMatMultTranspose(A,B,...,MAT_INITIAL_MATRIX,&C), which should perform C=A^T*B according to the web pages, doesn't its job. The pseudo-code listed below prints<br>
<br>sizes A_II 64 64<br>sizes phi D 64 30<br>check sizes TM1 30 30<br>check sizes TM2 64 64<br>check sizes TM3 64 64<br>
check sizes AUXMAT2 64 30<br><br>From the code below, either TM2 and TM3 sizes are wrong. They should be both 30 30. It seems that it flips matrices dimensions in creating the output of MatMatMultTranspose.<br>An inspection of matrix values give me no further insights.<br>
<br>--------------------------------------------------------------------------------------------------------------------<br><br> Mat TM1,TM2,TM3,AUXMAT2;<br> Mat coarse_phi_D;<br> <br> .....all matrices involved are Seq_AIJ matrices.............<br>
<br> ierr = MatGetSize(pcis->A_II,&rows,&columns);<br> printf("sizes A_II %d %d\n",rows,columns);<br> ierr = MatGetSize(coarse_phi_D,&rows,&columns);<br> printf("sizes phi D %d %d\n",rows,columns);<br>
<br> ierr = MatPtAP(pcis->A_II,coarse_phi_D,MAT_INITIAL_MATRIX,1.0,&TM1); //TM1=PHI^T*A_II*PHI OK!<br> ierr = MatMatMult(pcis->A_II,coarse_phi_D,MAT_INITIAL_MATRIX,1.0,&AUXMAT2); //AUXMAT2=A_II*PHI OK!<br>
ierr = MatMatMultTranspose(coarse_phi_D,AUXMAT2,MAT_INITIAL_MATRIX,1.0,&TM2); //TM2=PHI^T*AUXMAT2 WRONG!<br> ierr = MatMatMultTranspose(AUXMAT2,coarse_phi_D,MAT_INITIAL_MATRIX,1.0,&TM3); //TM3=AUXMAT2^T*PHI WRONG!<br>
<br> ierr = MatGetSize(TM1,&rows,&columns);<br> printf("check sizes TM1 %d %d\n",rows,columns);<br> ierr = MatGetSize(TM2,&rows,&columns);<br> printf("check sizes TM2 %d %d\n",rows,columns);<br>
ierr = MatGetSize(TM3,&rows,&columns);<br>
printf("check sizes TM3 %d %d\n",rows,columns);<br>
ierr = MatGetSize(AUXMAT2,&rows,&columns);<br> printf("check sizes AUXMAT2 %d %d\n",rows,columns);<br> <br clear="all">----------------------------------------------------------------------------------------------------------------------------<br>
-- <br>Stefano