PyTrilinos.Anasazi
The Anasazi Trilinos package makes heavy use of templates, which makes
it nearly impossible for the python interface to track it identically.
Anasazi classes are templated on one or more of the following
parameters:
<ScalarType, MV, OP>
where ScalarType is a primitive data type specifying the floating
point representation of the eigenproblem, MV is a multi-vector
class and OP is an operator class. All Anasazi classes are
templated on <ScalarType>. Some are templated on <ScalarType,
MV>, and some are templated on all three parameters.
Currently, PyTrilinos.Anasazi supports only one interface, to
Epetra. Thus, the corresponding concrete C++ instantiations are
on:
<double, Epetra_MultiVector, Epetra_Operator>
These are indicated in python by using the Anasazi class name and
adding the suffix Double for ScalarType-only templated
classes, or the suffix Epetra for any of the other templated
classes. So, for example:
>>> from PyTrilinos import Anasazi
>>> eig = Anasazi.ValueDouble()
>>> print eig
0+0j
>>> bSort = Anasazi.BasicSortEpetra()
>>> print bSort
<Anasazi.BasicSortEpetra; proxy of <Swig Object of type 'Anasazi::BasicSort<double,
Epetra_MultiVector,Epetra_Operator > *' at 0x6eef50> >
An additional layer of abstraction is provided so that these suffixes
need not be remembered or used. Since there is currently only one
interface, these suffix-less class names are essentially aliases for
their longer-named counterparts:
>>> eig = Anasazi.Value()
>>> bSort = Anasazi.BasicSort()
>>> print type(eig), type(bSort)
<class 'Anasazi.ValueDouble'> <class 'Anasazi.BasicSortEpetra'>
In the future, if additional interfaces are supported (for example, a
NumPy interface), then the requested interface will be inferred from
the constructor arguments, if possible. For those cases where this is
not possible, we will also provide type-specification capabilities
that are similar to NumPy.
A second difference between Trilinos Anasazi and
PyTrilinos.Anasazi is that any methods that expect a
Teuchos::RCP<object>
as an argument, where object is of any type, will take a python
object of corresponding type, without the reference-counted pointer
wrapper.
The Anasazi.Eigensolution class has been changed such that the
attributes Evals, Evecs and Espace have been changed to
methods Evals(), Evecs() and Espace(). Evals()
returns a numpy.ndarray of type complex double rather than a
wrapper to std::vector<Anasazi::Value<double> >. Also, the
Evecs() and Espace() methods return Epetra.MultiVector
objects. Currently, index is still an attribute, and is a python
list-like object containing integers. (The other attributes must be
implemented as methods in order to facilitate the type conversions.)
You can create an Anasazi.Value object if you wish, although it is
not very functional. It has a __str__() method so that you can
print its value.