Commits

Jed Brown  committed 7a2f779 Merge

Merge branch 'jose/mat-vec-fixes' into maint

* jose/mat-vec-fixes:
Correctly check input type of Mat argument in MatMPIAIJGetLocalMat
Fix Matlab viewer for parallel complex vectors

  • Participants
  • Parent commits 7e441cd, b78526a

Comments (0)

Files changed (2)

File src/mat/impls/aij/mpi/mpiaij.c

 {
   PetscErrorCode ierr;
   Mat_MPIAIJ     *mpimat=(Mat_MPIAIJ*)A->data;
-  Mat_SeqAIJ     *mat,*a=(Mat_SeqAIJ*)(mpimat->A)->data,*b=(Mat_SeqAIJ*)(mpimat->B)->data;
-  PetscInt       *ai=a->i,*aj=a->j,*bi=b->i,*bj=b->j,*cmap=mpimat->garray;
-  MatScalar      *aa=a->a,*ba=b->a,*cam;
+  Mat_SeqAIJ     *mat,*a,*b;
+  PetscInt       *ai,*aj,*bi,*bj,*cmap=mpimat->garray;
+  MatScalar      *aa,*ba,*cam;
   PetscScalar    *ca;
   PetscInt       am=A->rmap->n,i,j,k,cstart=A->cmap->rstart;
   PetscInt       *ci,*cj,col,ncols_d,ncols_o,jo;
   ierr = PetscObjectTypeCompare((PetscObject)A,MATMPIAIJ,&match);CHKERRQ(ierr);
   if (!match) SETERRQ(PetscObjectComm((PetscObject)A), PETSC_ERR_SUP,"Requires MPIAIJ matrix as input");
   ierr = PetscLogEventBegin(MAT_Getlocalmat,A,0,0,0);CHKERRQ(ierr);
+  a = (Mat_SeqAIJ*)(mpimat->A)->data;
+  b = (Mat_SeqAIJ*)(mpimat->B)->data;
+  ai = a->i; aj = a->j; bi = b->i; bj = b->j;
+  aa = a->a; ba = b->a;
   if (scall == MAT_INITIAL_MATRIX) {
     ierr  = PetscMalloc((1+am)*sizeof(PetscInt),&ci);CHKERRQ(ierr);
     ci[0] = 0;

File src/vec/vec/impls/mpi/pdvec.c

         for (i=0; i<n; i++) {
 #if defined(PETSC_USE_COMPLEX)
           if (PetscImaginaryPart(values[i]) > 0.0) {
-            ierr = PetscViewerASCIIPrintf(viewer,"%18.16e + %18.16e i\n",PetscRealPart(values[i]),PetscImaginaryPart(values[i]));CHKERRQ(ierr);
+            ierr = PetscViewerASCIIPrintf(viewer,"%18.16e + %18.16ei\n",PetscRealPart(values[i]),PetscImaginaryPart(values[i]));CHKERRQ(ierr);
           } else if (PetscImaginaryPart(values[i]) < 0.0) {
-            ierr = PetscViewerASCIIPrintf(viewer,"%18.16e - %18.16e i\n",PetscRealPart(values[i]),-PetscImaginaryPart(values[i]));CHKERRQ(ierr);
+            ierr = PetscViewerASCIIPrintf(viewer,"%18.16e - %18.16ei\n",PetscRealPart(values[i]),-PetscImaginaryPart(values[i]));CHKERRQ(ierr);
           } else {
             ierr = PetscViewerASCIIPrintf(viewer,"%18.16e\n",PetscRealPart(values[i]));CHKERRQ(ierr);
           }