[Trilinos-Users] Problems with Epetra_CrsMatrix Multiply()
Tudor Buican
tudor at timb.com
Thu Jul 17 16:08:01 MDT 2008
Hi, everybody.
I am trying to multiply a rectangular Epetra_CrsMatrix, which I
construct from an MM file, by an Epetra_Vector, using the Multiply(...)
method. It all works fine if I read in an MM file for a square matrix,
but I run into problems with files for rectangular matrices.
1. Here is my MM file for a simple 12X10 matrix:
%%MatrixMarket matrix coordinate real general
% Generated 02-Jul-2008
12 10 10
1 1 1
2 2 1
5 3 1
6 4 1
7 5 1
9 6 1
9 7 1
10 8 1
11 9 1
12 10 1
2. I read in the file with
Epetra_CrsMatrix* pNull;
EpetraExt::MatrixMarketFileToCrsMatrix(argv[2], mMap, mMap,ix(argv[2],
mMap, mMap,
nMap, pNull);
where mMap and nMap are constructed as
Epetra_Map mMap(M, 0, Comm);
Epetra_Map nMap(N, 0, Comm);
with M=12 (No. of rows) and N=10 (No. of columns). The resulting matrix,
pointed to by pNull, prints out as
Number of Global Rows = 12
Number of Global Cols = 10
Number of Global Diagonals = 2
Number of Global Nonzeros = 10
Global Maximum Num Entries = 2
** Matrix is Lower Triangular **
Number of My Rows = 12
Number of My Cols = 10
Number of My Diagonals = 2
Number of My Nonzeros = 10
My Maximum Num Entries = 2
Processor Row Index Col Index Value
0 0 0 1
0 1 1 1
0 4 2 1
0 5 3 1
0 6 4 1
0 8 5 1
0 8 6 1
0 9 7 1
0 10 8 1
0 11 9 1
So far, so good.
3. However, the domain map for this matrix, as returned by pNull-
>DomainMap(), is not nMap with its 10 global elements, but a map with 12
global elements, just like the row and range maps. Moreover, the result
is the same if I use nMap and mMap for range and domain maps,
respectively!
4. If I try to multiply the above matrix by q, a 10-element
Epetra_Vector constructed with nMap, with the result in p, a 12-element
vector constructed with mMap,
pNull->Multiply(false, q, p);
I get the following error messages:
Epetra ERROR -3, ../../../../packages/epetra/src/Epetra_DistObject.cpp,
line 110
Epetra ERROR -3, ../../../../packages/epetra/src/Epetra_CrsMatrix.cpp,
line 2353
(I'm using Trilinos v. 8.0.4.)
5. However,
pNull->Multiply(true, q, p);
works and q is multiplied by the transposed matrix, but as if this was a
12X12 problem, with q and the matrix being padded with 0s.
========================
Can anybody figure out what it is that I'm doing wrong?
Thanks in advance,
-Tudor
--
Tudor N. Buican, PhD
Managing Member
SEA LLC
phone: 505-271-9925, 505-818-7303
fax: 505-271-9925
email: tudor at timb.com
More information about the Trilinos-Users
mailing list