Re: [Trilinos-Users] =?ISO-8859-1?Q?Problems understandin?= g MatrixMarketFileTo =?ISO-8859-1?Q?C rsMatrix?=

trilinos at perfect-kreim.de trilinos at perfect-kreim.de
Thu Dec 27 09:57:04 MST 2007


Hi,

thank you for your answer, Mike, but I still do not get it. But at least
I have no more compiler errors. Unfortunately I have now error from my
code.

I created now a Epetra_Map with NumGlobalElements of the size of my
matrix (961*961 Elements). Then I tried to read in a MatrixMarket file
using EpetraExt::MatrixMarketFileToCrsMatrix and the map I created.
But this gives me a -1-error. The trilinos-documentation says here:
Returns 0 if no error, -1 if any problems with file system.

I don't know what this means. The file exists and has permissions 777
and I give the full path to the file in my code.

So maybe you or somebody else has some ideas.

Thank you,

Michael

Here is my code:
#include "header.hpp"
int main( int argc, char *argv[]) {

	// Creation of an Epeter Communicator
	// This Code works on Serial and on Parallel Computers :-)
	#ifdef HAVE_MPI
		MPI_Init(&argc, &argv);
		Epetra_MpiComm Comm(MPI_COMM_WORLD);
	#else
		Epetra_SerialComm Comm;
	#endif
	std::cout << "  COMM: " << Comm << endl;

	const int NumGlobalElements=961*961;
	const char*
filename="/home/kreim/trilinos-tests/matlab_trilinos/mat_A.mtx"; //
mat_A.mtx

	Epetra_Map map(NumGlobalElements,1,Comm);
	Epetra_CrsMatrix *A;

	int answer=EpetraExt::MatrixMarketFileToCrsMatrix(filename,map,A);
	std::cout << "ANSWER: " << answer << endl;

//	std::cout << "   MAP: " << map << endl;
	std::cout << "MATRIX: " << A << endl;


	#ifdef HAVE_MPI
	  MPI_Finalize();
	#endif
	return EXIT_SUCCESS;
} // end of int main()

The file header.hpp only contains a lot of includes.

Here is the output from my code:
  COMM: Epetra::Comm
::Processor 0 of 1 total processors.
Epetra ERROR -1,
../../../../packages/epetraext/src/inout/EpetraExt_CrsMatrixIn.cpp, line
119
Epetra ERROR -1,
../../../../packages/epetraext/src/inout/EpetraExt_CrsMatrixIn.cpp, line
54
ANSWER: -1
MATRIX: 0xb7f3ab28
(1120) kreim at fb04370 ~

and here are the first 10 lines from my MatrixMarketFile:
 ls -lah /home/kreim/trilinos-tests/matlab_trilinos/mat_A.mtx
-rwxrwxrwx 1 kreim students 30K Dec 27 16:07
/home/kreim/trilinos-tests/matlab_trilinos/mat_A.mtx

$ head /home/kreim/trilinos-tests/matlab_trilinos/mat_A.mtx
%%MatrixMarket matrix coordinate real symmetric
% Generated 27-Dec-2007
961 961 2821
1 1  4
332 1 -1
333 1 -1
708 1 -1
709 1 -1
2 2  4
254 2 -1

Michael A Heroux schrieb:
> Michael,
>
> There is a fairly detailed example in the test directory
> trilinos/packages/epetraext/test/inout
>
> Mike
>
> On 12/24/07 6:32 AM, "trilinos at perfect-kreim.de"
<trilinos at perfect-kreim.de>
> wrote:
>
>> Hello and merry Christmas,
>>
>> I have some problems to understand the
>> EpetraExt::MatrixMarketFileToCrsMatrix function.[...]







More information about the Trilinos-Users mailing list