BarryFSmith avatar 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>;

Comments (0)

Files changed (1)

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
Tip: Filter by directory path e.g. /media app.js to search for public/media/app.js.
Tip: Use camelCasing e.g. ProjME to search for ProjectModifiedEvent.java.
Tip: Filter by extension type e.g. /repo .js to search for all .js files in the /repo directory.
Tip: Separate your search with spaces e.g. /ssh pom.xml to search for src/ssh/pom.xml.
Tip: Use ↑ and ↓ arrow keys to navigate and return to view the file.
Tip: You can also navigate files with Ctrl+j (next) and Ctrl+k (previous) and view the file with Ctrl+o.
Tip: You can also navigate files with Alt+j (next) and Alt+k (previous) and view the file with Alt+o.