Hello,
I have a matrix generated from matrix matrix multiplication. I want that
matrix to convert to 1 dimensional array. my code is as below
#####################################################
//Multiplication A * B (A is MPIAIJ & B is MPIDENSE)
MatMatMult(A, B, MAT_INITIAL_MATRIX, PETSC_DEFAULT, &C);
MatView(C,PETSC_VIEWER_STDOUT_WORLD);
//Convert Matrix C to 1D vector h_C
for(i = 0; i < m; i++)
{
for(j = 0; j < k; j++)
{
ierr = MatGetValues(C, 1, &i, 1, &j,
&h_C[IDX2C(i,j,end1)]);CHKERRQ(ierr);
}
}
//printArray(h_B, m, k, "h_B");
printArray(h_C, m, k, "A * X0");
#####################################################
when I tried the routine MatGetValues() it shows some error as below
#####################################################
--------------------- Error Message ------------------------------------
[1]PETSC ERROR: No support for this operation for this object type!
[1]PETSC ERROR: Only local values currently supported!
[1]PETSC ERROR:
------------------------------------------------------------------------
[1]PETSC ERROR: Petsc Release Version 3.3.0, Patch 0, Tue Jun 5 14:20:42 CDT
2012
[1]PETSC ERROR: See docs/changes/index.html for recent updates.
[1]PETSC ERROR: See docs/faq.html for hints about trouble shooting.
[1]PETSC ERROR: See docs/index.html for manual pages.
[1]PETSC ERROR:
------------------------------------------------------------------------
[1]PETSC ERROR: ./blockCG_1 on a arch-linu named hpcd.cs.odu.edu by ppatel Tue
Aug 19 12:29:41 2014
[1]PETSC ERROR: Libraries linked from /export/software/petsc-3.3/lib
[1]PETSC ERROR: Configure run at Wed Jun 6 16:29:21 2012
[1]PETSC ERROR: Configure options --prefix=/export/software/petsc-3.3
--download-f-blas-lapack=1
[1]PETSC ERROR:
------------------------------------------------------------------------
[1]PETSC ERROR: MatGetValues_MPIDense() line 180 in
src/mat/impls/dense/mpi/mpidense.c
[1]PETSC ERROR: MatGetValues() line 1602 in src/mat/interface/matrix.c
[1]PETSC ERROR: main() line 343 in blockCG_1.c
--------------------------------------------------------------------------
MPI_ABORT was invoked on rank 1 in communicator MPI_COMM_WORLD
with errorcode 56.
NOTE: invoking MPI_ABORT causes Open MPI to kill all MPI processes.
You may or may not see output from other processes, depending on
exactly when Open MPI kills them.
--------------------------------------------------------------------------
#####################################################
what is the efficient way to create a 1-D array from the PETSC matrix?