[Trilinos-Users] Problems understandin g MatrixMarketFileToC rsMatrix

trilinos at perfect-kreim.de trilinos at perfect-kreim.de
Mon Dec 24 05:32:51 MST 2007


Hello and merry Christmas,

I have some problems to understand the
EpetraExt::MatrixMarketFileToCrsMatrix function.

I am trying to read in a matrix A and a right side vector b, produced by
 some matlab-code. The matlab-code writes the data to a matri-market
file  using the mmwrite()-function from
http://math.nist.gov/MatrixMarket/ .

After this I try to read this matrix and vector by a
trilinos-c++-program to solve the system Ax=b with Aztec00.

But as I sad before: I don't understand the
MatrixMarketFileToCrsMatrix-function.

I tried something like this:

// Basic Includes
#include <iostream>
#include <stdlib.h>
#include <string>
#include <sstream>

// Trilinos -> Epetra Includes
#include "Epetra_ConfigDefs.h"
#ifdef HAVE_MPI
	#include "mpi.h"
	#include "Epetra_MpiComm.h"
#else
	#include "Epetra_SerialComm.h"
#endif

#include "Trilinos_Util.h"
#include "Epetra_Time.h"
#include "Epetra_Export.h"
#include "Epetra_VbrMatrix.h"
#include "EpetraExt_RowMatrixOut.h"
#include "Epetra_Comm.h"
#include "Epetra_Map.h"
#include "Epetra_BlockMap.h"
#include "Epetra_MultiVector.h"
#include "Epetra_Vector.h"
#include "Epetra_SerialDenseMatrix.h"
#include "Epetra_SerialDenseVector.h"
#include "Epetra_IntSerialDenseMatrix.h"
#include "Epetra_IntSerialDenseVector.h"
#include "Epetra_DataAccess.h"
#include "Epetra_CrsMatrix.h"
#include "EpetraExt_MatrixMatrix.h"
#include "EpetraExt_CrsMatrixIn.h"
#define EXIT_SUCCESS 0   /* Status-Messages for exits */
#define EXIT_FAILED 1    /* Status-Messages for error exits */

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

	Epetra_CrsMatrix A;
	EpetraExt::MatrixMarketFileToCrsMatrix("mat_A.mtx",Comm,A);

	std::cout << A;

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



But I only got error-messages when compiling.
 Does somebody have some example-code for this problem?

Maybe I understand everything better by seeing some working code.

Thank you,

Michael Kreim






More information about the Trilinos-Users mailing list