Commits

BarryFSmith committed 7ec8086

MatMPIBAIJSetPreallocationCSR() handled the input matrix entries incorrectly, it treated them as if each row of values
was provided ordered by row within the block rows instead of by block as it was originally designed to be.
Also added more discussion to the manual pages on the expected order of the values

Reported by Matteo Parsani <parsani.matteo@gmail.com> and Lisandro Dalcin <dalcinl@gmail.com>

  • Participants
  • Parent commits 5154939

Comments (0)

Files changed (1)

File src/mat/impls/baij/mpi/mpibaij.c

     ierr = PetscMalloc(bs*bs*nz_max*sizeof(PetscScalar),&values);CHKERRQ(ierr);
     ierr = PetscMemzero(values,bs*bs*nz_max*sizeof(PetscScalar));CHKERRQ(ierr);
   }
+  ierr = MatSetOption(B,MAT_ROW_ORIENTED,PETSC_FALSE);CHKERRQ(ierr);
   for (i=0; i<m; i++) {
     PetscInt          row    = i + rstart;
     PetscInt          ncols  = ii[i+1] - ii[i];
 
    Level: developer
 
+   Notes: the order of the entries in values is the same as the block compressed sparse row storage format; that is, it is the same as a three dimensional array
+     in Fortran values(bs,bs,nnz) that contains the first column of the first block, followed by the second column of the first block etc etc.
+
 .keywords: matrix, aij, compressed row, sparse, parallel
 
-.seealso: MatCreate(), MatCreateSeqAIJ(), MatSetValues(), MatMPIBAIJSetPreallocation(), MatCreateAIJ(), MPIAIJ
+.seealso: MatCreate(), MatCreateSeqAIJ(), MatSetValues(), MatMPIBAIJSetPreallocation(), MatCreateAIJ(), MPIAIJ, MatCreateMPIBAIJWithArrays(), MPIBAIJ
 @*/
 PetscErrorCode  MatMPIBAIJSetPreallocationCSR(Mat B,PetscInt bs,const PetscInt i[],const PetscInt j[], const PetscScalar v[])
 {
      thus you CANNOT change the matrix entries by changing the values of a[] after you have
      called this routine. Use MatCreateMPIAIJWithSplitArrays() to avoid needing to copy the arrays.
 
+     The order of the entries in values is the same as the block compressed sparse row storage format; that is, it is the same as a three dimensional array
+     in Fortran values(bs,bs,nnz) that contains the first column of the first block, followed by the second column of the first block etc etc.
+
        The i and j indices are 0 based, and i indices are indices corresponding to the local j array.
 
 .keywords: matrix, aij, compressed row, sparse, parallel