[Trilinos-Users] Epetra python interface

Bill Spotz wfspotz at sandia.gov
Wed May 30 14:56:10 MDT 2007


Maxsim,

I provided the wrappers for Epetra.FECrsMatrix, but haven't tested it  
much yet.  However, the auto-generated documentation seems useful:

$ python
Python 2.5.1 (r251:54863, May 27 2007, 17:33:37)
[GCC 4.0.1 (Apple Computer, Inc. build 5363)] on darwin
Type "help", "copyright", "credits" or "license" for more information.
 >>> from PyTrilinos import Epetra
 >>> help(Epetra.FECrsMatrix.SumIntoGlobalValues)

Help on method SumIntoGlobalValues in module Epetra:

SumIntoGlobalValues(*args) unbound Epetra.FECrsMatrix method
     SumIntoGlobalValues(self, int GlobalRow, int NumEntries, double  
Values, int Indices) -> int
     SumIntoGlobalValues(self, int row, PyObject values, PyObject  
indices) -> int
     SumIntoGlobalValues(self, int numIndices, int indices, double  
values, int format=COLUMN_MAJOR) -> int
     SumIntoGlobalValues(self, int numIndices, int indices, double  
values) -> int
     SumIntoGlobalValues(self, int numRows, int rows, int numCols,  
int cols, double values,
         int format=COLUMN_MAJOR) -> int
     SumIntoGlobalValues(self, int numRows, int rows, int numCols,  
int cols, double values) -> int
     SumIntoGlobalValues(self, int numIndices, int indices, double  
values, int format=ROW_MAJOR) -> int
     SumIntoGlobalValues(self, int numIndices, int indices, double  
values) -> int
     SumIntoGlobalValues(self, int numRows, int rows, int numCols,  
int cols, double values,
         int format=ROW_MAJOR) -> int
     SumIntoGlobalValues(self, int numRows, int rows, int numCols,  
int cols, double values) -> int
     SumIntoGlobalValues(self, Epetra_IntSerialDenseVector indices,  
Epetra_SerialDenseMatrix values,
         int format=COLUMN_MAJOR) -> int
     SumIntoGlobalValues(self, Epetra_IntSerialDenseVector indices,  
Epetra_SerialDenseMatrix values) -> int
     SumIntoGlobalValues(self, Epetra_IntSerialDenseVector rows,  
Epetra_IntSerialDenseVector cols,
         Epetra_SerialDenseMatrix values,
         int format=COLUMN_MAJOR) -> int
     SumIntoGlobalValues(self, Epetra_IntSerialDenseVector rows,  
Epetra_IntSerialDenseVector cols,
         Epetra_SerialDenseMatrix values) -> int


The last four calling signatures may be of interest to you since they  
use serial dense vectors and matrices to specify more complicated  
assignment operations.

On May 30, 2007, at 2:28 PM, maxsimg at nist.gov wrote:

> Hello everyone,
>
> I am trying to populate an epetra sparse matrix, using the python  
> interfaces
> available through PyTrilinos. Ideally, I would like to specify a  
> list of row
> indices, column indices, and values to insert (or sum into) the  
> matrix. I've
> tried to use some of the overloaded forms of InsertGlobalValues and
> SumIntoGlobalValues, but some of the ones that I have tried give me
> "NotImplementedError: Wrong number of arguments for overloaded  
> function
> 'FECrsMatrix_SumIntoGlobalValues'" and others don't support  
> inserting into
> multiple rows, so I'm not sure what to use and how. Would someone  
> be able to
> suggest what is a good way to populate a matrix through the  
> available python
> wrappers?
>
> Ideally, I'd like to do something like
>
> theMatrix.putGlobalValues(values, i, j)
>
> where i is a list of indices and j is a list of indices, where the  
> lengths of
> i,j, and values are the same.
>
> -Maxsim Gibiansky

** Bill Spotz                                              **
** Sandia National Laboratories  Voice: (505)845-0170      **
** P.O. Box 5800                 Fax:   (505)284-5451      **
** Albuquerque, NM 87185-0370    Email: wfspotz at sandia.gov **




More information about the Trilinos-Users mailing list